File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -114,7 +114,7 @@ update_qubesconfig() {
114
114
if ! grep -q localhost /etc/hosts; then
115
115
116
116
cat << EOF > /etc/hosts
117
- 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 $( hostname)
117
+ 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 $( hostnamectl hostname)
118
118
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
119
119
EOF
120
120
@@ -126,10 +126,10 @@ EOF
126
126
if ! is_protected_file /etc/hostname ; then
127
127
for ip in ' 127\.0\.0\.1' ' ::1' ; do
128
128
if grep -q " ^${ip} \(\s\|$\)" /etc/hosts; then
129
- sed -i " /^${ip} \s/,+0s/\(\s$( hostname) \)\+\(\s\|$\)/\2/g" /etc/hosts
130
- sed -i " s/^${ip} \(\s\|$\).*$/\0 $( hostname) /" /etc/hosts
129
+ sed -i " /^${ip} \s/,+0s/\(\s$( hostnamectl hostname) \)\+\(\s\|$\)/\2/g" /etc/hosts
130
+ sed -i " s/^${ip} \(\s\|$\).*$/\0 $( hostnamectl hostname) /" /etc/hosts
131
131
else
132
- echo " ${ip} $( hostname) " >> /etc/hosts
132
+ echo " ${ip} $( hostnamectl hostname) " >> /etc/hosts
133
133
fi
134
134
done
135
135
fi
Original file line number Diff line number Diff line change @@ -19,7 +19,12 @@ unset rc
19
19
if ! is_protected_file /etc/hostname ; then
20
20
name=$( qubesdb-read /name)
21
21
if [ -n " $name " ]; then
22
- hostname " $name "
22
+ if [ -f /usr/bin/hostname ]; then
23
+ hostname " $name "
24
+ else
25
+ echo " $name " > /etc/hostname
26
+ echo " $name " > /proc/sys/kernel/hostname
27
+ fi
23
28
if [ -e /etc/debian_version ]; then
24
29
ipv4_localhost_re=" 127\.0\.1\.1"
25
30
else
You can’t perform that action at this time.
0 commit comments