diff --git a/contrib/android/make_apk.sh b/contrib/android/make_apk.sh
index 05c93729b..d20289568 100755
--- a/contrib/android/make_apk.sh
+++ b/contrib/android/make_apk.sh
@@ -15,7 +15,7 @@ LOCALE="$PROJECT_ROOT"/electrum/locale/
export ELEC_APK_GUI=$1
if [ ! -d "$PACKAGES" ]; then
- "$CONTRIB"/make_packages.sh || fail "make_packages failed"
+ "$CONTRIB"/make_packages.sh || fail "make_packages failed"
fi
pushd "$PROJECT_ROOT"
diff --git a/contrib/build-linux/appimage/make_appimage.sh b/contrib/build-linux/appimage/make_appimage.sh
index 0fcc5329d..e5fd22d5b 100755
--- a/contrib/build-linux/appimage/make_appimage.sh
+++ b/contrib/build-linux/appimage/make_appimage.sh
@@ -18,8 +18,7 @@ PYTHON_VERSION=3.9.11
PY_VER_MAJOR="3.9" # as it appears in fs paths
PKG2APPIMAGE_COMMIT="a9c85b7e61a3a883f4a35c41c5decb5af88b6b5d"
-
-VERSION=`git describe --tags --dirty --always`
+VERSION=$(git describe --tags --dirty --always)
APPIMAGE="$DISTDIR/electrum-$VERSION-x86_64.AppImage"
. "$CONTRIB"/build_tools_util.sh
@@ -52,11 +51,11 @@ tar xf "$CACHEDIR/Python-$PYTHON_VERSION.tar.xz" -C "$BUILDDIR"
# Patch taken from Ubuntu http://archive.ubuntu.com/ubuntu/pool/main/p/python3.9/python3.9_3.9.5-3~21.04.debian.tar.xz
patch -p1 < "$CONTRIB_APPIMAGE/patches/python-3.9-reproducible-buildinfo.diff"
./configure \
- --cache-file="$CACHEDIR/python.config.cache" \
- --prefix="$APPDIR/usr" \
- --enable-ipv6 \
- --enable-shared \
- -q
+ --cache-file="$CACHEDIR/python.config.cache" \
+ --prefix="$APPDIR/usr" \
+ --enable-ipv6 \
+ --enable-shared \
+ -q
make -j4 -s || fail "Could not build Python"
make -s install > /dev/null || fail "Could not install Python"
# When building in docker on macOS, python builds with .exe extension because the
@@ -73,10 +72,10 @@ cp -f "$PROJECT_ROOT/electrum/libsecp256k1.so.0" "$APPDIR/usr/lib/libsecp256k1.s
appdir_python() {
- env \
- PYTHONNOUSERSITE=1 \
- LD_LIBRARY_PATH="$APPDIR/usr/lib:$APPDIR/usr/lib/x86_64-linux-gnu${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH}" \
- "$APPDIR/usr/bin/python${PY_VER_MAJOR}" "$@"
+ env \
+ PYTHONNOUSERSITE=1 \
+ LD_LIBRARY_PATH="$APPDIR/usr/lib:$APPDIR/usr/lib/x86_64-linux-gnu${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH}" \
+ "$APPDIR/usr/bin/python${PY_VER_MAJOR}" "$@"
}
python='appdir_python'
@@ -173,17 +172,17 @@ info "stripping binaries from debug symbols."
# "-R .comment" also strips the GCC version information
strip_binaries()
{
- chmod u+w -R "$APPDIR"
- {
- printf '%s\0' "$APPDIR/usr/bin/python${PY_VER_MAJOR}"
- find "$APPDIR" -type f -regex '.*\.so\(\.[0-9.]+\)?$' -print0
- } | xargs -0 --no-run-if-empty --verbose strip -R .note.gnu.build-id -R .comment
+ chmod u+w -R "$APPDIR"
+ {
+ printf '%s\0' "$APPDIR/usr/bin/python${PY_VER_MAJOR}"
+ find "$APPDIR" -type f -regex '.*\.so\(\.[0-9.]+\)?$' -print0
+ } | xargs -0 --no-run-if-empty --verbose strip -R .note.gnu.build-id -R .comment
}
strip_binaries
remove_emptydirs()
{
- find "$APPDIR" -type d -empty -print0 | xargs -0 --no-run-if-empty rmdir -vp --ignore-fail-on-non-empty
+ find "$APPDIR" -type d -empty -print0 | xargs -0 --no-run-if-empty rmdir -vp --ignore-fail-on-non-empty
}
remove_emptydirs
@@ -200,8 +199,8 @@ rm -rf "$PYDIR"/site-packages/Cryptodome/SelfTest
rm -rf "$PYDIR"/site-packages/{psutil,qrcode,websocket}/tests
# rm lots of unused parts of Qt/PyQt. (assuming PyQt 5.15.3+ layout)
for component in connectivity declarative help location multimedia quickcontrols2 serialport webengine websockets xmlpatterns ; do
- rm -rf "$PYDIR"/site-packages/PyQt5/Qt5/translations/qt${component}_*
- rm -rf "$PYDIR"/site-packages/PyQt5/Qt5/resources/qt${component}_*
+ rm -rf "$PYDIR"/site-packages/PyQt5/Qt5/translations/qt${component}_*
+ rm -rf "$PYDIR"/site-packages/PyQt5/Qt5/resources/qt${component}_*
done
rm -rf "$PYDIR"/site-packages/PyQt5/Qt5/{qml,libexec}
rm -rf "$PYDIR"/site-packages/PyQt5/{pyrcc*.so,pylupdate*.so,uic}
diff --git a/contrib/build-linux/sdist/make_sdist.sh b/contrib/build-linux/sdist/make_sdist.sh
index cae834575..20d4f5d50 100755
--- a/contrib/build-linux/sdist/make_sdist.sh
+++ b/contrib/build-linux/sdist/make_sdist.sh
@@ -21,7 +21,7 @@ python3 -m pip install --upgrade pip
rm -rf "$PROJECT_ROOT/packages/"
if ([ "$OMIT_UNCLEAN_FILES" != 1 ]); then
- "$CONTRIB"/make_packages.sh || fail "make_packages failed"
+ "$CONTRIB"/make_packages.sh || fail "make_packages failed"
fi
git submodule update --init
@@ -48,9 +48,10 @@ fi
find -exec touch -h -d '2000-11-11T11:11:11+00:00' {} +
# note: .zip sdists would not be reproducible due to https://bugs.python.org/issue40963
- if ([ "$OMIT_UNCLEAN_FILES" = 1 ])
- then PY_DISTDIR="dist/_sourceonly" # The DISTDIR variable of this script is only used to find where the output is *finally* placed.
- else PY_DISTDIR="dist"
+ if ([ "$OMIT_UNCLEAN_FILES" = 1 ]); then
+ PY_DISTDIR="dist/_sourceonly" # The DISTDIR variable of this script is only used to find where the output is *finally* placed.
+ else
+ PY_DISTDIR="dist"
fi
TZ=UTC faketime -f '2000-11-11 11:11:11' python3 setup.py --quiet sdist --format=gztar --dist-dir="$PY_DISTDIR"
if ([ "$OMIT_UNCLEAN_FILES" = 1 ]); then
diff --git a/contrib/build-wine/build-electrum-git.sh b/contrib/build-wine/build-electrum-git.sh
index 6976c5a0e..d7ee10c91 100755
--- a/contrib/build-wine/build-electrum-git.sh
+++ b/contrib/build-wine/build-electrum-git.sh
@@ -12,7 +12,7 @@ set -e
pushd $WINEPREFIX/drive_c/electrum
-VERSION=`git describe --tags --dirty --always`
+VERSION=$(git describe --tags --dirty --always)
info "Last commit: $VERSION"
# Load electrum-locale for this release
diff --git a/contrib/build-wine/sign.sh b/contrib/build-wine/sign.sh
index 19ecbe90a..7e4d723c4 100755
--- a/contrib/build-wine/sign.sh
+++ b/contrib/build-wine/sign.sh
@@ -29,14 +29,14 @@ echo "Found $(ls *.exe | wc -w) files to sign."
for f in $(ls *.exe); do
echo "Signing $f..."
osslsigncode sign \
- -pass $WIN_SIGNING_PASSWORD\
- -h sha256 \
- -certs "$CERT_FILE" \
- -key "$KEY_FILE" \
- -n "Electrum" \
- -i "https://electrum.org/" \
- -t "http://timestamp.digicert.com/" \
- -in "$f" \
- -out "../signed/$f"
+ -pass "$WIN_SIGNING_PASSWORD" \
+ -h sha256 \
+ -certs "$CERT_FILE" \
+ -key "$KEY_FILE" \
+ -n "Electrum" \
+ -i "https://electrum.org/" \
+ -t "http://timestamp.digicert.com/" \
+ -in "$f" \
+ -out "../signed/$f"
ls ../signed/$f -lah
done
diff --git a/contrib/build-wine/unsign.sh b/contrib/build-wine/unsign.sh
index 311e1008e..3beb30642 100755
--- a/contrib/build-wine/unsign.sh
+++ b/contrib/build-wine/unsign.sh
@@ -14,7 +14,7 @@ set -e
mkdir -p signed >/dev/null 2>&1
mkdir -p signed/stripped >/dev/null 2>&1
-version=`python3 -c "import electrum; print(electrum.version.ELECTRUM_VERSION)"`
+version=$(python3 -c "import electrum; print(electrum.version.ELECTRUM_VERSION)")
echo "Found $(ls dist/*.exe | wc -w) files to verify."
diff --git a/contrib/build_tools_util.sh b/contrib/build_tools_util.sh
index 99dd30e73..6383dfa89 100755
--- a/contrib/build_tools_util.sh
+++ b/contrib/build_tools_util.sh
@@ -23,7 +23,7 @@ function warn {
function verify_signature() {
local file=$1 keyring=$2 out=
if out=$(gpg --no-default-keyring --keyring "$keyring" --status-fd 1 --verify "$file" 2>/dev/null) &&
- echo "$out" | grep -qs "^\[GNUPG:\] VALIDSIG "; then
+ echo "$out" | grep -qs "^\[GNUPG:\] VALIDSIG "; then
return 0
else
echo "$out" >&2
@@ -52,23 +52,23 @@ function download_if_not_exist() {
# https://github.com/travis-ci/travis-build/blob/master/lib/travis/build/templates/header.sh
function retry() {
- local result=0
- local count=1
- while [ $count -le 3 ]; do
- [ $result -ne 0 ] && {
- echo -e "\nThe command \"$@\" failed. Retrying, $count of 3.\n" >&2
+ local result=0
+ local count=1
+ while [ $count -le 3 ]; do
+ [ $result -ne 0 ] && {
+ echo -e "\nThe command \"$@\" failed. Retrying, $count of 3.\n" >&2
+ }
+ ! { "$@"; result=$?; }
+ [ $result -eq 0 ] && break
+ count=$(($count + 1))
+ sleep 1
+ done
+
+ [ $count -gt 3 ] && {
+ echo -e "\nThe command \"$@\" failed 3 times.\n" >&2
}
- ! { "$@"; result=$?; }
- [ $result -eq 0 ] && break
- count=$(($count + 1))
- sleep 1
- done
- [ $count -gt 3 ] && {
- echo -e "\nThe command \"$@\" failed 3 times.\n" >&2
- }
-
- return $result
+ return $result
}
function gcc_with_triplet()
diff --git a/contrib/deterministic-build/check_submodules.sh b/contrib/deterministic-build/check_submodules.sh
index c8df3a10b..7cf802f62 100755
--- a/contrib/deterministic-build/check_submodules.sh
+++ b/contrib/deterministic-build/check_submodules.sh
@@ -25,4 +25,4 @@ if [ $(date +%s -d "2 weeks ago") -gt $(get_git_mtime "contrib/deterministic-bui
fail=1
fi
-exit ${fail}
\ No newline at end of file
+exit ${fail}
diff --git a/contrib/freeze_containers_distro.sh b/contrib/freeze_containers_distro.sh
index 534f76231..0ef7adb30 100755
--- a/contrib/freeze_containers_distro.sh
+++ b/contrib/freeze_containers_distro.sh
@@ -5,23 +5,23 @@
set -e
DEBIAN_SNAPSHOT_BASE="https://snapshot.debian.org/archive/debian/"
-DEBIAN_APPIMAGE_DISTRO="buster" # should match build-linux/appimage Dockerfile base
-DEBIAN_WINE_DISTRO="bullseye" # should match build-wine Dockerfile base
+DEBIAN_APPIMAGE_DISTRO="buster" # should match build-linux/appimage Dockerfile base
+DEBIAN_WINE_DISTRO="bullseye" # should match build-wine Dockerfile base
DEBIAN_ANDROID_DISTRO="bullseye" # should match android Dockerfile base
contrib=$(dirname "$0")
if [ ! -x /bin/wget ]; then
- echo "no wget"
- exit 1
+ echo "no wget"
+ exit 1
fi
-DEBIAN_SNAPSHOT_LATEST=$(wget -O- ${DEBIAN_SNAPSHOT_BASE}$(date +"?year=%Y&month=%m") 2>/dev/null|grep "^/dev/null | grep "^ /dev/null 2>&1 || { echo "Please install virtualenv" && exit 1; }
diff --git a/contrib/make_packages.sh b/contrib/make_packages.sh
index 89b76249f..a7e970ef6 100755
--- a/contrib/make_packages.sh
+++ b/contrib/make_packages.sh
@@ -10,7 +10,7 @@ PACKAGES="$PROJECT_ROOT"/packages/
test -n "$CONTRIB" -a -d "$CONTRIB" || exit
if [ -d "$PACKAGES" ]; then
- rm -r "$PACKAGES"
+ rm -r "$PACKAGES"
fi
# create virtualenv
diff --git a/contrib/osx/compare_dmg b/contrib/osx/compare_dmg
index fbc263ab7..1609c44a2 100755
--- a/contrib/osx/compare_dmg
+++ b/contrib/osx/compare_dmg
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/usr/bin/env bash
set -e
if [ $(uname) != "Darwin" ]; then
diff --git a/contrib/osx/make_osx.sh b/contrib/osx/make_osx.sh
index 1712323e9..6c160a225 100755
--- a/contrib/osx/make_osx.sh
+++ b/contrib/osx/make_osx.sh
@@ -73,7 +73,7 @@ if [ ! -f "$CACHEDIR/$PKG_FILE" ]; then
curl -o "$CACHEDIR/$PKG_FILE" "https://www.python.org/ftp/python/${PYTHON_VERSION}/$PKG_FILE"
fi
echo "c2073d44c404c661dadbf0cbda55c6e7d681baba9178ed1bdb126d34caa898a9 $CACHEDIR/$PKG_FILE" | shasum -a 256 -c \
- || fail "python pkg checksum mismatched"
+ || fail "python pkg checksum mismatched"
sudo installer -pkg "$CACHEDIR/$PKG_FILE" -target / \
|| fail "failed to install python"
@@ -232,7 +232,7 @@ find "$VENV_DIR/lib/python$PY_VER_MAJOR/site-packages/" -type f -name '*.so' -pr
info "Faking timestamps..."
find . -exec touch -t '200101220000' {} + || true
-VERSION=`git describe --tags --dirty --always`
+VERSION=$(git describe --tags --dirty --always)
info "Building binary"
ELECTRUM_VERSION=$VERSION pyinstaller --noconfirm --ascii --clean contrib/osx/osx.spec || fail "Could not build binary"
diff --git a/contrib/osx/notarize_app.sh b/contrib/osx/notarize_app.sh
index 7a89456cc..27f4a6dfe 100755
--- a/contrib/osx/notarize_app.sh
+++ b/contrib/osx/notarize_app.sh
@@ -24,53 +24,57 @@ ditto -c -k --rsrc --keepParent "$APP_BUNDLE" "${APP_BUNDLE}.zip"
# Submit for notarization
echo "Submitting $APP_BUNDLE for notarization..."
RESULT=$(xcrun altool --notarize-app --type osx \
- --file "${APP_BUNDLE}.zip" \
- --primary-bundle-id org.electrum.electrum \
- --username $APPLE_ID_USER \
- --password @env:APPLE_ID_PASSWORD \
- --output-format xml)
+ --file "${APP_BUNDLE}.zip" \
+ --primary-bundle-id org.electrum.electrum \
+ --username $APPLE_ID_USER \
+ --password @env:APPLE_ID_PASSWORD \
+ --output-format xml
+)
if [ $? -ne 0 ]; then
- echo "Submitting $APP_BUNDLE failed:"
- echo "$RESULT"
- exit 1
+ echo "Submitting $APP_BUNDLE failed:"
+ echo "$RESULT"
+ exit 1
fi
REQUEST_UUID=$(echo "$RESULT" | xpath \
- "//key[normalize-space(text()) = 'RequestUUID']/following-sibling::string[1]/text()" 2> /dev/null)
+ "//key[normalize-space(text()) = 'RequestUUID']/following-sibling::string[1]/text()" 2>/dev/null
+)
if [ -z "$REQUEST_UUID" ]; then
- echo "Submitting $APP_BUNDLE failed:"
- echo "$RESULT"
- exit 1
+ echo "Submitting $APP_BUNDLE failed:"
+ echo "$RESULT"
+ exit 1
fi
echo "$(echo "$RESULT" | xpath \
- "//key[normalize-space(text()) = 'success-message']/following-sibling::string[1]/text()" 2> /dev/null)"
+ "//key[normalize-space(text()) = 'success-message']/following-sibling::string[1]/text()" 2> /dev/null)"
# Poll for notarization status
echo "Submitted notarization request $REQUEST_UUID, waiting for response..."
sleep 60
while :
do
- RESULT=$(xcrun altool --notarization-info "$REQUEST_UUID" \
- --username "$APPLE_ID_USER" \
- --password @env:APPLE_ID_PASSWORD \
- --output-format xml)
- STATUS=$(echo "$RESULT" | xpath \
- "//key[normalize-space(text()) = 'Status']/following-sibling::string[1]/text()" 2> /dev/null)
+ RESULT=$(xcrun altool --notarization-info "$REQUEST_UUID" \
+ --username "$APPLE_ID_USER" \
+ --password @env:APPLE_ID_PASSWORD \
+ --output-format xml
+ )
+ STATUS=$(echo "$RESULT" | xpath \
+ "//key[normalize-space(text()) = 'Status']/following-sibling::string[1]/text()" 2>/dev/null
+ )
- if [ "$STATUS" = "success" ]; then
- echo "Notarization of $APP_BUNDLE succeeded!"
- break
- elif [ "$STATUS" = "in progress" ]; then
- echo "Notarization in progress..."
- sleep 20
- else
- echo "Notarization of $APP_BUNDLE failed:"
- echo "$RESULT"
- exit 1
- fi
+ if [ "$STATUS" = "success" ]; then
+ echo "Notarization of $APP_BUNDLE succeeded!"
+ break
+ elif [ "$STATUS" = "in progress" ]; then
+ echo "Notarization in progress..."
+ sleep 20
+ else
+ echo "Notarization of $APP_BUNDLE failed:"
+ echo "$RESULT"
+ exit 1
+ fi
done
# Staple the notary ticket
diff --git a/contrib/osx/package.sh b/contrib/osx/package.sh
index c746efe5a..1d4236c1a 100755
--- a/contrib/osx/package.sh
+++ b/contrib/osx/package.sh
@@ -31,26 +31,26 @@ fi
mkdir -p ~/bin
if ! which ${genisoimage} > /dev/null 2>&1; then
- mkdir -p /tmp/electrum-macos
- cd /tmp/electrum-macos
- info "Downloading cdrkit $cdrkit_version"
- wget -nc ${cdrkit_download_path}/${cdrkit_file_name}
- tar xvf ${cdrkit_file_name}
-
- info "Patching genisoimage"
- cd cdrkit-${cdrkit_version}
- patch -p1 < $CONTRIB/osx/cdrkit-deterministic.patch
-
- info "Building genisoimage"
- cmake . -Wno-dev
- make genisoimage
- cp genisoimage/genisoimage ~/bin/${genisoimage}
+ mkdir -p /tmp/electrum-macos
+ cd /tmp/electrum-macos
+ info "Downloading cdrkit $cdrkit_version"
+ wget -nc ${cdrkit_download_path}/${cdrkit_file_name}
+ tar xvf ${cdrkit_file_name}
+
+ info "Patching genisoimage"
+ cd cdrkit-${cdrkit_version}
+ patch -p1 <$CONTRIB/osx/cdrkit-deterministic.patch
+
+ info "Building genisoimage"
+ cmake . -Wno-dev
+ make genisoimage
+ cp genisoimage/genisoimage ~/bin/${genisoimage}
fi
if ! which dmg > /dev/null 2>&1; then
mkdir -p /tmp/electrum-macos
- cd /tmp/electrum-macos
- info "Downloading libdmg"
+ cd /tmp/electrum-macos
+ info "Downloading libdmg"
LD_PRELOAD= git clone ${libdmg_url}
cd libdmg-hfsplus
info "Building libdmg"
@@ -60,11 +60,11 @@ if ! which dmg > /dev/null 2>&1; then
fi
${genisoimage} -version || fail "Unable to install genisoimage"
-dmg -|| fail "Unable to install libdmg"
+dmg - || fail "Unable to install libdmg"
plist=$1/Contents/Info.plist
test -f "$plist" || fail "Info.plist not found"
-VERSION=$(grep -1 ShortVersionString $plist |tail -1|gawk 'match($0, /(.*)<\/string>/, a) {print a[1]}')
+VERSION=$(grep -1 ShortVersionString $plist | tail -1 | gawk 'match($0, /(.*)<\/string>/, a) {print a[1]}')
echo $VERSION
rm -rf /tmp/electrum-macos/image > /dev/null 2>&1
diff --git a/contrib/release.sh b/contrib/release.sh
index 57cd0fc61..9fec67cd4 100755
--- a/contrib/release.sh
+++ b/contrib/release.sh
@@ -73,9 +73,9 @@ if [ ! -z "$RELEASEMANAGER" ] ; then
fi
-VERSION=`python3 -c "import electrum; print(electrum.version.ELECTRUM_VERSION)"`
+VERSION=$(python3 -c "import electrum; print(electrum.version.ELECTRUM_VERSION)")
info "VERSION: $VERSION"
-REV=`git describe --tags`
+REV=$(git describe --tags)
info "REV: $REV"
COMMIT=$(git rev-parse HEAD)
@@ -95,7 +95,7 @@ tarball="Electrum-$VERSION.tar.gz"
if test -f "dist/$tarball"; then
info "file exists: $tarball"
else
- ./contrib/build-linux/sdist/build.sh
+ ./contrib/build-linux/sdist/build.sh
fi
# create source-only tarball
@@ -103,7 +103,7 @@ srctarball="Electrum-sourceonly-$VERSION.tar.gz"
if test -f "dist/$srctarball"; then
info "file exists: $srctarball"
else
- OMIT_UNCLEAN_FILES=1 ./contrib/build-linux/sdist/build.sh
+ OMIT_UNCLEAN_FILES=1 ./contrib/build-linux/sdist/build.sh
fi
# appimage
@@ -184,7 +184,7 @@ sha256sum contrib/build-wine/dist/*.exe
echo -n "proceed (y/n)? "
read answer
-if [ "$answer" != "y" ] ;then
+if [ "$answer" != "y" ]; then
echo "exit"
exit 1
fi
@@ -250,7 +250,7 @@ else
info "updating www repo"
./contrib/make_download $WWW_DIR
info "signing the version announcement file"
- sig=`./run_electrum -o signmessage $ELECTRUM_SIGNING_ADDRESS $VERSION -w $ELECTRUM_SIGNING_WALLET`
+ sig=$(./run_electrum -o signmessage $ELECTRUM_SIGNING_ADDRESS $VERSION -w $ELECTRUM_SIGNING_WALLET)
echo "{ \"version\":\"$VERSION\", \"signatures\":{ \"$ELECTRUM_SIGNING_ADDRESS\":\"$sig\"}}" > $WWW_DIR/version
diff --git a/contrib/upload.sh b/contrib/upload.sh
index 5833fe16a..4d8d41e17 100755
--- a/contrib/upload.sh
+++ b/contrib/upload.sh
@@ -15,7 +15,7 @@ fi
cd "$PROJECT_ROOT"
-version=`git describe --tags --abbrev=0`
+version=$(git describe --tags --abbrev=0)
echo $version
if [ -z "$ELECBUILD_UPLOADFROM" ]; then