summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author Eric Hameleers <alien@slackware.com>2020-09-05 21:56:21 +0200
committer Eric Hameleers <alien@slackware.com>2020-09-05 21:56:21 +0200
commit8665fb1422c6f5ef1cd7e094a749f6281b94f168 (patch)
treef54e9b1a0c629bceb206c073c0e300bbb0358f7b
parent1268af2d50338331f7fc59fd27f3c6bd22e20f0a (diff)
downloadliveslak-8665fb1422c6f5ef1cd7e094a749f6281b94f168.tar.gz
liveslak-8665fb1422c6f5ef1cd7e094a749f6281b94f168.tar.xz
Allow a custom domain name for the live host
New boot parameter: "domain=your_custom_domain", The domain component defaults to 'example.net'.
Diffstat (limited to '')
-rw-r--r--README.txt3
-rw-r--r--liveinit.tpl18
2 files changed, 19 insertions, 2 deletions
diff --git a/README.txt b/README.txt
index a391cf6..8c9d944 100644
--- a/README.txt
+++ b/README.txt
@@ -345,6 +345,9 @@ cfg=[skip|write] =>
OS parameters; or specify 'write' to write current OS parameters
to disk.
+domain=your_custom_domain =>
+ Specify a custom domain name. Defaults to 'example.net'.
+
hostname=your_custom_hostname[,qualifier] =>
Specify a custom hostname. A qualifier 'fixed' can be appended
to prohibit hostname modification in case of network boot.
diff --git a/liveinit.tpl b/liveinit.tpl
index 2251553..231c297 100644
--- a/liveinit.tpl
+++ b/liveinit.tpl
@@ -143,9 +143,18 @@ for ARG in $(cat /proc/cmdline); do
dhcpwait=*)
DHCPWAIT=$(echo $ARG | cut -f2 -d=)
;;
+ domain=*)
+ # generic syntax: sub.domain.some
+ LIVE_DOMAIN=$(echo $ARG | cut -f2 -d=)
+ ;;
hostname=*)
# generic syntax: hostname=newname[,qualifier]
LIVE_HOSTNAME=$(echo $ARG | cut -f2 -d= | cut -f1 -d,)
+ # Allow for the user to (mistakenly) add a domain component:
+ if [ $(echo $LIVE_HOSTNAME |cut -d. -f1- --output-delimiter ' '|wc -w) -gt 1 ]; then
+ LIVE_DOMAIN=$(echo $LIVE_HOSTNAME |cut -d. -f2-)
+ LIVE_HOSTNAME=$(echo $LIVE_HOSTNAME |cut -d. -f1)
+ fi
if [ "$(echo $ARG | cut -f2 -d= | cut -f2 -d,)" = "fixed" ]; then
Keep hostname fixed i.e. never add a MAC address suffix:
HNMAC_ALLOWED="NO"
@@ -1133,15 +1142,20 @@ EOPW
fi
fi
+ if [ -z "$LIVE_DOMAIN" ]; then
+ # No custom domain on the boot commandline:
+ LIVE_DOMAIN="example.net"
+ fi
+
if [ ! -z "$LIVE_HOSTNAME" ]; then
# User entered a custom hostname on the boot commandline:
echo "${MARKER}: Changing hostname to '$LIVE_HOSTNAME'."
- echo "${LIVE_HOSTNAME}.example.net" > /mnt/overlay/etc/HOSTNAME
+ echo "${LIVE_HOSTNAME}.${LIVE_DOMAIN}" > /mnt/overlay/etc/HOSTNAME
if [ -f /mnt/overlay/etc/NetworkManager/NetworkManager.conf ]; then
sed -i -e "s/^hostname=.*/hostname=${LIVE_HOSTNAME}/" \
/mnt/overlay/etc/NetworkManager/NetworkManager.conf
fi
- sed -i -e "s/^\(127.0.0.1\t*\)@DARKSTAR@.*/\1${LIVE_HOSTNAME}.example.net ${LIVE_HOSTNAME}/" /mnt/overlay/etc/hosts
+ sed -i -e "s/^\(127.0.0.1\t*\)@DARKSTAR@.*/\1${LIVE_HOSTNAME}.${LIVE_DOMAIN} ${LIVE_HOSTNAME}/" /mnt/overlay/etc/hosts
fi
if [ -n "$NFSHOST" ]; then