From 274d112aacd778ce012dd6c4de14611b32c3d6e8 Mon Sep 17 00:00:00 2001 From: Romain Goffe Date: Sat, 15 Oct 2011 05:18:33 +0200 Subject: [PATCH] update shell scripts to support books/ subdirectory --- utils/langbooks.sh | 5 +++-- utils/release.sh | 9 +++++---- utils/volume-3.sh | 19 +++++++++++++------ 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/utils/langbooks.sh b/utils/langbooks.sh index 8bbafe60..c002ad3b 100755 --- a/utils/langbooks.sh +++ b/utils/langbooks.sh @@ -11,11 +11,12 @@ then fi; LANG=$1 +BOOKS_DIR="books/" if [ $LANG="english" -o $LANG="french" ]; then - cp "./utils/header-$LANG" "$LANG.sb" - grep "selectlanguage{$LANG}" songs/*/*.sg | sed 's|songs/\(.*\):.*| \"\1\",|; $ s|,$|\n ]\n}\n|' >> "$LANG.sb" + cp "./utils/header-$LANG" "$BOOKS_DIR$LANG.sb" + grep "selectlanguage{$LANG}" songs/*/*.sg | sed 's|songs/\(.*\):.*| \"\1\",|; $ s|,$|\n ]\n}\n|' >> "$BOOKS_DIR$LANG.sb" else echo "Error: $LANG is not a supported language" exit 2 diff --git a/utils/release.sh b/utils/release.sh index c79bb787..04e293ba 100755 --- a/utils/release.sh +++ b/utils/release.sh @@ -5,8 +5,6 @@ #Description: Build all the pdf on www.patacrep.com, increase their #version and commit/tag the result -export GREP_OPTIONS="" - #volume-3.sb ./utils/volume-3.sh #english.sb @@ -14,6 +12,9 @@ export GREP_OPTIONS="" #french.sb ./utils/langbooks.sh french +GREP="$GREP_OPTIONS" +export GREP_OPTIONS="" + #increase version RELEASE_TYPE=$1 VERSION=`grep "\"version\"" ./templates/patacrep.tmpl | sed -e 's/.*\"\([0-9]\+\)\.\([0-9]\+\)\.\?\([0-9]\+\)\?.*/export MAIN=\1\nexport MAJOR=\2\nexport MINOR=\3\n/'` @@ -33,7 +34,7 @@ then echo "error: unrecognised release type" fi; echo "new version : $MAIN.$MAJOR.$MINOR" - #update version field in sb files + #update version field in tmpl files sed -i "s/\"[0-9].[0-9].[0-9]\"/\"$MAIN.$MAJOR.$MINOR\"/" templates/patacrep.tmpl sed -i "s/\"[0-9].[0-9].[0-9]\"/\"$MAIN.$MAJOR.$MINOR\"/" templates/ancient.tmpl sed -i "s/\"[0-9].[0-9].[0-9]\"/\"$MAIN.$MAJOR.$MINOR\"/" templates/patacrep-en.tmpl @@ -75,4 +76,4 @@ then git tag "patacrep_$MAIN.$MAJOR.$MINOR" fi -export GREP_OPTIONS="--exclude-dir=\*/.svn/\* --exclude=\*~ --binary-files=without-match --line-number" +export GREP_OPTIONS="$GREP" diff --git a/utils/volume-3.sh b/utils/volume-3.sh index 986fc873..abc9706c 100755 --- a/utils/volume-3.sh +++ b/utils/volume-3.sh @@ -4,13 +4,18 @@ #Description: Generate an sb file containing all the songs that are not # already in volume-1 and volume-2 +GREP="$GREP_OPTIONS" +export GREP_OPTIONS="" + +BOOKS_DIR="books" + #all songs cd songs ls -1 */*.sg > ../res1 cd .. #get volume 1 list -tail -n +13 volume-1.sb > tmp1 +tail -n +13 "$BOOKS_DIR/volume-1.sb" > tmp1 head -n -2 tmp1 > list1 sed -i -e "s/\",//g" -e "s/ \"//g" -e "s/\"//g" list1 @@ -18,7 +23,7 @@ sed -i -e "s/\",//g" -e "s/ \"//g" -e "s/\"//g" list1 grep -vf list1 res1 > res2 #get volume 2 list -tail -n +14 volume-2.sb > tmp2 +tail -n +14 "$BOOKS_DIR/volume-2.sb" > tmp2 head -n -2 tmp2 > list2 sed -i -e "s/\",//g" -e "s/ \"//g" -e "s/\"//g" list2 @@ -31,10 +36,12 @@ head -c -2 res3 > res #make volume 3 sb file -cat utils/header-volume-3 > volume-3.sb -cat res >> volume-3.sb -echo "]" >> volume-3.sb -echo "}" >> volume-3.sb +cat utils/header-volume-3 > "$BOOKS_DIR/volume-3.sb" +cat res >> "$BOOKS_DIR/volume-3.sb" +echo "]" >> "$BOOKS_DIR/volume-3.sb" +echo "}" >> "$BOOKS_DIR/volume-3.sb" #remove tmp files rm -f res res1 res2 res3 list1 list2 tmp1 tmp2 + +export GREP_OPTIONS="$GREP"