Pino Toscano
2014-Nov-04 08:18 UTC
[Libguestfs] [PATCH] customize: firstboot: fix Linux log output
Pass -a to each tee invocation, otherwise just the last one (so only for
the last script executed) will appear in the log file.
---
customize/firstboot.ml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/customize/firstboot.ml b/customize/firstboot.ml
index 89821f3..0b95708 100644
--- a/customize/firstboot.ml
+++ b/customize/firstboot.ml
@@ -50,8 +50,8 @@ d=%s/scripts
d_done=%s/scripts-done
logfile=~root/virt-sysprep-firstboot.log
-echo \"$0\" \"$@\" 2>&1 | tee $logfile
-echo \"Scripts dir: $d\" 2>&1 | tee $logfile
+echo \"$0\" \"$@\" 2>&1 | tee -a $logfile
+echo \"Scripts dir: $d\" 2>&1 | tee -a $logfile
if test \"$1\" = \"start\"
then
@@ -62,8 +62,8 @@ then
# move the script to the 'scripts-done' directory, so it is not
# executed again at the next boot
mv $f $d_done
- echo '=== Running' $f '===' 2>&1 | tee $logfile
- $d_done/$(basename $f) 2>&1 | tee $logfile
+ echo '=== Running' $f '===' 2>&1 | tee -a $logfile
+ $d_done/$(basename $f) 2>&1 | tee -a $logfile
fi
done
rm -f $d_done/*
--
1.9.3
Richard W.M. Jones
2014-Nov-04 09:31 UTC
Re: [Libguestfs] [PATCH] customize: firstboot: fix Linux log output
On Tue, Nov 04, 2014 at 09:18:08AM +0100, Pino Toscano wrote:> Pass -a to each tee invocation, otherwise just the last one (so only for > the last script executed) will appear in the log file. > --- > customize/firstboot.ml | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/customize/firstboot.ml b/customize/firstboot.ml > index 89821f3..0b95708 100644 > --- a/customize/firstboot.ml > +++ b/customize/firstboot.ml > @@ -50,8 +50,8 @@ d=%s/scripts > d_done=%s/scripts-done > logfile=~root/virt-sysprep-firstboot.log > > -echo \"$0\" \"$@\" 2>&1 | tee $logfile > -echo \"Scripts dir: $d\" 2>&1 | tee $logfile > +echo \"$0\" \"$@\" 2>&1 | tee -a $logfile > +echo \"Scripts dir: $d\" 2>&1 | tee -a $logfile > > if test \"$1\" = \"start\" > then > @@ -62,8 +62,8 @@ then > # move the script to the 'scripts-done' directory, so it is not > # executed again at the next boot > mv $f $d_done > - echo '=== Running' $f '===' 2>&1 | tee $logfile > - $d_done/$(basename $f) 2>&1 | tee $logfile > + echo '=== Running' $f '===' 2>&1 | tee -a $logfile > + $d_done/$(basename $f) 2>&1 | tee -a $logfile > fi > done > rm -f $d_done/*ACK. This seems like it may be a candidate for RHEL 7.1. There's no specific bug for this, right? (RHBZ#1132652 is not appropriate I don't think ...) Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
Seemingly Similar Threads
- [PATCH] customize: firstboot: make sure to run Linux scripts only once
- [PATCH] customize: firstboot: make sure to run Linux scripts only once
- Re: virt-customize fail to inject firstboot script when running it from script.
- Re: [PATCH] customize: firstboot: make sure to run Linux scripts only once
- virt-customize fail to inject firstboot script when running it from script.