install_piratebox.sh: change also HOSTNAME in piratebox.conf on

This commit is contained in:
Matthias Strubel 2019-12-29 12:47:49 +01:00
parent 34baa3375c
commit ade7468a4c
1 changed files with 14 additions and 0 deletions

View File

@ -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