Prefer /etc/hostname output over hostname(1)

We don't want to have the hostname of the deployment system
(being 'grml') when initially setting up db_schema. So let's see
whether using /etc/hostname can solve it...

From: Michael Prokop <mprokop@sipwise.com>
0.1
Michael Prokop 13 years ago
parent 9e47e08d9d
commit 9588b03594

@ -1,6 +1,17 @@
#!/bin/bash
hostname="$(hostname)"
# do not rely on hostname(1), might return hostname of the
# deployment system when initially deploying via chroot
if [ -r /etc/hostname ] ; then
hostname="$(cat /etc/hostname)"
else
hostname=$(hostname)
fi
if [ -z "${hostname}" ] ; then
echo "Error: hostname could not be identified." >&2
exit 1
fi
/etc/init.d/mysql start || true
. /etc/mysql/sipwise.cnf

Loading…
Cancel
Save