mirror of
https://git.proxmox.com/git/systemd
synced 2026-01-27 07:17:46 +00:00
24 lines
597 B
Bash
Executable File
24 lines
597 B
Bash
Executable File
#!/bin/sh
|
|
set -e
|
|
|
|
ORIG_HOST=`cat /etc/hostname`
|
|
|
|
# should activate daemon and work
|
|
STATUS=`hostnamectl`
|
|
echo "$STATUS" | grep -q "Static hostname: $ORIG_HOST"
|
|
echo "$STATUS" | grep -q "Kernel:.* `uname -r`"
|
|
|
|
# change hostname
|
|
OUT=`hostnamectl set-hostname testhost 2>&1`
|
|
[ -z "$OUT" ]
|
|
[ "`cat /etc/hostname`" = "testhost" ]
|
|
STATUS=`hostnamectl`
|
|
echo "$STATUS" | grep -q "Static hostname: testhost"
|
|
|
|
# reset to original
|
|
OUT=`hostnamectl set-hostname $ORIG_HOST 2>&1`
|
|
[ -z "$OUT" ]
|
|
[ "`cat /etc/hostname`" = "$ORIG_HOST" ]
|
|
STATUS=`hostnamectl`
|
|
echo "$STATUS" | grep -q "Static hostname: $ORIG_HOST"
|