Skip to content
This repository was archived by the owner on Jan 16, 2024. It is now read-only.

Commit 656472c

Browse files
committed
M #-: Set hostname over hostnamectl only if it's working
1 parent 94f752c commit 656472c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/etc/one-context.d/net-15-hostname

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fi
1010
function set_hostname() {
1111
local hostname=$1
1212

13-
if [ -d /run/systemd/system/ ]; then
13+
if [ -d /run/systemd/system/ ] && hostnamectl status >/dev/null 2>/dev/null; then
1414
hostnamectl set-hostname --static "${hostname}"
1515
else
1616
if [ -f /etc/sysconfig/network ]; then

0 commit comments

Comments
 (0)