mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
firstboot: Send the output to the console as well as to the log file.
For systemd: Currently stdout+stderr go to the journal (these are effectively empty unless there are gross errors). The output of the commands goes to the log file. With this change, the output goes to the journal, the console and the log file. For SysV-init: Currently stdout+stderr go to the console (but these are effectively empty). The output of the commands goes to the log file. With this change, the output goes to the console and the log file.
This commit is contained in:
@@ -45,16 +45,16 @@ let firstboot_sh = sprintf "\
|
||||
d=%s/scripts
|
||||
logfile=~root/virt-sysprep-firstboot.log
|
||||
|
||||
echo \"$0\" \"$@\" >>$logfile
|
||||
echo \"Scripts dir: $d\" >>$logfile
|
||||
echo \"$0\" \"$@\" 2>&1 | tee $logfile
|
||||
echo \"Scripts dir: $d\" 2>&1 | tee $logfile
|
||||
|
||||
if test \"$1\" = \"start\"
|
||||
then
|
||||
for f in $d/* ; do
|
||||
if test -x \"$f\"
|
||||
then
|
||||
echo '=== Running' $f '===' >>$logfile
|
||||
$f >>$logfile 2>&1
|
||||
echo '=== Running' $f '===' 2>&1 | tee $logfile
|
||||
$f 2>&1 | tee $logfile
|
||||
rm -f $f
|
||||
fi
|
||||
done
|
||||
@@ -71,6 +71,8 @@ Before=prefdm.service
|
||||
Type=oneshot
|
||||
ExecStart=%s/firstboot.sh start
|
||||
RemainAfterExit=yes
|
||||
StandardOutput=journal+console
|
||||
StandardError=inherit
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
|
||||
Reference in New Issue
Block a user