From 89f12546c5a9e0f17f7ac10b4e11e8daf51779ca Mon Sep 17 00:00:00 2001 From: Michael Prokop <mprokop@sipwise.com> Date: Fri, 10 Jun 2011 17:31:49 +0000 Subject: [PATCH] Log output of ngcp-installer to separate logfile so we can use it in debug mode and capture its output. And while at it adjust way we're calling ngcp-installer so we can catch its pipe status. Also make sure logfiles are cleaned before we store them for later usage (ha!). From: Michael Prokop <mprokop@sipwise.com> --- deployment.sh | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/deployment.sh b/deployment.sh index 3dd0ac7..e249936 100755 --- a/deployment.sh +++ b/deployment.sh @@ -612,8 +612,8 @@ EOT PKG=ngcp-installer-2.2-rc1.deb wget http://deb.sipwise.com/spce/\$PKG dpkg -i \$PKG -yes | ngcp-installer -RC=\$? +echo yes | ngcp-installer 2>&1 | tee -a /tmp/ngcp-installer-debug.log +RC=\${PIPESTATUS[1]} if [ \$RC -ne 0 ] ; then echo "Fatal error while running ngcp-installer:" >&2 tail -10 /tmp/ngcp-installer.log @@ -622,14 +622,6 @@ fi EOT fi - # make a backup of the installer logfiles for later investigation - if [ -r "${TARGET}"/tmp/ngcp-installer.log ] ; then - cp "${TARGET}"/tmp/ngcp-installer.log "${TARGET}"/var/log/ - fi - if [ -r /tmp/grml-debootstrap.log ] ; then - cp /tmp/grml-debootstrap.log "${TARGET}"/var/log/ - fi - # baby, something went wrong! if [ $? -ne 0 ] ; then echo "Error during installation of ngcp." >&2 @@ -679,6 +671,19 @@ EOT :>$TARGET/var/run/utmp :>$TARGET/var/run/wtmp + # make a backup of the installer logfiles for later investigation + if [ -r "${TARGET}"/tmp/ngcp-installer.log ] ; then + cp "${TARGET}"/tmp/ngcp-installer.log "${TARGET}"/var/log/ + fi + if [ -r "${TARGET}"/tmp/ngcp-installer-debug.log ] ; then + cp "${TARGET}"/tmp/ngcp-installer-debug.log "${TARGET}"/var/log/ + fi + if [ -r /tmp/ngcp-installer-debug.log ] ; then + cp /tmp/ngcp-installer-debug.log "${TARGET}"/var/log/ngcp-installer-debug_host.log + fi + if [ -r /tmp/grml-debootstrap.log ] ; then + cp /tmp/grml-debootstrap.log "${TARGET}"/var/log/ + fi fi # leave system in according state