diff --git a/script/package_release.sh b/script/package_release.sh index 386d00b..fabb55c 100755 --- a/script/package_release.sh +++ b/script/package_release.sh @@ -1,19 +1,19 @@ -#!/bin/bash +#!/usr/bin/env bash set -x PROJECT=ChatPlaysRTS version=$1 zipfile=$PROJECT-$version.zip -if ! [ -n "$version" ]; then - echo "Usage: $(basename $0) version" 1>&2 +if [ -z "$version" ]; then + echo "Usage: $(basename "$0") version" 1>&2 exit 1 fi mkdir -p .tmp/$PROJECT files=$(git ls-tree -r HEAD --name-only | grep -v "^\.gitignore$") -rsync -R $files .tmp/$PROJECT -pushd .tmp -zip -r $zipfile $PROJECT -mv $zipfile ../ -popd -rm -rf .tmp +rsync -R "$files" .tmp/$PROJECT +pushd .tmp || exit 1 +zip -r "$zipfile" $PROJECT +mv "$zipfile" ../ +popd || exit 1 +rm -rf .tmp