X-Git-Url: https://git.m6w6.name/?p=m6w6%2Frepo-template;a=blobdiff_plain;f=init;h=faf9cac1988925ca5364c9724d9153891323b15c;hp=0e63ff0a4745534748fdb84043030d0ed38f60f7;hb=HEAD;hpb=f265112eb9ffab49ac47c7500cbf87fee7813673 diff --git a/init b/init index 0e63ff0..faf9cac 100755 --- a/init +++ b/init @@ -4,6 +4,13 @@ export REPO=$(basename $(pwd) .git) +if test $(uname) = "Linux" +then + MKTEMP=mktemp +else + MKTEMP="mktemp -t repo-template" +fi + while test $# -gt 0 do export "$1" @@ -19,12 +26,23 @@ do ;; composer.json) test "${COMPOSER+set}" = "" && continue - SRCFILE=$(mktemp -t $RANDOM) + SRCFILE=$($MKTEMP) php -d variables_order=E $(dirname -- $0)/presets/composer.json >$SRCFILE ;; - README.md) - SRCFILE=$(mktemp -t $RANDOM) - php -d variables_order=E $(dirname -- $0)/presets/README.md >$SRCFILE + package.xml|CREDITS|config.*|Makefile.frag) + test "${PECL+set}" = "" && continue + SRCFILE=$($MKTEMP) + php -d variables_order=E $(dirname -- $0)/presets/$FILE >$SRCFILE + ;; + README.md|LICENSE) + SRCFILE=$($MKTEMP) + php -d variables_order=E $(dirname -- $0)/presets/$FILE >$SRCFILE + ;; + mdref.mdref) + test "${MDREF+set}" = "" && continue + SRCFILE=$($MKTEMP) + php -d variables_order=E $(dirname -- $0)/presets/$FILE >$SRCFILE + FILE=$MDREF.mdref ;; *) ;; @@ -33,8 +51,7 @@ do if test -e $FILE then DIFF="diff -udbBE -- $SRCFILE $FILE" - # ignore changes with only additions or removals - if ! $DIFF | awk '{if(NR<4){next}}/^-/{if(p){exit 1}m++}/^\+/{if(m){exit 1}p++}' + if ! $DIFF >/dev/null then while read -n 1 -p "File $FILE exists and differs (q,s,r,d,v,?) " ACTION do