From 49c9a6f0ee3a034e5eb5eabe526a0803bb1205be Mon Sep 17 00:00:00 2001 From: Denis 'GNUtoo' Carikli Date: Tue, 3 Oct 2023 14:41:31 +0200 Subject: [PATCH] first-boot.sh: resize filesystem and add better status reporting. Signed-off-by: Denis 'GNUtoo' Carikli --- first-boot.sh.tmpl | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/first-boot.sh.tmpl b/first-boot.sh.tmpl index 32d4f9e..986c8ac 100644 --- a/first-boot.sh.tmpl +++ b/first-boot.sh.tmpl @@ -11,6 +11,23 @@ # along with this file. If not, see . set -e -certbot certonly --standalone -d DOMAIN -m LETSENCRYPT_EMAIL -herd restart mumble-server -herd restart nginx \ No newline at end of file +report() +{ + ret=$? + message="$@" + + if [ ${ret} -eq 0 ] ; then + echo "[ OK ] ${message}" + else + echo "[ !! ] ${message} failed" + exit ${ret} + fi +} + +echo ';;L;*' | sfdisk -f /dev/vda ; report "Resizing /dev/vda1 partition" ; \ +partprobe +resize2fs /dev/vda1 ; report "Growing /dev/vda1 filesystem" + +certbot certonly --standalone -d DOMAIN -m LETSENCRYPT_EMAIL ; report "Obtaining Lets's Encrypt certificate" +herd restart mumble-server ; report "Restarting Mumble server" +herd restart nginx ; report "Restarting Nginx server"