From 9588b03594e3fdf709ae27ca4f3ce83eb75c8e0b Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Wed, 21 Mar 2012 15:38:37 +0000 Subject: [PATCH] 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 --- ngcp-update-db-schema | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ngcp-update-db-schema b/ngcp-update-db-schema index 804256a2..676b5e00 100755 --- a/ngcp-update-db-schema +++ b/ngcp-update-db-schema @@ -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