diff options
-rwxr-xr-x | trunk/utils/enable-mkbuild-section | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/trunk/utils/enable-mkbuild-section b/trunk/utils/enable-mkbuild-section index 0889f1a..17efd77 100755 --- a/trunk/utils/enable-mkbuild-section +++ b/trunk/utils/enable-mkbuild-section @@ -17,24 +17,28 @@ # CWD="`pwd`" -BASE="/path/to/mkbuilds" -MATCH="SLACK REQUIRED" # example parameter -ADD_BEFORE="on: build_package" # example section -INCLUDE=" on: slack-required" # example section +BASE="/data/projetos/code/mkbuilds" +MATCH=": manifest_check" # example parameter +ADD_BEFORE=": untar_source" # example section +INCLUDE=" on: manifest_check" # example section cd $BASE -FILES="`grep -R "$MATCH" * | grep -v .svn | grep -v '""' | cut -d : -f 1`" +FILES="` grep -l -R -L -e "$MATCH" * | grep -v .svn`" # match criteria +#FILES="`grep -R "$MATCH" * | grep -v .svn | grep -v '""' | cut -d : -f 1 | uniq`" # unmatch criteria for file in $FILES; do - LINES="`wc -l $file | awk '{ print $1 }'`" - CENTER="`sed = $file | sed 'N;s/\n/\t/' | grep "$ADD_BEFORE" | awk '{ print $1 }'`" - CENTER="`echo $(($CENTER -1))`" - END="`echo $(($LINES - $CENTER))`" - head -n $CENTER $file > $file.new - echo "$INCLUDE" >> $file.new - tail -n $END $file >> $file.new - cat $file.new > $file - rm $file.new + if [ "`basename $file .mkbuild`" != "`basename $file`" ]; then + echo processing $file + LINES="`wc -l $file | awk '{ print $1 }'`" + CENTER="`sed = $file | sed 'N;s/\n/\t/' | grep "$ADD_BEFORE" | awk '{ print $1 }'`" + CENTER="`echo $(($CENTER -1))`" + END="`echo $(($LINES - $CENTER))`" + head -n $CENTER $file > $file.new + echo "$INCLUDE" >> $file.new + tail -n $END $file >> $file.new + cat $file.new > $file + rm $file.new + fi done cd $CWD |