pull/5/head
xSmurf 9 years ago
parent ee2073d315
commit 8c114fe9a5

@ -20,14 +20,15 @@ do_start() {
# Make sure that our selected hostname doesn't appear anywhere in /etc, # Make sure that our selected hostname doesn't appear anywhere in /etc,
# this way it should be safe to sed the whole directory # this way it should be safe to sed the whole directory
# we aren't doing this, but it could be useful in the future. # we aren't doing this, but it could be useful in the future.
NOTFOUND=0 # NOTFOUND=0
until [ "${NOTFOUND}" -gt "0" ]; do # until [ "${NOTFOUND}" -gt "0" ]; do
#WORD=$(/usr/bin/shuf -n1 "$FILE") # #WORD=$(/usr/bin/shuf -n1 "$FILE")
WORD=$(/usr/bin/openssl rand -hex 8) # WORD=$(/usr/bin/openssl rand -hex 8)
#
/bin/fgrep -r $WORD /etc/ 2>&1 >> /dev/null # /bin/fgrep -r $WORD /etc/ 2>&1 >> /dev/null
NOTFOUND=$? # NOTFOUND=$?
done # done
WORD=$(/usr/bin/openssl rand -hex 8)
echo "Setting hostname to '$HOSTNAME'" echo "Setting hostname to '$HOSTNAME'"
@ -38,7 +39,7 @@ do_start() {
echo "$WORD" > /etc/hostname echo "$WORD" > /etc/hostname
echo "$OLDHOST" > /etc/hostname.old echo "$OLDHOST" > /etc/hostname.old
sed -i "s/${OLDHOST}/${WORD}/g" /etc/hosts #/bin/sed -i "s/${OLDHOST}/${WORD}/g" /etc/hosts
exit $ES exit $ES
} }

Loading…
Cancel
Save