aboutsummaryrefslogtreecommitdiffstats
path: root/tools/create-openbsd-vmm-worker.sh
diff options
context:
space:
mode:
authorGreg Steuck <blackgnezdo@gmail.com>2018-12-02 01:53:06 -0800
committerDmitry Vyukov <dvyukov@google.com>2018-12-02 09:53:06 +0000
commite0d8c853f6c076c991406ce107a8242529eb3b3a (patch)
tree8f541883d2d5a54e46371e08f3b04fa3615c1d4f /tools/create-openbsd-vmm-worker.sh
parent5a58167323289751602879a986a1b9f95531a31b (diff)
tools: set openbsd hostname to instance name for serviceability
* openbsd images: set hostname to instance name for serviceability * openbsd startup scripts insist on EOL characters
Diffstat (limited to 'tools/create-openbsd-vmm-worker.sh')
-rwxr-xr-xtools/create-openbsd-vmm-worker.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/create-openbsd-vmm-worker.sh b/tools/create-openbsd-vmm-worker.sh
index 1baa3c687..c5619183b 100755
--- a/tools/create-openbsd-vmm-worker.sh
+++ b/tools/create-openbsd-vmm-worker.sh
@@ -49,6 +49,17 @@ cat >etc/installurl <<EOF
https://${MIRROR}/pub/OpenBSD
EOF
+cat >etc/rc.local <<EOF
+(
+ /usr/local/bin/curl -H "Metadata-Flavor: Google" \
+ "http://metadata.google.internal/computeMetadata/v1/instance/hostname" \
+ > /etc/myname.gce \
+ && echo >> /etc/myname.gce \
+ && mv /etc/myname{.gce,} \
+ && hostname \$(cat /etc/myname)
+)
+EOF
+
chmod +x install.site
cat >etc/rc.conf.local <<EOF