summaryrefslogtreecommitdiff
path: root/rootfs/samizdat-hostname.sh
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2020-08-17 17:12:11 -0400
committerAndrew Cady <d@jerkface.net>2020-08-17 17:17:25 -0400
commitafd8f44f4619f3db311881be98f9199996e57533 (patch)
tree9a74f5ba32e4ce83f7705951f72768be9d3099cd /rootfs/samizdat-hostname.sh
parent1c9ba85317f637fe913f2585680e128598d7fc9e (diff)
bump openssh
update rootfs to use bumped openssh packages
Diffstat (limited to 'rootfs/samizdat-hostname.sh')
-rwxr-xr-xrootfs/samizdat-hostname.sh26
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
2hostnames()
3{
4cat <<EOF
5adam
6billy
7cletus
8doris
9elaine
10frank
11gilbert
12hilda
13EOF
14}
15
16next_hostname()
17{
18 h=$(hostname) || exit
19 hostnames | sed -n "/^${h}\$/ {n;p;q}" || exit
20}
21
22set -x
23hostname=$(next_hostname)
24[ "$hostname" ] || hostname=$(hostnames | head -n1)
25printf '%s\n' "$hostname" > /etc/hostname
26sed -i -e 's/\blocalhost\b/& '"$hostname"'/' /etc/hosts