diff --git a/home.admin/_bootstrap.provision.sh b/home.admin/_bootstrap.provision.sh index 946530f5..8b9cfefe 100644 --- a/home.admin/_bootstrap.provision.sh +++ b/home.admin/_bootstrap.provision.sh @@ -101,14 +101,6 @@ echo "" >> ${logFile} sudo sed -i "s/^message=.*/message='Setup System ..'/g" ${infoFile} /home/admin/90finishSetup.sh >> ${logFile} 2>&1 -# set the local network hostname -if [ ${#hostname} -gt 0 ]; then - echo "Setting new network hostname '$hostname'" >> ${logFile} - sudo raspi-config nonint do_hostname ${hostname} >> ${logFile} 2>&1 -else - echo "No hostname set." >> ${logFile} -fi - ########################## # PROVISIONING SERVICES ########################## @@ -225,6 +217,20 @@ echo "" >> ${logFile} sudo sed -i "s/^message=.*/message='Setup Done'/g" ${infoFile} +# set the local network hostname +# have at the end - see https://github.com/rootzoll/raspiblitz/issues/462 +if [ ${#hostname} -gt 0 ]; then + hostnameSanatized=$(echo "${hostname}"| tr -dc '[:alnum:]\n\r') + if [ ${#hostnameSanatized} -gt 0 ]; then + echo "Setting new network hostname '$hostnameSanatized'" >> ${logFile} + sudo raspi-config nonint do_hostname ${hostnameSanatized} >> ${logFile} 2>&1 + else + echo "WARNING: hostname in raspiblitz.conf contains just special chars" >> ${logFile} + fi +else + echo "No hostname set." >> ${logFile} +fi + echo "DONE - Give raspi some cool off time after hard building .... 20 secs sleep" >> ${logFile} sleep 20 diff --git a/home.admin/config.scripts/internet.sshtunnel.py b/home.admin/config.scripts/internet.sshtunnel.py index 2a94995f..c684bc93 100755 --- a/home.admin/config.scripts/internet.sshtunnel.py +++ b/home.admin/config.scripts/internet.sshtunnel.py @@ -55,7 +55,7 @@ if sys.argv[1] == "restore": if sys.argv[1] == "on": # check if already running - isRunning = subprocess.getoutput("sudo systemctl --no-pager | grep '%s' -c" % (SERVICENAME)) + isRunning = subprocess.getoutput("sudo systemctl --no-pager | grep -c '%s'" % (SERVICENAME)) if int(isRunning) > 1: print("SSH TUNNEL ALREADY ACTIVATED - run 'internet.sshtunnel.py off' first to set new tunnel") sys.exit(1) diff --git a/home.admin/config.scripts/lnd.setname.sh b/home.admin/config.scripts/lnd.setname.sh index eab11dd4..2400983d 100644 --- a/home.admin/config.scripts/lnd.setname.sh +++ b/home.admin/config.scripts/lnd.setname.sh @@ -17,7 +17,7 @@ if [ ${#newName} -eq 0 ]; then dialog --backtitle "Set LND Name/Alias" --inputbox "ENTER the new Name/Alias for LND node: (free to choose, one word, use basic characters) " 8 52 2>./.tmp - newName=$( cat ./.tmp ) + newName=$( cat ./.tmp | tr -dc '[:alnum:]\n\r' ) if [ ${#newName} -eq 0 ]; then echo "FAIL input cannot be empty" exit 1