Automatically run fetch_xulrunner if xulrunner is missing or out of date (#3111)
This commit is contained in:
parent
93f009e9d8
commit
fa28228acb
3 changed files with 93 additions and 1 deletions
47
app/build.sh
47
app/build.sh
|
@ -110,6 +110,53 @@ while getopts "d:f:p:c:tseq" opt; do
|
|||
shift $((OPTIND-1)); OPTIND=1
|
||||
done
|
||||
|
||||
function check_xulrunner_hash {
|
||||
platform=$1
|
||||
|
||||
if [ $platform == "m" ]; then
|
||||
platform_hash_file="hash-mac"
|
||||
elif [ $platform == "w" ]; then
|
||||
platform_hash_file="hash-win"
|
||||
elif [ $platform == "l" ]; then
|
||||
platform_hash_file="hash-linux"
|
||||
else
|
||||
echo "Platform parameter incorrect. Acceptable values: m/w/l"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -e "$CALLDIR/xulrunner/$platform_hash_file" ]; then
|
||||
echo "xulrunner not found -- downloading"
|
||||
echo
|
||||
$CALLDIR/scripts/fetch_xulrunner -p $platform
|
||||
else
|
||||
recalculated_xulrunner_hash=$($CALLDIR/scripts/xulrunner_hash -p $platform)
|
||||
current_xulrunner_hash=$(< "$CALLDIR/xulrunner/$platform_hash_file")
|
||||
if [ "$current_xulrunner_hash" != "$recalculated_xulrunner_hash" ]; then
|
||||
echo "xulrunner hashes don't match -- redownloading"
|
||||
echo
|
||||
$CALLDIR/scripts/fetch_xulrunner -p $platform
|
||||
current_xulrunner_hash=$(< "$CALLDIR/xulrunner/$platform_hash_file")
|
||||
if [ "$current_xulrunner_hash" != "$recalculated_xulrunner_hash" ]; then
|
||||
echo "xulrunner hashes don't match after running fetch_xulrunner!"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
#Check if xulrunner and GECKO_VERSION for each platform match
|
||||
if [ $BUILD_MAC == 1 ]; then
|
||||
check_xulrunner_hash m
|
||||
fi
|
||||
if [ $BUILD_WIN == 1 ]; then
|
||||
check_xulrunner_hash w
|
||||
fi
|
||||
if [ $BUILD_LINUX == 1 ]; then
|
||||
check_xulrunner_hash l
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# Require source dir or ZIP file
|
||||
if [[ -z "$SOURCE_DIR" ]] && [[ -z "$ZIP_FILE" ]]; then
|
||||
usage
|
||||
|
|
|
@ -347,6 +347,7 @@ if [ $BUILD_MAC == 1 ]; then
|
|||
#if [ ! -e "Firefox $GECKO_VERSION MacOS.zip" ]; then
|
||||
# rm "MacOS.zip"
|
||||
#fi
|
||||
echo $($SCRIPT_DIR/xulrunner_hash -p m) > hash-mac
|
||||
fi
|
||||
|
||||
if [ $BUILD_WIN == 1 ]; then
|
||||
|
@ -374,6 +375,7 @@ if [ $BUILD_WIN == 1 ]; then
|
|||
echo
|
||||
echo
|
||||
done
|
||||
echo $($SCRIPT_DIR/xulrunner_hash -p w) > hash-win
|
||||
fi
|
||||
|
||||
if [ $BUILD_LINUX == 1 ]; then
|
||||
|
@ -404,7 +406,7 @@ if [ $BUILD_LINUX == 1 ]; then
|
|||
pushd firefox-x86_64
|
||||
modify_omni linux64
|
||||
popd
|
||||
|
||||
echo $($SCRIPT_DIR/xulrunner_hash -p l) > hash-linux
|
||||
rm "firefox-$GECKO_VERSION.tar.bz2"
|
||||
fi
|
||||
|
||||
|
|
43
app/scripts/xulrunner_hash
Executable file
43
app/scripts/xulrunner_hash
Executable file
|
@ -0,0 +1,43 @@
|
|||
#!/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"
|
||||
|
||||
|
Loading…
Add table
Reference in a new issue