From e18a4d8e74f7f295a019608ed971923d436fb7a5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 22 Jun 2013 23:28:44 +0200 Subject: [PATCH] Qual: Move feature of a script as an option of other. This reduce number of scripts to support. --- dev/findutf8bomincludes.sh | 10 ---------- dev/fixutf8bomfiles.sh | 12 +++++++++--- 2 files changed, 9 insertions(+), 13 deletions(-) delete mode 100755 dev/findutf8bomincludes.sh diff --git a/dev/findutf8bomincludes.sh b/dev/findutf8bomincludes.sh deleted file mode 100755 index 4a9458654d2..00000000000 --- a/dev/findutf8bomincludes.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -# -# Checks if files contains UTF-8 BOM -# in dolibarr includes tree excluding -# git repository -# -# Raphaƫl Doursenaud - rdoursenaud@gpcsolutions.fr -grep -rlI \ ---exclude-dir='.git' \ -$'\xEF\xBB\xBF' htdocs/includes diff --git a/dev/fixutf8bomfiles.sh b/dev/fixutf8bomfiles.sh index ea20f9957a2..db34cdcdc1d 100755 --- a/dev/fixutf8bomfiles.sh +++ b/dev/fixutf8bomfiles.sh @@ -12,20 +12,26 @@ # Syntax if [ "x$1" != "xlist" -a "x$1" != "xfix" ] then - echo "Usage: fixutf8bomfiles.sh [list|fix]" + echo "Usage: fixutf8bomfiles.sh (list|fix) [addincludes]" +fi + +if [ "x$2" != "xaddincludes" ] +then + export moreoptions="--exclude-dir='includes'" fi # To detec if [ "x$1" = "xlist" ] then #find . \( -iname '*.php' -print0 -o -iname '*.sh' -print0 -o -iname '*.pl' -print0 -o -iname '*.lang' -print0 -o -iname '*.txt' \) -print0 | xargs -0 awk '/^\xEF\xBB\xBF/ {print FILENAME} {nextfile}' - grep -rlIZ --include='*.php' --include='*.sh' --include='*.pl' --include='*.lang' --include='*.txt' --exclude-dir='.git' --exclude-dir='includes' --exclude-dir='custom' . . | xargs -0 awk '/^\xEF\xBB\xBF/ {print FILENAME} {nextfile}' + echo "grep -rlIZ --include='*.php' --include='*.sh' --include='*.pl' --include='*.lang' --include='*.txt' --exclude-dir='.git' --exclude-dir='.tx' $moreoptions --exclude-dir='custom' . . | xargs -0 awk '/^\xEF\xBB\xBF/ {print FILENAME} {nextfile}'" + grep -rlIZ --include='*.php' --include='*.sh' --include='*.pl' --include='*.lang' --include='*.txt' --exclude-dir='.git' --exclude-dir='.tx' $moreoptions --exclude-dir='custom' . . | xargs -0 awk '/^\xEF\xBB\xBF/ {print FILENAME} {nextfile}' fi # To convert if [ "x$1" = "xfix" ] then - for fic in `grep -rlIZ --include='*.php' --include='*.sh' --include='*.pl' --include='*.lang' --include='*.txt' --exclude-dir='.git' --exclude-dir='includes' --exclude-dir='custom' . . | xargs -0 awk '/^\xEF\xBB\xBF/ {print FILENAME} {nextfile}'` + for fic in `grep -rlIZ --include='*.php' --include='*.sh' --include='*.pl' --include='*.lang' --include='*.txt' --exclude-dir='.git' --exclude-dir='.tx' $moreoptions --exclude-dir='custom' . . | xargs -0 awk '/^\xEF\xBB\xBF/ {print FILENAME} {nextfile}'` do echo "Fixing $fic" sed -i '1s/^\xEF\xBB\xBF//' $fic