2020-08-08 02:22:05 +03:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
set +x
|
|
|
|
|
|
|
|
if [[ ("$1" == "-h") || ("$1" == "--help") ]]; then
|
|
|
|
echo "usage: $(basename $0) [output-absolute-path]"
|
|
|
|
echo
|
|
|
|
echo "Generate distributable .zip archive from ./output folder that was previously downloaded."
|
|
|
|
echo
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
ZIP_PATH=$1
|
|
|
|
if [[ $ZIP_PATH != /* ]]; then
|
|
|
|
echo "ERROR: path $ZIP_PATH is not absolute"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if [[ $ZIP_PATH != *.zip ]]; then
|
|
|
|
echo "ERROR: path $ZIP_PATH must have .zip extension"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if [[ -f $ZIP_PATH ]]; then
|
|
|
|
echo "ERROR: path $ZIP_PATH exists; can't do anything."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if ! [[ -d $(dirname $ZIP_PATH) ]]; then
|
|
|
|
echo "ERROR: folder for path $($ZIP_PATH) does not exist."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
trap "cd $(pwd -P)" EXIT
|
|
|
|
cd "$(dirname $0)"
|
|
|
|
|
2020-08-11 01:00:37 +03:00
|
|
|
cp output/build.zip $ZIP_PATH
|