diff options
author | Andrew Cady <d@jerkface.net> | 2020-08-17 17:12:11 -0400 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2020-08-17 17:17:25 -0400 |
commit | afd8f44f4619f3db311881be98f9199996e57533 (patch) | |
tree | 9a74f5ba32e4ce83f7705951f72768be9d3099cd /rootfs/samizdat-hostname.sh | |
parent | 1c9ba85317f637fe913f2585680e128598d7fc9e (diff) |
bump openssh
update rootfs to use bumped openssh packages
Diffstat (limited to 'rootfs/samizdat-hostname.sh')
-rwxr-xr-x | rootfs/samizdat-hostname.sh | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/rootfs/samizdat-hostname.sh b/rootfs/samizdat-hostname.sh new file mode 100755 index 0000000..52837ba --- /dev/null +++ b/rootfs/samizdat-hostname.sh | |||
@@ -0,0 +1,26 @@ | |||
1 | #!/bin/sh | ||
2 | hostnames() | ||
3 | { | ||
4 | cat <<EOF | ||
5 | adam | ||
6 | billy | ||
7 | cletus | ||
8 | doris | ||
9 | elaine | ||
10 | frank | ||
11 | gilbert | ||
12 | hilda | ||
13 | EOF | ||
14 | } | ||
15 | |||
16 | next_hostname() | ||
17 | { | ||
18 | h=$(hostname) || exit | ||
19 | hostnames | sed -n "/^${h}\$/ {n;p;q}" || exit | ||
20 | } | ||
21 | |||
22 | set -x | ||
23 | hostname=$(next_hostname) | ||
24 | [ "$hostname" ] || hostname=$(hostnames | head -n1) | ||
25 | printf '%s\n' "$hostname" > /etc/hostname | ||
26 | sed -i -e 's/\blocalhost\b/& '"$hostname"'/' /etc/hosts | ||