raspiblitz/home.admin/setup.scripts/dialogName.sh

31 lines
873 B
Bash
Raw Normal View History

2021-05-03 14:00:01 +02:00
#!/bin/bash
# get basic system information
# these are the same set of infos the WebGUI dialog/controler has
source /home/admin/raspiblitz.info
# SETUPFILE
# this key/value file contains the state during the setup process
2021-05-03 15:24:54 +02:00
SETUPFILE="/var/cache/raspiblitz/temp/raspiblitz.setup"
2021-05-03 14:32:36 +02:00
source $SETUPFILE
2021-05-03 14:00:01 +02:00
###################
# ENTER NAME
###################
# temp file for password results
2021-05-03 15:24:54 +02:00
_temp="/var/cache/raspiblitz/temp/.temp.tmp"
2021-05-03 14:00:01 +02:00
# 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"
dialog --backtitle "RaspiBlitz - Setup (${network}/${chain})" --inputbox "$l1$l2" 11 52 2>$_temp
result=$( cat $_temp | tr -dc '[:alnum:]-.' | tr -d ' ' )
sudo rm $_temp
done
# store name in setup state
echo "hostname=${result}" >> $SETUPFILE