]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Check in the shell script for the license replacement
authorMatthias Maier <tamiko@kyomu.43-1.org>
Thu, 18 Jul 2013 20:09:50 +0000 (20:09 +0000)
committerMatthias Maier <tamiko@kyomu.43-1.org>
Thu, 18 Jul 2013 20:09:50 +0000 (20:09 +0000)
git-svn-id: https://svn.dealii.org/trunk@30051 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/doc/license/replace.sh [new file with mode: 0755]

diff --git a/deal.II/doc/license/replace.sh b/deal.II/doc/license/replace.sh
new file mode 100755 (executable)
index 0000000..f43cf52
--- /dev/null
@@ -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
+

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.