Log to stdout and stderr, no longer to /var/log/postplug.log

This commit is contained in:
Silvan Calarco 2017-12-20 12:58:27 +01:00
parent 4d6ef8a665
commit 67ba1a18c3
4 changed files with 10 additions and 15 deletions

View File

@ -1,7 +1,7 @@
#!/bin/bash
#
# loadconf - postplug plugin: restore the QiLinux Live system/user configuration
# Copyright (c) 2004-2007 by Davide Madrisan <davide.madrisan@qilinux.it>
# Copyright (c) 2004-2017 by Davide Madrisan <davide.madrisan@qilinux.it>
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

View File

@ -1,6 +1,6 @@
#!/bin/bash
# xorg - xorg plugin for postplug
# Copyright (c) 2004-2015 by Silvan Calarco <silvan.calarco@mambasoft.it>
# Copyright (c) 2004-2017 by Silvan Calarco <silvan.calarco@mambasoft.it>
# Copyright (c) 2004-2007 by Davide Madrisan <davide.madrisan@gmail.com>
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

View File

@ -1,7 +1,7 @@
#!/bin/bash
#
# postplug - Postplug boot time configuration script
# Copyright (c) 2004-2011 by Silvan Calarco <silvan.calarco@mambasoft.it>
# Copyright (c) 2004-2017 by Silvan Calarco <silvan.calarco@mambasoft.it>
# Copyright (c) 2004-2007 by Davide Madrisan <davide.madrisan@qilinux.it>
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

View File

@ -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"