Corrections to 3438 (#3452)

* correct previous misstake in #3438

wrong, this fixes that.

* add checking for second argument to --package

nice to have

* split find result into path and file
This commit is contained in:
ebbit1q 2018-11-22 23:32:18 +01:00 committed by Zach H
parent 964bb0974c
commit c7b8f3e923

View file

@ -17,8 +17,11 @@ while [[ "$@" ]]; do
;; ;;
'--package') '--package')
MAKE_PACKAGE=1 MAKE_PACKAGE=1
PACKAGE_NAME="$2" shift
shift 2 if [[ $1 != -* ]]; then
PACKAGE_NAME="$1"
shift
fi
;; ;;
'--server') '--server')
MAKE_SERVER=1 MAKE_SERVER=1
@ -119,11 +122,13 @@ fi
if [[ $MAKE_PACKAGE ]]; then if [[ $MAKE_PACKAGE ]]; then
make package make package
if [[ $PACKAGE_NAME ]]; then if [[ $PACKAGE_NAME ]]; then
if file=$(find . -maxdepth 1 -type f -name Cockatrice-*.* -print -quit); then found=$(find . -maxdepth 1 -type f -name "Cockatrice-*.*" -print -quit)
mv "$file" "${file%%.*}-$PACKAGE_NAME.${file#*.}" path=${found%/*}
else file=${found##*/}
if [[ $file != *.* ]]; then
echo "could not find package" >&2 echo "could not find package" >&2
exit 1 exit 1
fi fi
mv "$path/$file" "$path/${file%%.*}-$PACKAGE_NAME.${file#*.}"
fi fi
fi fi