joininbox/scripts/menu.sh

189 lines
4.3 KiB
Bash
Raw Permalink Normal View History

2020-01-22 22:24:21 +00:00
#!/bin/bash
/home/joinmarket/start.joininbox.sh
source /home/joinmarket/_functions.sh
sourceConf /home/joinmarket/joinin.conf
2020-01-22 22:24:21 +00:00
# BASIC MENU INFO
HEIGHT=21
WIDTH=57
CHOICE_HEIGHT=13
BACKTITLE="JoininBox GUI $currentJBtag network:$network IP:$localip"
TITLE="JoininBox $currentJBtag $network"
MENU="
Choose from the options:"
fix(ci): make image builds noninteractive (#196) * fix(ci): make image builds noninteractive Both image builds fail in packer: - arm64-rpi: dpkg halts on the interactive initramfs.conf conffile prompt (Y/I/N/O/D/Z) during 'apt-get upgrade' kernel configuration, then cascades: E: Sub-process /usr/bin/dpkg returned an error code (1) - amd64: debconf falls back through Dialog/Readline/Teletype frontends (no controlling tty) and the build later fails on 'E: Package netcat has no installation candidate' - the netcat metapackage was removed in Debian trixie Fixes: - export DEBIAN_FRONTEND=noninteractive and install an apt.conf.d dropin with Dpkg::Options --force-confdef/--force-confold so conffile prompts resolve to the default action and keep the existing config (build_joininbox.sh and the amd64 update.sh kernel upgrade) - install netcat-openbsd when the netcat metapackage is unavailable * feat(ci): skip code signature verification on PR builds, label images PR CI builds pull head commits from forks which are not signed by the maintainer keys, so the mandatory PGP verification in build_joininbox.sh fails every PR image build: # BUILD FAILED --> PGP verification not OK / signature(0) verify(0) Behavior after this change: - pull_request workflow runs pass the PR number through the packer build chain (workflow -> build script -> packer var -> provisioner env -> JOININBOX_PR_NUMBER) - build_joininbox.sh skips the source signature verification when JOININBOX_PR_NUMBER is set, prints a prominent warning, and labels the image in /etc/joininbox-build-info as an UNVERIFIED test build - the uploaded artifact name carries a -pr<N> suffix via BUILD_VERSION - push-to-master and workflow_dispatch builds never set the variable, so production images keep mandatory verification * fix(ci): drop apt policy after build, warn on PR images in main menu - Remove /etc/apt/apt.conf.d/90joininbox-noninteractive at the end of build_joininbox.sh: the noninteractive dpkg conffile policy is a build-time measure and must not ship in deployed images, where interactive conffile handling is the default again - Show '!!! UNVERIFIED PR BUILD #<N> - TESTING ONLY !!!' on top of the main menu whenever /etc/joininbox-build-info is present, so a flashed PR image cannot be mistaken for a production build --------- Co-authored-by: autoblitzbot <autoblitzbot@users.noreply.github.com>
2026-08-15 07:31:05 +02:00
# warn prominently on top of the menu if this is an unverified
# pull-request test image (labeled by build_joininbox.sh)
if [ -f /etc/joininbox-build-info ]; then
pr_build=$(grep -E "^pr_build=" /etc/joininbox-build-info | cut -d= -f2)
MENU="
!!! UNVERIFIED PR BUILD #${pr_build} - TESTING ONLY !!!
Choose from the options:"
HEIGHT=$((HEIGHT + 1))
fi
2020-01-22 22:24:21 +00:00
OPTIONS=()
# Basic Options
OPTIONS+=(START "Quickstart with JoinMarket")
if [ "${runningEnv}" = raspiblitz ] && [ $(lsb_release -sc) = bullseye ]; then
OPTIONS+=(JAM "JoinMarket Web UI options")
HEIGHT=$((HEIGHT + 1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT + 1))
elif [ "${qtgui}" = "true" ]; then
OPTIONS+=(QTGUI "Show how to open the JoinMarketQT GUI")
HEIGHT=$((HEIGHT + 1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT + 1))
fi
OPTIONS+=("" ""
WALLET "Wallet management options"
MAKER "Yield Generator options"
2020-01-22 22:24:21 +00:00
"" ""
SEND "Pay to an address with/without a coinjoin"
FREEZE "Exercise coin control within a mixdepth"
PAYJOIN "Send/Receive between JoinMarket wallets"
2020-01-22 22:24:21 +00:00
"" ""
OFFERS "Watch the Order Book locally"
"" ""
CONFIG "Connection and joinmarket.cfg settings"
TOOLS "Extra helper functions and services")
if [ "${runningEnv}" != mynode ]; then
OPTIONS+=(UPDATE "Update JoininBox or JoinMarket")
OPTIONS+=("" "")
if [ "${runningEnv}" = raspiblitz ]; then
OPTIONS+=(BLITZ "Switch to the RaspiBlitz menu")
HEIGHT=$((HEIGHT + 1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT + 1))
2021-05-07 16:16:31 +01:00
fi
OPTIONS+=(REBOOT "Restart the computer")
OPTIONS+=(SHUTDOWN "Switch off the computer")
HEIGHT=$((HEIGHT + 4))
CHOICE_HEIGHT=$((CHOICE_HEIGHT + 4))
fi
2020-01-22 22:24:21 +00:00
2021-05-07 16:16:31 +01:00
CHOICE=$(dialog \
--clear \
--backtitle "$BACKTITLE" \
--title "$TITLE" \
--ok-label "Select" \
--cancel-label "Exit" \
--menu "$MENU" \
$HEIGHT $WIDTH $CHOICE_HEIGHT \
"${OPTIONS[@]}" \
2>&1 >/dev/tty)
2020-01-22 22:24:21 +00:00
case $CHOICE in
START)
/home/joinmarket/menu.quickstart.sh
waitKeyOnExit1 $?
/home/joinmarket/menu.sh
;;
WALLET)
/home/joinmarket/menu.wallet.sh
waitKeyOnExit1 $?
/home/joinmarket/menu.sh
;;
QTGUI)
/home/joinmarket/info.qtgui.sh
/home/joinmarket/menu.sh
;;
JAM)
/home/joinmarket/menu.jam.sh
/home/joinmarket/menu.sh
;;
MAKER)
/home/joinmarket/menu.yg.sh
waitKeyOnExit1 $?
/home/joinmarket/menu.sh
;;
SEND)
/home/joinmarket/menu.send.sh
echo ""
echo "Press ENTER to return to the menu..."
read key
/home/joinmarket/menu.sh
;;
FREEZE)
/home/joinmarket/menu.freeze.sh
echo ""
echo "Press ENTER to return to the menu..."
read key
/home/joinmarket/menu.sh
;;
PAYJOIN)
/home/joinmarket/menu.payjoin.sh
waitKeyOnExit1 $?
/home/joinmarket/menu.sh
;;
OFFERS)
/home/joinmarket/menu.orderbook.sh
/home/joinmarket/menu.sh
;;
CONFIG)
/home/joinmarket/menu.config.sh
echo "Returning to the menu..."
sleep 1
/home/joinmarket/menu.sh
;;
TOOLS)
/home/joinmarket/menu.tools.sh
/home/joinmarket/menu.sh
;;
UPDATE)
/home/joinmarket/menu.update.sh
/home/joinmarket/menu.sh
;;
REBOOT)
clear
confirmation "Are you sure?" "Reboot" "Cancel" true 7 40
confirmationReboot=$?
if [ $confirmationReboot -eq 0 ]; then
clear
stopYG
echo
if [ "${runningEnv}" = raspiblitz ]; then
sudo /home/admin/config.scripts/blitz.shutdown.sh reboot
exit 0
else
echo "# Reboot"
sudo shutdown now -r
fi
fi
/home/joinmarket/menu.sh
;;
SHUTDOWN)
clear
confirmation "Are you sure?" "Shutdown" "Cancel" true 7 40
confirmationShutdown=$?
if [ $confirmationShutdown -eq 0 ]; then
clear
stopYG
echo
if [ "${runningEnv}" = raspiblitz ]; then
sudo /home/admin/config.scripts/blitz.shutdown.sh
exit 0
else
echo "# Shutdown"
sudo shutdown now
fi
fi
/home/joinmarket/menu.sh
;;
BLITZ)
sudo su - admin
;;
*)
clear
echo "
2020-06-21 01:03:29 +01:00
***************************
* JoinMarket command line *
2020-06-21 01:03:29 +01:00
***************************
2020-06-19 12:40:50 +01:00
Notes on usage:
https://github.com/openoms/bitcoin-tutorials/blob/master/joinmarket/README.md
To open the JoininBox menu use: menu
To exit from the terminal type: exit
2020-06-19 12:40:50 +01:00
"
;;
esac