hostanme: Fix the generation script
The original script was referring to test file locations in my homedir.
Change-Id: I72e4736cd418bf16de7d91655f11c788986870cd
diff --git a/etc/runonce.d/01-generate-hostname b/etc/runonce.d/01-generate-hostname
index e0a6516..796de26 100755
--- a/etc/runonce.d/01-generate-hostname
+++ b/etc/runonce.d/01-generate-hostname
@@ -1,5 +1,8 @@
#!/bin/bash
+ADJECTIVES_FILE=/usr/share/aiy-board-tweaks/adjectives.txt
+NOUNS_FILE=/usr/share/aiy-board-tweaks/nouns.txt
+
random_word()
{
local wordlist=$1; shift
@@ -11,12 +14,14 @@
generate_hostname()
{
- local adj=$(random_word /tmp/adjectives.txt)
- local noun=$(random_word /tmp/nouns.txt)
+ local adj=$(random_word $ADJECTIVES_FILE)
+ local noun=$(random_word $NOUNS_FILE)
echo "${adj}-${noun}"
}
hostname=$(generate_hostname)
echo $hostname >/etc/hostname
+/bin/hostname $hostname
/usr/bin/hostnamectl set-hostname $hostname
+echo 127.0.0.1 $hostname >>/etc/hosts