1
0

contrib: shell scripts: add quotes around more variables

This commit is contained in:
SomberNight
2025-09-02 17:29:48 +00:00
parent 1c695dd53a
commit 4a0a3bb38a
11 changed files with 27 additions and 27 deletions

View File

@@ -2,7 +2,7 @@
set -e
here=$(dirname "$0")
here="$(dirname "$0")"
if [ -z "$WIN_SIGNING_PASSWORD" ]; then
echo "password missing"
exit 1

View File

@@ -5,9 +5,9 @@ set -e
PROJECT_ROOT="$(dirname "$(readlink -e "$0")")/../.."
CONTRIB="$PROJECT_ROOT/contrib"
here=$(dirname "$0")
here="$(dirname "$0")"
test -n "$here" -a -d "$here" || exit
cd $here
cd "$here"
if ! which osslsigncode > /dev/null 2>&1; then
echo "Please install osslsigncode"

View File

@@ -35,7 +35,7 @@ function verify_signature() {
function verify_hash() {
local file=$1 expected_hash=$2
actual_hash=$(sha256sum $file | awk '{print $1}')
actual_hash=$(sha256sum "$file" | awk '{print $1}')
if [ "$actual_hash" == "$expected_hash" ]; then
return 0
else
@@ -47,8 +47,8 @@ function verify_hash() {
function download_if_not_exist() {
local file_name=$1 url=$2
if [ ! -e $file_name ] ; then
wget -O $file_name "$url"
if [ ! -e "$file_name" ] ; then
wget -O "$file_name" "$url"
fi
}

View File

@@ -9,7 +9,7 @@ DEBIAN_APPIMAGE_DISTRO="bullseye" # should match build-linux/appimage Dockerfil
DEBIAN_WINE_DISTRO="bookworm" # should match build-wine Dockerfile base
DEBIAN_ANDROID_DISTRO="bookworm" # should match android Dockerfile base
contrib=$(dirname "$0")
contrib="$(dirname "$0")"
if [ ! -x /bin/wget ]; then
@@ -17,7 +17,7 @@ if [ ! -x /bin/wget ]; then
exit 1
fi
DEBIAN_SNAPSHOT_LATEST=$(wget -O- ${DEBIAN_SNAPSHOT_BASE}$(date +"?year=%Y&month=%m") 2>/dev/null | grep "^<a href=\"20" | tail -1 | sed -e 's#[^"]*"\(.\{17,17\}\).*#\1#')
DEBIAN_SNAPSHOT_LATEST=$(wget -O- "${DEBIAN_SNAPSHOT_BASE}$(date +"?year=%Y&month=%m")" 2>/dev/null | grep "^<a href=\"20" | tail -1 | sed -e 's#[^"]*"\(.\{17,17\}\).*#\1#')
if [ "${DEBIAN_SNAPSHOT_LATEST}x" = "x" ]; then
echo "could not find timestamp for debian packages"
@@ -32,15 +32,15 @@ wget -O /dev/null ${DEBIAN_SNAPSHOT} 2>/dev/null
echo "Valid!"
# build-linux
echo "deb ${DEBIAN_SNAPSHOT} ${DEBIAN_APPIMAGE_DISTRO} main" >$contrib/build-linux/appimage/apt.sources.list
echo "deb-src ${DEBIAN_SNAPSHOT} ${DEBIAN_APPIMAGE_DISTRO} main" >>$contrib/build-linux/appimage/apt.sources.list
echo "deb ${DEBIAN_SNAPSHOT} ${DEBIAN_APPIMAGE_DISTRO} main" > "$contrib/build-linux/appimage/apt.sources.list"
echo "deb-src ${DEBIAN_SNAPSHOT} ${DEBIAN_APPIMAGE_DISTRO} main" >> "$contrib/build-linux/appimage/apt.sources.list"
# build-wine
echo "deb ${DEBIAN_SNAPSHOT} ${DEBIAN_WINE_DISTRO} main" >$contrib/build-wine/apt.sources.list
echo "deb-src ${DEBIAN_SNAPSHOT} ${DEBIAN_WINE_DISTRO} main" >>$contrib/build-wine/apt.sources.list
echo "deb ${DEBIAN_SNAPSHOT} ${DEBIAN_WINE_DISTRO} main" > "$contrib/build-wine/apt.sources.list"
echo "deb-src ${DEBIAN_SNAPSHOT} ${DEBIAN_WINE_DISTRO} main" >> "$contrib/build-wine/apt.sources.list"
# android
echo "deb ${DEBIAN_SNAPSHOT} ${DEBIAN_ANDROID_DISTRO} main" >$contrib/android/apt.sources.list
echo "deb-src ${DEBIAN_SNAPSHOT} ${DEBIAN_ANDROID_DISTRO} main" >>$contrib/android/apt.sources.list
echo "deb ${DEBIAN_SNAPSHOT} ${DEBIAN_ANDROID_DISTRO} main" > "$contrib/android/apt.sources.list"
echo "deb-src ${DEBIAN_SNAPSHOT} ${DEBIAN_ANDROID_DISTRO} main" >> "$contrib/android/apt.sources.list"
echo "updated APT sources to ${DEBIAN_SNAPSHOT}"

View File

@@ -4,13 +4,13 @@
set -e
venv_dir=~/.electrum-venv
contrib=$(dirname "$0")
contrib="$(dirname "$0")"
# note: we should not use a higher version of python than what the binaries bundle
if [[ ! "$SYSTEM_PYTHON" ]] ; then
SYSTEM_PYTHON=$(which python3.10) || printf ""
else
SYSTEM_PYTHON=$(which $SYSTEM_PYTHON) || printf ""
SYSTEM_PYTHON=$(which "$SYSTEM_PYTHON") || printf ""
fi
if [[ ! "$SYSTEM_PYTHON" ]] ; then
echo "Please specify which python to use in \$SYSTEM_PYTHON" && exit 1
@@ -18,15 +18,15 @@ fi
which virtualenv > /dev/null 2>&1 || { echo "Please install virtualenv" && exit 1; }
${SYSTEM_PYTHON} -m hashin -h > /dev/null 2>&1 || { ${SYSTEM_PYTHON} -m pip install hashin; }
"${SYSTEM_PYTHON}" -m hashin -h > /dev/null 2>&1 || { "${SYSTEM_PYTHON}" -m pip install hashin; }
for suffix in '' '-hw' '-binaries' '-binaries-mac' '-build-wine' '-build-mac' '-build-base' '-build-appimage' '-build-android'; do
reqfile="requirements${suffix}.txt"
rm -rf "$venv_dir"
virtualenv -p ${SYSTEM_PYTHON} $venv_dir
virtualenv -p "${SYSTEM_PYTHON}" "$venv_dir"
source $venv_dir/bin/activate
source "$venv_dir/bin/activate"
echo "Installing dependencies... (${reqfile})"
@@ -42,7 +42,7 @@ for suffix in '' '-hw' '-binaries' '-binaries-mac' '-build-wine' '-build-mac' '-
requirements=$(pip freeze --all)
restricted=$(echo $requirements | ${SYSTEM_PYTHON} $contrib/deterministic-build/find_restricted_dependencies.py)
restricted=$(echo $requirements | ${SYSTEM_PYTHON} "$contrib/deterministic-build/find_restricted_dependencies.py")
if [ ! -z "$restricted" ]; then
python -m pip install $restricted
requirements=$(pip freeze --all)

View File

@@ -21,7 +21,7 @@ LIBSECP_VERSION="a660a4976efe880bae7982ee410b9e0dc59ac983"
set -e
. $(dirname "$0")/build_tools_util.sh || (echo "Could not source build_tools_util.sh" && exit 1)
. "$(dirname "$0")/build_tools_util.sh" || (echo "Could not source build_tools_util.sh" && exit 1)
here="$(dirname "$(realpath "$0" 2> /dev/null || grealpath "$0")")"
CONTRIB="$here"

View File

@@ -5,7 +5,7 @@ LIBUSB_VERSION="d52e355daa09f17ce64819122cb067b8a2ee0d4b"
set -e
. $(dirname "$0")/build_tools_util.sh || (echo "Could not source build_tools_util.sh" && exit 1)
. "$(dirname "$0")/build_tools_util.sh" || (echo "Could not source build_tools_util.sh" && exit 1)
here="$(dirname "$(realpath "$0" 2> /dev/null || grealpath "$0")")"
CONTRIB="$here"

View File

@@ -15,7 +15,7 @@ ZBAR_VERSION="bb05ec54eec57f8397cb13fb9161372a281a1219"
set -e
. $(dirname "$0")/build_tools_util.sh || (echo "Could not source build_tools_util.sh" && exit 1)
. "$(dirname "$0")/build_tools_util.sh" || (echo "Could not source build_tools_util.sh" && exit 1)
here="$(dirname "$(realpath "$0" 2> /dev/null || grealpath "$0")")"
CONTRIB="$here"

View File

@@ -55,8 +55,8 @@ break_legacy_easy_install
# This helps to avoid older versions of pip-installed dependencies interfering with the build.
VENV_DIR="$CONTRIB_OSX/build-venv"
rm -rf "$VENV_DIR"
python3 -m venv $VENV_DIR
source $VENV_DIR/bin/activate
python3 -m venv "$VENV_DIR"
source "$VENV_DIR/bin/activate"
# don't add debug info to compiled C files (e.g. when pip calls setuptools/wheel calls gcc)
# see https://github.com/pypa/pip/issues/6505#issuecomment-526613584

View File

@@ -311,7 +311,7 @@ else
test -f "$PROJECT_ROOT/dist/$apk3" || fail "apk3 not found among built files"
test -f "$PROJECT_ROOT/dist/$dmg" || fail "dmg not found among built files"
if [ $REV != $VERSION ]; then
if [ "$REV" != "$VERSION" ]; then
fail "versions differ, not uploading"
fi

View File

@@ -13,7 +13,7 @@
set -e
cd $(dirname $0)
cd "$(dirname "$0")"
if [ -e ./env/bin/activate ]; then # existing venv
source ./env/bin/activate
else # create new venv