first-boot.sh: resize filesystem and add better status reporting.

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
This commit is contained in:
Denis 'GNUtoo' Carikli 2023-10-03 14:41:31 +02:00
parent bd5799967f
commit 49c9a6f0ee
Signed by: GNUtoo
GPG Key ID: 5F5DFCC14177E263
1 changed files with 20 additions and 3 deletions

View File

@ -11,6 +11,23 @@
# along with this file. If not, see <http://www.gnu.org/licenses/>.
set -e
certbot certonly --standalone -d DOMAIN -m LETSENCRYPT_EMAIL
herd restart mumble-server
herd restart nginx
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"