File tree 1 file changed +7
-7
lines changed
1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -34,14 +34,13 @@ hostname () {
34
34
35
35
[[ $DEBUG ]] && echo " inside hostname()" >&2
36
36
37
+ OSTYP=$( awk -F= ' /^ID=/ {print $2}' /etc/os-release | sed ' s/"//g' )
38
+
37
39
# Use standard function if Proxmox machine (Detect if running on Proxmox hypervisor by looking for /etc/pve)
38
40
39
- if [ -d /etc/pve ]; then
41
+ if [[ -d /etc/pve ] ]; then
40
42
/usr/bin/hostname " $@ "
41
- elif [[ -f /etc/os-release ]] && [[ $( awk -F= ' /^ID=/ {print $2}' /etc/os-release | sed ' s/"//g' ) == openwrt ]]; then
42
-
43
- # OpenWrt implementation uses uci to get to host and domain values.
44
-
43
+ elif [[ $OSTYP == openwrt ]]; then
45
44
local _host=$( $SUDO uci get system.@system[0].hostname)
46
45
local _wan=$( ip route | grep default | awk ' {print $9}' )
47
46
@@ -58,14 +57,15 @@ hostname () {
58
57
fi
59
58
fi
60
59
fi
60
+ elif [[ $OSTYP == alpine ]]; then
61
+ /bin/hostname " $@ "
61
62
else
62
- # SystemD implementation using systemd-resolved.
63
63
if [[ -z $1 ]]; then
64
64
uname -n
65
65
elif [[ $1 == " -f" ]]; then
66
66
get_fqdn
67
67
else
68
- /usr/bin/hostname " $@ " # Pass other arguments to the system hostname command
68
+ /usr/bin/hostname " $@ "
69
69
fi
70
70
fi
71
71
}
You can’t perform that action at this time.
0 commit comments