##// END OF EJS Templates
demo pour seb
Alexis -
r51:c98aba3842d3 default
parent child
Show More
@@ -1,1 +1,2
1 touch test No newline at end of file
1 touch test
2 touch test2
@@ -1,82 +1,82
1 echo "======================================================================================="
1 echo "======================================================================================="
2 echo "---------------------------------------------------------------------------------------"
2 echo "---------------------------------------------------------------------------------------"
3 echo " LPP GPL PATCHER "
3 echo " LPP GPL PATCHER "
4 echo " Copyright (C) 2010 Laboratory of Plasmas Physic. "
4 echo " Copyright (C) 2010 Laboratory of Plasmas Physic. "
5 echo "======================================================================================="
5 echo "======================================================================================="
6 echo '----------------------------------------------------------------------------------------
6 echo '----------------------------------------------------------------------------------------
7 This file is a part of the LPP VHDL IP LIBRARY
7 This file is a part of the LPP VHDL IP LIBRARY
8 Copyright (C) 2010, Laboratory of Plasmas Physic - CNRS
8 Copyright (C) 2010, Laboratory of Plasmas Physic - CNRS
9
9
10 This program is free software; you can redistribute it and/or modify
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 3 of the License, or
12 the Free Software Foundation; either version 3 of the License, or
13 (at your option) any later version.
13 (at your option) any later version.
14
14
15 This program is distributed in the hope that it will be useful,
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
18 GNU General Public License for more details.
19
19
20 You should have received a copy of the GNU General Public License
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 ----------------------------------------------------------------------------------------'
23 ----------------------------------------------------------------------------------------'
24 echo
24 echo
25 echo
25 echo
26 echo
26 echo
27
27
28 # Absolute path to this script. /home/user/bin/foo.sh
28 # Absolute path to this script. /home/user/bin/foo.sh
29 #SCRIPT=$(readlink -f $0)
29 #SCRIPT=$(readlink -f $0)
30 # Absolute path this script is in. /home/user/bin
30 # Absolute path this script is in. /home/user/bin
31
31
32 #LPP_PATCHPATH=`dirname $SCRIPT`
32 #LPP_PATCHPATH=`dirname $SCRIPT`
33 LPP_PATCHPATH=`pwd -L`
33 LPP_PATCHPATH=`pwd -L`
34
34
35
35
36 cd $LPP_PATCHPATH/$3
36 cd $LPP_PATCHPATH/$3
37
37
38 echo $LPP_PATCHPATH/$3
38 echo $LPP_PATCHPATH/$3
39 echo $LPP_PATCHPATH
39 echo $LPP_PATCHPATH
40
40
41 case $1 in
41 case $1 in
42 -R | --recursive )
42 -R | --recursive )
43 for file in $(find . -name *.$2)
43 for file in $(find . -name *.$2)
44 do
44 do
45 if(grep -q "This program is free software" $file); then
45 if(grep -q "This program is free software" $file); then
46 echo "$file already contains GPL HEADER"
46 echo "$file already contains GPL HEADER"
47 else
47 else
48 echo "Modifying file : $file"
48 echo "Modifying file : $file"
49 more $LPP_PATCHPATH/licenses/GPL_V3/${2}HEADER >> $file.tmp
49 more $LPP_PATCHPATH/licenses/GPL_V3/${2}HEADER >> $file.tmp
50 cat $file >> $file.tmp
50 cat $file >> $file.tmp
51 mv $file.tmp $file
51 mv $file.tmp $file
52 fi
52 fi
53 done
53 done
54 ;;
54 ;;
55 -h | --help | --h | -help)
55 -h | --help | --h | -help)
56 echo 'Help:
56 echo 'Help:
57 This script add a GPL HEADER in all vhdl files.
57 This script add a GPL HEADER in all vhdl files.
58 usage: sh GPL_Patcher.sh [-R] [extension] [path]
58 usage: sh GPL_Patcher.sh [-R] [extension] [path]
59 -R or --recurcive:
59 -R or --recurcive:
60 Analyse recurcively folders starting from $LPP_PATCHPATH
60 Analyse recurcively folders starting from $LPP_PATCHPATH
61 extension
61 extension
62 for example vhd,h,c
62 for example vhd,h,c
63 path
63 path
64 starting path'
64 starting path'
65 ;;
65 ;;
66 * )
66 * )
67 for file in $(ls *.$2)
67 for file in $(ls *.$2)
68 do
68 do
69 if(grep -q "This program is free software" $file); then
69 if(grep -q "This program is free software" $file); then
70 echo "$file already contains GPL HEADER"
70 echo "$file already contains GPL HEADER"
71 else
71 else
72 echo "Modifying file : $file"
72 echo "Modifying file : $file"
73 more $LPP_PATCHPATH/licenses/GPL_V3/${2}HEADER >> $file.tmp
73 more $LPP_PATCHPATH/licenses/GPL_V3/${2}HEADER >> $file.tmp
74 cat $file >> $file.tmp
74 cat $file >> $file.tmp
75 mv $file.tmp $file
75 mv $file.tmp $file
76 fi
76 fi
77 done
77 done
78 ;;
78 ;;
79
79
80 esac
80 esac
81
81
82 cd $LPP_PATCHPATH
82 cd $LPP_PATCHPATH
General Comments 0
You need to be logged in to leave comments. Login now