From 67ba1a18c326e24223bbc6a9e18377950e5e0028 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Wed, 20 Dec 2017 12:58:27 +0100 Subject: [PATCH] Log to stdout and stderr, no longer to /var/log/postplug.log --- postplug.d/12loadconf | 10 +++++----- postplug.d/30xorg | 4 ++-- postplug/postplug | 9 ++------- postplug/postplug-defs | 2 +- 4 files changed, 10 insertions(+), 15 deletions(-) diff --git a/postplug.d/12loadconf b/postplug.d/12loadconf index 03a35e4..2049e98 100644 --- a/postplug.d/12loadconf +++ b/postplug.d/12loadconf @@ -1,7 +1,7 @@ #!/bin/bash # # loadconf - postplug plugin: restore the QiLinux Live system/user configuration -# Copyright (c) 2004-2007 by Davide Madrisan +# Copyright (c) 2004-2017 by Davide Madrisan if [ $UID != 0 ]; then echo "$0: must be superuser." >&2 @@ -28,7 +28,7 @@ while read dev mountpoint skip; do /mnt/cdrom*|swap) ;; *) mount | grep "$dev" &>/dev/null let "res = $?" # 0: mounted; 1: not mounted - [ "$res" = 1 ] && mount $mountpoint 2>>$logfile + [ "$res" = 1 ] && mount $mountpoint >&2 if [ -e $mountpoint/$qiconf ]; then # temporary disable bootsplash [ -w /proc/splash ] && echo "verbose" > /proc/splash @@ -42,11 +42,11 @@ $dialog_backtitle -- "$"Restore QiLinux configuration" \ ""\Z4$dev\Zn ?" 8 56 if [ $? -eq 0 ]; then - /usr/sbin/livecd-restore $mountpoint >>$logfile 2>&1 - [ "$res" = 1 ] && umount $mountpoint 2>>$logfile + /usr/sbin/livecd-restore $mountpoint + [ "$res" = 1 ] && umount $mountpoint >&2 break fi fi - [ "$res" = 1 ] && umount $mountpoint 2>>$logfile ;; + [ "$res" = 1 ] && umount $mountpoint >&2 ;; esac done diff --git a/postplug.d/30xorg b/postplug.d/30xorg index 732c123..0badbfb 100644 --- a/postplug.d/30xorg +++ b/postplug.d/30xorg @@ -1,6 +1,6 @@ #!/bin/bash # xorg - xorg plugin for postplug -# Copyright (c) 2004-2015 by Silvan Calarco +# Copyright (c) 2004-2017 by Silvan Calarco # Copyright (c) 2004-2007 by Davide Madrisan if [ $UID != 0 ]; then @@ -389,7 +389,7 @@ if [ "$CONFCREATED" = "1" -a "$VIDEODRIVER" ]; then # sync to avoid filesystem corruption in case of system hang on probe sync - xinit /bin/true -- :5 2>>$logfile + xinit /bin/true -- :5 if [ -r /var/log/Xorg.5.log ]; then diff --git a/postplug/postplug b/postplug/postplug index c52331e..017af11 100644 --- a/postplug/postplug +++ b/postplug/postplug @@ -1,7 +1,7 @@ #!/bin/bash # # postplug - Postplug boot time configuration script -# Copyright (c) 2004-2011 by Silvan Calarco +# Copyright (c) 2004-2017 by Silvan Calarco # Copyright (c) 2004-2007 by Davide Madrisan if [ $UID != 0 ]; then @@ -14,7 +14,7 @@ me="${0##*/}" [ -r /etc/postplug/postplug.defs ] || { currtime="`LANG=C date +\"%b %d %H:%M:%S\" 2>/dev/null`" echo "\ -$currtime postplug: "$"error: "$"cannot read postplug.defs" >> $logfile +$currtime postplug: "$"error: "$"cannot read postplug.defs" >&2 exit 1; } . /etc/postplug/postplug.defs @@ -28,13 +28,8 @@ export POSTPLUGON=1 # set homedir if not set (needed at boot time execution) [ "$HOME" ] || export HOME=/root -logfile=/var/log/postplug.log -touch $logfile - logmsg "" $"starting"" ${me}" -export logfile - rm -f $postplugnewdir/* # check via /proc/cmdline for plugins that must not be executed diff --git a/postplug/postplug-defs b/postplug/postplug-defs index bb25723..060d1f0 100644 --- a/postplug/postplug-defs +++ b/postplug/postplug-defs @@ -21,7 +21,7 @@ function logmsg() { local pluginame="${1:+ [$1]}" local currtime="`LANG=C date +\"%b %d %H:%M:%S\" 2>/dev/null`" - if [ -w "$logfile" ]; then + if [ "$logfile" -a -w "$logfile" ]; then echo "$currtime `hostname` postplug${pluginame}: $2" >> $logfile else echo "$currtime `hostname` postplug${pluginame}: $2"