Browse Source

update shell scripts to support books/ subdirectory

remotes/origin/cmake
Romain Goffe 13 years ago
parent
commit
274d112aac
  1. 5
      utils/langbooks.sh
  2. 9
      utils/release.sh
  3. 19
      utils/volume-3.sh

5
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

9
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"

19
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"

Loading…
Cancel
Save