mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-03-27 02:01:53 +01:00
Add commands confirmation message (#3444)
This commit is contained in:
parent
1f99ac5d0a
commit
455ff74aee
@ -182,7 +182,7 @@ patch()
|
||||
whiptail --title "ERROR" --msgbox "${error}" 8 30
|
||||
fi
|
||||
fi
|
||||
patch
|
||||
patch all
|
||||
exit 0
|
||||
;;
|
||||
BRANCH)
|
||||
@ -199,7 +199,7 @@ patch()
|
||||
whiptail --title "ERROR" --msgbox "${error}" 8 30
|
||||
fi
|
||||
fi
|
||||
patch
|
||||
patch all
|
||||
exit 0
|
||||
;;
|
||||
PR)
|
||||
@ -453,7 +453,7 @@ Do you really want to update Bitcoin Core now?
|
||||
|
||||
# quick call by parameter
|
||||
if [ "$1" == "github" ]; then
|
||||
patch
|
||||
patch all
|
||||
exit 0
|
||||
fi
|
||||
|
||||
@ -537,7 +537,7 @@ case $CHOICE in
|
||||
;;
|
||||
PATCH)
|
||||
patchNotice
|
||||
patch
|
||||
patch all
|
||||
;;
|
||||
LND)
|
||||
lnd
|
||||
|
@ -5,6 +5,19 @@ if [ -f /home/admin/_aliases ];then
|
||||
source /home/admin/_aliases
|
||||
fi
|
||||
|
||||
# confirm interrupting commands
|
||||
confirm=0
|
||||
function confirmMsg() {
|
||||
while true; do
|
||||
read -p "$(echo -e "Execute the blitz command '$1'? (y/n): ")" yn
|
||||
case $yn in
|
||||
[Yy]* ) confirm=1;break;;
|
||||
[Nn]* ) confirm=0;break;;
|
||||
* ) echo "Please answer yes or no.";;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
# SHORTCUT COMMANDS you can call as user 'admin' from terminal
|
||||
|
||||
# command: blitz
|
||||
@ -35,7 +48,7 @@ function blitzhelp() {
|
||||
echo " status informational Blitz status screen"
|
||||
echo " sourcemode copy blockchain source modus"
|
||||
echo " check check if Blitz configuration files are correct"
|
||||
echo " patch sync all scripts with latest from github and branch"
|
||||
echo " patch [all] sync all scripts with latest from github and branch"
|
||||
echo " patch code sync only blitz scripts with latest from github and branch"
|
||||
echo " patch api sync only Blitz-API with latest from github and branch"
|
||||
echo " patch web sync only Blitz-WebUI with latest from github and branch"
|
||||
@ -97,7 +110,11 @@ function repair() {
|
||||
|
||||
# command: restart
|
||||
function restart() {
|
||||
/home/admin/config.scripts/blitz.shutdown.sh reboot
|
||||
echo "Command to restart your RaspiBlitz"
|
||||
confirmMsg restart
|
||||
if [ $confirm -eq 1 ]; then
|
||||
/home/admin/config.scripts/blitz.shutdown.sh reboot
|
||||
fi
|
||||
}
|
||||
|
||||
# command: sourcemode
|
||||
@ -112,7 +129,18 @@ function check() {
|
||||
|
||||
# command: release
|
||||
function release() {
|
||||
/home/admin/config.scripts/blitz.preparerelease.sh
|
||||
echo "Command to prepare your RaspiBlitz installation for sd card image:"
|
||||
echo "- delete logs"
|
||||
echo "- clean raspiblitz.info"
|
||||
echo "- delete SSH Pub keys"
|
||||
echo "- delete local DNS confs"
|
||||
echo "- delete old API conf"
|
||||
echo "- delete local WIFI conf"
|
||||
echo "- shutdown"
|
||||
confirmMsg release
|
||||
if [ $confirm -eq 1 ]; then
|
||||
/home/admin/config.scripts/blitz.preparerelease.sh
|
||||
fi
|
||||
}
|
||||
|
||||
# command: debug
|
||||
@ -136,23 +164,31 @@ function debug() {
|
||||
# command: patch
|
||||
# syncs script with latest set github and branch
|
||||
function patch() {
|
||||
if [ "$1" == "" ]; then
|
||||
echo "Command to patch your RaspiBlitz from github"
|
||||
confirmMsg patch
|
||||
if [ $confirm -eq 1 ]; then
|
||||
patch all
|
||||
fi
|
||||
fi
|
||||
|
||||
cd /home/admin
|
||||
|
||||
if [ "$1" == "" ] || [ "$1" == "code" ]; then
|
||||
if [ "$1" == "all" ] || [ "$1" == "code" ]; then
|
||||
echo
|
||||
echo "#######################################################"
|
||||
echo "### UPDATE BLITZ --> SCRIPTS (code)"
|
||||
/home/admin/config.scripts/blitz.github.sh -run
|
||||
fi
|
||||
|
||||
if [ "$1" == "" ] || [ "$1" == "api" ]; then
|
||||
if [ "$1" == "all" ] || [ "$1" == "api" ]; then
|
||||
echo
|
||||
echo "#######################################################"
|
||||
echo "### UPDATE BLITZ --> API"
|
||||
sudo /home/admin/config.scripts/blitz.web.api.sh update-code
|
||||
fi
|
||||
|
||||
if [ "$1" == "" ] || [ "$1" == "web" ]; then
|
||||
if [ "$1" == "all" ] || [ "$1" == "web" ]; then
|
||||
echo
|
||||
echo "#######################################################"
|
||||
echo "### UPDATE BLITZ --> WEBUI"
|
||||
@ -164,7 +200,11 @@ function patch() {
|
||||
|
||||
# command: off
|
||||
function off() {
|
||||
/home/admin/config.scripts/blitz.shutdown.sh
|
||||
echo "Command to power off your RaspiBlitz"
|
||||
confirmMsg off
|
||||
if [ $confirm -eq 1 ]; then
|
||||
/home/admin/config.scripts/blitz.shutdown.sh
|
||||
fi
|
||||
}
|
||||
|
||||
# command: github
|
||||
@ -176,23 +216,35 @@ function github() {
|
||||
|
||||
# command: hdmi
|
||||
function hdmi() {
|
||||
echo "# SWITCHING VIDEO OUTPUT TO --> HDMI"
|
||||
sudo /home/admin/config.scripts/blitz.display.sh set-display hdmi
|
||||
restart
|
||||
echo "Command to switch video output of your RaspiBlitz to hdmi"
|
||||
confirmMsg hdmi
|
||||
if [ $confirm -eq 1 ]; then
|
||||
echo "# SWITCHING VIDEO OUTPUT TO --> HDMI"
|
||||
sudo /home/admin/config.scripts/blitz.display.sh set-display hdmi
|
||||
restart
|
||||
fi
|
||||
}
|
||||
|
||||
# command: lcd
|
||||
function lcd() {
|
||||
echo "# SWITCHING VIDEO OUTPUT TO --> LCD"
|
||||
sudo /home/admin/config.scripts/blitz.display.sh set-display lcd
|
||||
restart
|
||||
echo "Command to switch video output of your RaspiBlitz to lcd"
|
||||
confirmMsg lcd
|
||||
if [ $confirm -eq 1 ]; then
|
||||
echo "# SWITCHING VIDEO OUTPUT TO --> LCD"
|
||||
sudo /home/admin/config.scripts/blitz.display.sh set-display lcd
|
||||
restart
|
||||
fi
|
||||
}
|
||||
|
||||
# command: headless
|
||||
function headless() {
|
||||
echo "# SWITCHING VIDEO OUTPUT TO --> HEADLESS"
|
||||
sudo /home/admin/config.scripts/blitz.display.sh set-display headless
|
||||
restart
|
||||
echo "Command to switch off any video output of your RaspiBlitz (ssh only)"
|
||||
confirmMsg headless
|
||||
if [ $confirm -eq 1 ]; then
|
||||
echo "# SWITCHING VIDEO OUTPUT TO --> HEADLESS"
|
||||
sudo /home/admin/config.scripts/blitz.display.sh set-display headless
|
||||
restart
|
||||
fi
|
||||
}
|
||||
|
||||
# command: cache
|
||||
|
Loading…
x
Reference in New Issue
Block a user