zotero/app/scripts/xulrunner_hash
2023-07-05 15:01:41 +03:00

43 lines
897 B
Bash
Executable file

#!/bin/bash
set -euo pipefail
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
APP_ROOT_DIR="$(dirname "$SCRIPT_DIR")"
. "$APP_ROOT_DIR/config.sh"
cd "$APP_ROOT_DIR"
platform=""
while getopts ":p:" opt; do
case $opt in
p)
platform="$OPTARG"
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
exit 1
;;
esac
done
if [ $platform == "m" ]; then
GECKO_VERSION="$GECKO_VERSION_MAC"
elif [ $platform == "w" ]; then
GECKO_VERSION="$GECKO_VERSION_WIN"
elif [ $platform == "l" ]; then
GECKO_VERSION="$GECKO_VERSION_LINUX"
else
echo "Platform parameter incorrect. Usage: -p m(mac)/w(windows)/l(linux)"
exit 1
fi
xulrunner_content=$(< "$SCRIPT_DIR/fetch_xulrunner")
xulrunner_gecko_hash=$(echo -n "$GECKO_VERSION - '$xulrunner_content'" | openssl dgst -sha256)
echo "$xulrunner_gecko_hash"