From: Matthias Maier Date: Thu, 18 Jul 2013 20:09:50 +0000 (+0000) Subject: Check in the shell script for the license replacement X-Git-Tag: v8.0.0~71 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b6e66a9ad866db4276a1db4ec4f3cba0303ff1d1;p=dealii.git Check in the shell script for the license replacement git-svn-id: https://svn.dealii.org/trunk@30051 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/doc/license/replace.sh b/deal.II/doc/license/replace.sh new file mode 100755 index 0000000000..f43cf5241f --- /dev/null +++ b/deal.II/doc/license/replace.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +FILE=$1 + +FIRST_YEAR=$(grep Copyright $FILE | perl -pi -e 's/.*?(\d{4}).*/\1/') +if [ "$FIRST_YEAR" = "2013" ] || (! [[ "$FIRST_YEAR" =~ "^[0-9]+$" ]]) +then + YEAR="2013" +else if + YEAR="$FIRST_YEAR - 2013" +fi + +sed -e "s/@YEAR@/$YEAR/" doc/license/header-template > /tmp/foobar22.temp + +header_lines=1 +on_whitespace=true +whitespace_detected=false +while read line +do + if $on_whitespace && [[ $line =~ "^$" ]] + then + whitespace_detected=true + header_lines=$[$header_lines+1] + continue + else + on_whitespace=false + fi + + if ! [[ $line =~ "^//.*$" ]] + then + break + else + header_lines=$[$header_lines+1] + fi +done < $FILE + +if $whitespace_detected +then + echo "$FILE --> whitespace" + echo "$FILE --> $header_lines" +else + if [ $header_lines -lt 10 ] + then + echo "$FILE --> $header_lines" + fi +fi + +tail -n+$header_lines $FILE >> /tmp/foobar22.temp + +cp /tmp/foobar22.temp $FILE +