Skip to content

Instantly share code, notes, and snippets.

@drizzt
Created October 28, 2023 17:39
Show Gist options
  • Save drizzt/e2b01190ed171f2908a0fbfc0065141b to your computer and use it in GitHub Desktop.
Save drizzt/e2b01190ed171f2908a0fbfc0065141b to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -euo pipefail
# Get last release from RELEASE-NOTES
LAST_RELEASE=$(curl -s https://raw.githubusercontent.com/spesmilo/electrum/master/RELEASE-NOTES | sed -n '1s/^# Release \(\S*\) .*$/\1/p')
if ! [[ -x electrum-"$LAST_RELEASE"-full-rbf-x86_64.AppImage ]]; then
TMPDIR=$(mktemp -d)
trap 'rm -rf "$TMPDIR"' EXIT
pushd "$TMPDIR"
# Download and import gpg keys
curl -s https://raw.githubusercontent.com/spesmilo/electrum/master/pubkeys/ThomasV.asc https://raw.githubusercontent.com/spesmilo/electrum/master/pubkeys/sombernight_releasekey.asc https://raw.githubusercontent.com/spesmilo/electrum/master/pubkeys/Emzy.asc | gpg --import -
# Download last electrum AppImage and gpg signature
curl -fOL "https://download.electrum.org/$LAST_RELEASE/electrum-$LAST_RELEASE-x86_64.AppImage"
curl -fOL "https://download.electrum.org/$LAST_RELEASE/electrum-$LAST_RELEASE-x86_64.AppImage.asc"
# Verify last electrum AppImage with gpg keys
gpg --verify electrum-"$LAST_RELEASE"-x86_64.AppImage.asc
# Download appimagetool
curl -fOL "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage"
chmod +x "appimagetool-x86_64.AppImage" electrum-"$LAST_RELEASE"-x86_64.AppImage
# Extract electrum appimage
./electrum-"$LAST_RELEASE"-x86_64.AppImage --appimage-extract
# Apply "patch" for Full RBF
sed -i 's/^\(\s*\)"""Whether RBF is disabled."""/&\n\1return False/' squashfs-root/usr/lib/python3.*/site-packages/electrum/transaction.py
# Repack AppImage to local directory
./appimagetool-x86_64.AppImage squashfs-root "$OLDPWD/electrum-$LAST_RELEASE-full-rbf-x86_64.AppImage"
popd
rm -rf "$TMPDIR"
fi
# Run it
exec ./electrum-"$LAST_RELEASE"-full-rbf-x86_64.AppImage "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment