Skip to content

Commit

Permalink
test backport fix for hostname
Browse files Browse the repository at this point in the history
  • Loading branch information
t3chn0m4g3 committed Jun 29, 2017
1 parent 4c3b6e8 commit 9e880d1
Show file tree
Hide file tree
Showing 4 changed files with 5,872 additions and 7 deletions.
10 changes: 4 additions & 6 deletions installer/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fuECHO () {
}

fuRANDOMWORD () {
local myWORDFILE=/usr/share/dict/names
local myWORDFILE="$1"
local myLINES=$(cat $myWORDFILE | wc -l)
local myRANDOM=$((RANDOM % $myLINES))
local myNUM=$((myRANDOM * myRANDOM % $myLINES + 1))
Expand Down Expand Up @@ -295,11 +295,9 @@ adduser --system --no-create-home --uid 2000 --disabled-password --disabled-logi

# Let's set the hostname
fuECHO "### Setting a new hostname."
myHOST=$(curl -s -f www.nsanamegenerator.com | html2text | tr A-Z a-z | awk '{print $1}')
if [ "$myHOST" = "" ]; then
fuECHO "### Failed to fetch name from remote, using local cache."
myHOST=$(fuRANDOMWORD)
fi
a=$(fuRANDOMWORD /usr/share/dict/a.txt)
n=$(fuRANDOMWORD /usr/share/dict/n.txt)
myHOST=$a$n
hostnamectl set-hostname $myHOST
sed -i 's#127.0.1.1.*#127.0.1.1\t'"$myHOST"'#g' /etc/hosts

Expand Down
Loading

1 comment on commit 9e880d1

@t3chn0m4g3
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes #119

Please sign in to comment.