raspiblitz/home.admin/20recoverDialog.sh

127 lines
4.3 KiB
Bash
Raw Normal View History

2018-12-05 00:07:58 +01:00
#!/bin/bash
2018-07-17 13:12:03 +02:00
2018-12-06 14:36:02 +01:00
## get basic info
2019-02-02 23:49:04 +01:00
source /home/admin/raspiblitz.info
2018-12-12 18:21:01 +01:00
source /mnt/hdd/raspiblitz.conf
2018-07-29 01:33:54 +02:00
2019-01-14 18:34:21 +01:00
# show password info dialog
resetAlsoPasswordB=$(sudo cat /mnt/hdd/bitcoin/bitcoin.conf 2>/dev/null | grep -c "rpcpassword=passwordB")
resetAlsoPasswordC=$(sudo ls /mnt/hdd/passwordc.flag 2>/dev/null | grep -c ".flag")
2018-07-17 13:12:03 +02:00
if [ ${resetAlsoPasswordC} -gt 0 ]; then
2018-07-17 13:12:03 +02:00
# password A + B + C
dialog --backtitle "RaspiBlitz - Migration Setup" --msgbox "Your migration to RaspiBlitz is almost done.
You need to set a new Password A, B & C:
A) Main User Password (SSH, WebUI, ..)
B) RPC & APP Password (Additional Apps, ..)
C) Lightning Wallet Unlock Password
2018-12-12 18:21:01 +01:00
Follow Password Rules: Minimal of 8 chars,
2018-11-27 21:11:53 +01:00
no spaces and only special characters - or .
2018-07-17 13:12:03 +02:00
Write them down & store them in a safe place.
" 17 52
2018-07-17 13:12:03 +02:00
2021-04-05 13:14:56 +02:00
# call set password a script
sudo /home/admin/config.scripts/blitz.setpassword.sh a
dialog --backtitle "RaspiBlitz" --msgbox "OK - password A was set\nfor all users pi, admin, root & bitcoin" 6 52
sudo /home/admin/config.scripts/blitz.setpassword.sh b
dialog --backtitle "RaspiBlitz" --msgbox "OK - password B was set\nit will be used by additional apps you install." 6 52
oldPasswordC=$(sudo cat /mnt/hdd/passwordc.flag)
sudo /home/admin/config.scripts/blitz.setpassword.sh c $oldPasswordC
if [ "$?" != "0" ]; then
dialog --backtitle "RaspiBlitz - Setup" --msgbox "Please write down your Password C:\n${oldPasswordC}" 10 52
else
2021-04-24 01:03:53 +02:00
dialog --backtitle "RaspiBlitz" --msgbox "OK - password C was set\nuse it to unlock your Lightning Wallet after restarts." 8 52
fi
elif [ ${resetAlsoPasswordB} -gt 0 ]; then
2021-04-05 13:14:56 +02:00
# password A + B
dialog --backtitle "RaspiBlitz - Migration Setup" --msgbox "Your migration to RaspiBlitz is almost done.
2021-04-05 13:14:56 +02:00
You need to set a new Password A & B:
A) Main User Password (SSH, WebUI, ..)
B) RPC & APP Password (Additional Apps, ..)
Passwords C (for your Lightning wallet) stays to the password you set before.
Follow Password Rules: Minimal of 8 chars,
no spaces and only special characters - or .
Write them down & store them in a safe place.
" 17 52
# call set password a script
sudo /home/admin/config.scripts/blitz.setpassword.sh a
dialog --backtitle "RaspiBlitz" --msgbox "OK - password A was set\nfor all users pi, admin, root & bitcoin" 6 52
2021-04-05 13:14:56 +02:00
sudo /home/admin/config.scripts/blitz.setpassword.sh b
dialog --backtitle "RaspiBlitz" --msgbox "OK - password B was set\nit will be used by additional apps you install." 6 52
2021-04-05 13:14:56 +02:00
else
# just password A
dialog --backtitle "RaspiBlitz - Recover Setup" --msgbox "Your previous RaspiBlitz config was recovered.
You need to set a new Password A:
A) Master User Password
Passwords B & C stay as before.
Follow Password Rules: Minimal of 8 chars,
no spaces and only special characters - or .
Write them down & store them in a safe place.
" 14 52
# call set password a script
sudo /home/admin/config.scripts/blitz.setpassword.sh a
2018-07-17 13:12:03 +02:00
2019-01-14 18:34:21 +01:00
# sucess info dialog
dialog --backtitle "RaspiBlitz" --msgbox "OK - password A was set\nfor all users pi, admin, root & bitcoin" 6 52
2018-11-28 12:42:52 +01:00
fi
2019-01-14 18:34:21 +01:00
# activate lnd & bitcoin service
echo "Enabling Services"
sudo systemctl daemon-reload
sudo systemctl enable lnd.service
sudo systemctl enable ${network}d.service
if [ "${rtlWebinterface}" = "on" ]; then
sudo systemctl enable RTL
fi
2019-12-18 12:26:49 +00:00
if [ "${loop}" = "on" ]; then
sudo systemctl enable loopd
fi
if [ "${BTCRPCexplorer}" = "on" ]; then
sudo systemctl enable btc-rpc-explorer
fi
if [ "${ElectRS}" = "on" ]; then
sudo systemctl enable electrs
fi
2018-11-28 14:13:17 +01:00
2019-01-14 18:34:21 +01:00
# remove flag that freshly recovered
sudo rm /home/admin/recover.flag
2018-11-28 14:17:21 +01:00
2019-01-14 18:34:21 +01:00
# when auto-unlock is activated then Password C is needed to be restored on SD card
if [ "${autoUnlock}" = "on" ]; then
2018-12-12 18:21:01 +01:00
2019-01-14 18:34:21 +01:00
# reset auto-unlock feature
dialog --backtitle "RaspiBlitz - Setup" --msgbox "You had the Auto-Unlock feature enabled.
2018-12-24 02:51:11 +01:00
In the next dialog you need to re-enter your
ACTUAL/OLD Password C to re-activate the
Auto-Unlock feature. Enter a empty password
to deactivate the Auto-Unlock feature.
" 10 52
2019-04-17 03:23:46 +01:00
echo "Activating Auto-Unlock (please wait) .."
2019-01-14 18:34:21 +01:00
sudo /home/admin/config.scripts/lnd.autounlock.sh on
2020-07-23 12:51:27 +02:00
dialog --backtitle "RaspiBlitz" --pause " FINAL REBOOT IS NEEDED." 8 52 5
2018-07-29 01:33:54 +02:00
2019-01-14 18:34:21 +01:00
else
2021-04-05 13:14:56 +02:00
dialog --backtitle "RaspiBlitz" --pause " OK - Passwords set.\n FINAL REBOOT IS NEEDED." 9 52 5
2019-01-14 18:34:21 +01:00
fi
2018-11-28 14:13:17 +01:00
2019-12-11 14:03:52 +01:00
sudo /home/admin/XXshutdown.sh reboot