- Ignore SC1091: Not following: /etc/grml/script-functions was not specified as input (see shellcheck -x).
- SC1117: Backslash is literal in "\n". Prefer explicit escaping: "\\n".
- SC1117: Backslash is literal in "\n". Prefer explicit escaping: "\\n".
- SC2086: Double quote to prevent globbing and word splitting.
- Ignore SC1117: Backslash is literal in "\(". Prefer explicit escaping: "\\(".
- Ignore SC1117: Backslash is literal in "\s". Prefer explicit escaping: "\\s".
- Ignore SC1117: Backslash is literal in "\)". Prefer explicit escaping: "\\)".
- Ignore SC1117: Backslash is literal in "\1". Prefer explicit escaping: "\\1".
- Ignore SC1117: Backslash is literal in "\(". Prefer explicit escaping: "\\(".
- Ignore SC1117: Backslash is literal in "\s". Prefer explicit escaping: "\\s".
- Ignore SC1117: Backslash is literal in "\)". Prefer explicit escaping: "\\)".
- Ignore SC1117: Backslash is literal in "\1". Prefer explicit escaping: "\\1".
- SC2046: Quote this to prevent word splitting.
# License: This file is licensed under the GPL v2.
################################################################################
# License: This file is licensed under the GPL v2.
################################################################################
+# shellcheck disable=SC1091
. /etc/grml/script-functions
check4root || exit 1
. /etc/grml/script-functions
check4root || exit 1
if [ -z "$NONINTERACTIVE" ] ; then
NEW_HOSTNAME="$(dialog --stdout --title "${PN}" --extra-button --extra-label "Propose hostname" \
--inputbox "Set hostname (/etc/hostname, /etc/hosts and /etc/postfix/main.cf will be adjusted)\
if [ -z "$NONINTERACTIVE" ] ; then
NEW_HOSTNAME="$(dialog --stdout --title "${PN}" --extra-button --extra-label "Propose hostname" \
--inputbox "Set hostname (/etc/hostname, /etc/hosts and /etc/postfix/main.cf will be adjusted)\
-\n\nTip: press 'Propose hostname' for another proposal" 14 70 $NEW_HOSTNAME)"
+\\n\\nTip: press 'Propose hostname' for another proposal" 14 70 "$NEW_HOSTNAME")"
0)
echo "$NEW_HOSTNAME" > /etc/hostname
echo "$NEW_HOSTNAME" > /etc/mailname
0)
echo "$NEW_HOSTNAME" > /etc/hostname
echo "$NEW_HOSTNAME" > /etc/mailname
+ # shellcheck disable=SC1117
sed -ir "s/^\(127.0.0.1\s*\).*localhost.*/\1$NEW_HOSTNAME localhost/" /etc/hosts
sed -ir "s/^\(127.0.0.1\s*\).*localhost.*/\1$NEW_HOSTNAME localhost/" /etc/hosts
+ # shellcheck disable=SC1117
sed -ir "s/^\(::1\s*\).*ip6-localhost.*/\1ip6-localhost ip6-loopback $NEW_HOSTNAME/" /etc/hosts
POSTFIX=''
sed -ir "s/^\(::1\s*\).*ip6-localhost.*/\1ip6-localhost ip6-loopback $NEW_HOSTNAME/" /etc/hosts
POSTFIX=''
fi
if [ -n "$DISPLAY" ] ; then
fi
if [ -n "$DISPLAY" ] ; then
- if sudo -u $RUNASUSER xauth add $(xauth -n list | grep "${OLDHOSTNAME}/unix:0" | sed "s|${OLDHOSTNAME}/unix:0|${NEW_HOSTNAME}/unix:0|") ; then
+ if sudo -u $RUNASUSER xauth add "$(xauth -n list | grep "${OLDHOSTNAME}/unix:0" | sed "s|${OLDHOSTNAME}/unix:0|${NEW_HOSTNAME}/unix:0|")" ; then
sudo -u $RUNASUSER xauth remove "${OLDHOSTNAME}/unix:0"
fi
fi
sudo -u $RUNASUSER xauth remove "${OLDHOSTNAME}/unix:0"
fi
fi