From ade7468a4c5d8f8d525a0b27c03160c814a261a2 Mon Sep 17 00:00:00 2001 From: Matthias Strubel Date: Sun, 29 Dec 2019 12:47:49 +0100 Subject: [PATCH] install_piratebox.sh: change also HOSTNAME in piratebox.conf on --- piratebox/piratebox/bin/install_piratebox.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/piratebox/piratebox/bin/install_piratebox.sh b/piratebox/piratebox/bin/install_piratebox.sh index bad6c4f..db5eea1 100755 --- a/piratebox/piratebox/bin/install_piratebox.sh +++ b/piratebox/piratebox/bin/install_piratebox.sh @@ -175,9 +175,23 @@ fi set_hostname() { name=$1 ; shift; + if test -z "$name" ; then + echo "ERROR: Empty hostname not allowed ! '$name'" + exit 128 + fi + + # Set Bash EXIT on error + set -e + sed -e "s|#####HOST#####|$name|g" \ "$PIRATEBOX_FOLDER"/src/redirect.html.schema > \ "$WWW_FOLDER"/index.html + + # Also change configuration, because other parts of PirateBox are making use of it + OLD_HOST=$HOST + HOST=$name + sed -i -e "s|^HOST=\"${OLD_HOST}\"|HOST=\"${HOST}\"|" "$PIRATEBOX_CONFIG" + set +e } if [ "$1" = "hostname" ] ; then