Skip to content

Commit

Permalink
add hostname check
Browse files Browse the repository at this point in the history
  • Loading branch information
buanet committed Dec 1, 2023
1 parent efeda61 commit 57b438c
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions stage-iobroker/00-system-tweaks/files/firstboot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,23 @@
echo '>>> Starting firstboot.sh'

# resize root partion to possible maximum
echo 'Resizing root partition'
echo -n 'Resizing root partition... '
raspi-config nonint do_expand_rootfs
echo 'Done.'

# get current date from debian time server
echo 'Updating date and time'
echo -n 'Updating date and time... '
ntpdate 0.debian.pool.ntp.org
echo 'Done.'

# check/ correct hostname in iobroker
if [[ $(iob object get "system.adapter.admin.0" --pretty | grep -oP '(?<="host": ")[^"]*') =! $(hostname) ]]; then
echo -n 'Changing hostname in ioBroker... '
sudo -u iobroker iobroker stop
sudo -u iobroker iobroker host this
echo 'Done.'
fi

# Reboot
echo 'Rebooting'
echo 'Rebooting...'
reboot

0 comments on commit 57b438c

Please sign in to comment.