From 932d1724c9415701004a7efa3d31f63c60fcd2bc Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Sun, 13 Mar 2011 17:17:41 -0700 Subject: Simplify build-magic.sh code * Use /bin/sed directly instead of a /bin/bash script which only called sed * This change produces an incompatible spells-build file, and automatically deletes it. --- conf/build-magic.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'conf/build-magic.sh') diff --git a/conf/build-magic.sh b/conf/build-magic.sh index f064a286..30ec35b8 100755 --- a/conf/build-magic.sh +++ b/conf/build-magic.sh @@ -2,20 +2,19 @@ RSCRIPT="spells-build" -if [ -a $RSCRIPT ]; then printf ""; else - echo '#! /bin/bash' > $RSCRIPT; - echo 'sed \' >> $RSCRIPT; +if ! grep -q -s '/bin/sed' $RSCRIPT; then + echo '#! /bin/sed -f' > $RSCRIPT; chmod a+x $RSCRIPT fi for n in `grep -o '"#..."' magic.conf.template`; do - if grep $n $RSCRIPT; then printf ""; else + if ! grep -q $n $RSCRIPT; then CHANGES=1 - echo "'s/${n}/${n}/;'\\" >> $RSCRIPT; + echo "s/${n}/${n}/" >> $RSCRIPT; fi done if [ x$CHANGES == x1 ] then echo "${RSCRIPT} has been updated; please provide invocations for spells and/or teleport anchors."; -else cat magic.conf.template | ./$RSCRIPT > magic.conf; +else ./$RSCRIPT magic.conf.template > magic.conf; fi -- cgit v1.2.3-70-g09d2