2018-07-17 13:12:03 +02:00
|
|
|
#!/bin/sh
|
|
|
|
_temp="./download/dialog.$$"
|
|
|
|
|
2018-07-29 01:33:54 +02:00
|
|
|
# load network
|
|
|
|
network=`cat .network`
|
|
|
|
|
2018-07-17 13:12:03 +02:00
|
|
|
# welcome and ask for name of RaspiBlitz
|
|
|
|
result=""
|
|
|
|
while [ ${#result} -eq 0 ]
|
|
|
|
do
|
|
|
|
l1="Please enter the name of your new RaspiBlitz:\n"
|
|
|
|
l2="one word, keep characters basic & not too long"
|
2018-07-25 17:40:50 +02:00
|
|
|
dialog --backtitle "RaspiBlitz - Setup" --inputbox "$l1$l2" 11 52 2>$_temp
|
2018-07-17 13:12:03 +02:00
|
|
|
result=`cat $_temp`
|
|
|
|
shred $_temp
|
|
|
|
done
|
|
|
|
|
|
|
|
# set lightning alias
|
2018-07-31 20:13:08 +02:00
|
|
|
sed -i "7s/.*/alias=${result}/" /home/admin/assets/lnd.${network}.conf
|
2018-07-17 13:12:03 +02:00
|
|
|
|
|
|
|
# store hostname for later - to be set right before the next reboot
|
|
|
|
# work around - because without a reboot the hostname seems not updates in the whole system
|
2018-07-31 20:13:08 +02:00
|
|
|
echo $result > /home/admin/.hostname
|
2018-07-17 13:12:03 +02:00
|
|
|
|
|
|
|
# show password info dialog
|
2018-07-25 17:40:50 +02:00
|
|
|
dialog --backtitle "RaspiBlitz - Setup" --msgbox "RaspiBlitz uses 4 different passwords.
|
2018-07-17 13:12:03 +02:00
|
|
|
Referenced as password A, B, C and D.
|
|
|
|
|
|
|
|
A) Master User Password
|
2018-07-29 01:33:54 +02:00
|
|
|
B) Blockchain RPC Password
|
2018-07-17 13:12:03 +02:00
|
|
|
C) LND Wallet Password
|
|
|
|
D) LND Seed Password
|
|
|
|
|
|
|
|
Choose now 4 new passwords - all min 8 chars
|
|
|
|
Write them down & store them in a safe place.
|
|
|
|
" 14 52
|
|
|
|
|
|
|
|
# ask user for new password A
|
2018-07-25 17:40:50 +02:00
|
|
|
dialog --backtitle "RaspiBlitz - Setup"\
|
2018-07-17 13:12:03 +02:00
|
|
|
--inputbox "Please enter your Master/Admin Password A:\n!!! This is new password to login per SSH !!!" 10 52 2>$_temp
|
|
|
|
|
|
|
|
# get user input
|
|
|
|
result=`cat $_temp`
|
|
|
|
shred $_temp
|
|
|
|
|
|
|
|
# check input (check for more later)
|
|
|
|
if [ ${#result} -eq 0 ]; then
|
|
|
|
clear
|
|
|
|
echo "FAIL - Password cannot be empty"
|
|
|
|
echo "Please restart with ./00mainMenu.sh"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# change user passwords and then change hostname
|
|
|
|
echo "pi:$result" | sudo chpasswd
|
|
|
|
echo "root:$result" | sudo chpasswd
|
|
|
|
echo "bitcoin:$result" | sudo chpasswd
|
|
|
|
echo "admin:$result" | sudo chpasswd
|
|
|
|
sleep 1
|
|
|
|
|
|
|
|
# sucess info dialog
|
|
|
|
dialog --backtitle "RaspiBlitz" --msgbox "OK - password changed to '$result'\nfor all users pi, admin, root & bitcoin" 6 52
|
|
|
|
|
|
|
|
# repeat until user input is nit length 0
|
|
|
|
result=""
|
|
|
|
while [ ${#result} -lt 8 ]
|
|
|
|
do
|
2018-07-25 17:40:50 +02:00
|
|
|
dialog --backtitle "RaspiBlitz - Setup"\
|
2018-07-17 13:12:03 +02:00
|
|
|
--inputbox "Enter your RPC Password B (min 8 chars):" 9 52 2>$_temp
|
|
|
|
result=`cat $_temp`
|
|
|
|
shred $_temp
|
|
|
|
done
|
|
|
|
|
2018-07-29 01:33:54 +02:00
|
|
|
# set Blockchain RPC Password (for admin cli & template for user bitcoin)
|
2018-07-29 15:54:24 +02:00
|
|
|
sed -i "14s/.*/rpcpassword=$result/" /home/admin/assets/${network}.conf
|
2018-07-29 01:33:54 +02:00
|
|
|
|
2018-07-17 13:12:03 +02:00
|
|
|
|
|
|
|
# success info dialog
|
|
|
|
dialog --backtitle "RaspiBlitz - SetUP" --msgbox "OK - RPC password changed to '$result'\n\nNow starting the Setup of your RaspiBlitz." 7 52
|
2018-07-29 01:33:54 +02:00
|
|
|
clear
|