Cédric Bosdonnat
2016-Jul-21 08:26 UTC
[Libguestfs] [PATCH] appliance: move virt-rescue welcome to /etc/issue
To allow easier downstream tweaks to the virt-rescue welcome message, just output the content of the /etc/issue file in the appliance. Thus, a new extras.tar.gz file appeared in supermin.d containing the etc/issue file and future tweaks like this one. --- appliance/Makefile.am | 11 +++++++++++ appliance/init | 11 ++--------- appliance/issue | 9 +++++++++ 3 files changed, 22 insertions(+), 9 deletions(-) create mode 100644 appliance/issue diff --git a/appliance/Makefile.am b/appliance/Makefile.am index e23778e..f26c4d4 100644 --- a/appliance/Makefile.am +++ b/appliance/Makefile.am @@ -36,6 +36,7 @@ EXTRA_DIST = \ guestfs_shadow.aug \ hostfiles.in \ init \ + issue \ libguestfs-make-fixed-appliance.in \ libguestfs-make-fixed-appliance.pod \ make.sh.in \ @@ -49,6 +50,7 @@ superminfs_DATA = \ supermin.d/base.tar.gz \ supermin.d/daemon.tar.gz \ supermin.d/excludefiles \ + supermin.d/extras.tar.gz \ supermin.d/hostfiles \ supermin.d/init.tar.gz \ supermin.d/packages \ @@ -107,6 +109,15 @@ supermin.d/excludefiles: excludefiles.in Makefile cmp -s $@ excludefiles-t || mv excludefiles-t $@ rm -f excludefiles-t +supermin.d/extras.tar.gz: issue + rm -f $@ $@-t + rm -rf tmp-d + mkdir -p tmp-d/etc + cp issue tmp-d/etc + ( cd tmp-d && tar zcf - * ) > $@-t + rm -r tmp-d + mv $@-t $@ + supermin.d/hostfiles: hostfiles.in Makefile m4 $(PACKAGELIST_CPP_FLAGS) $< | \ grep -v '^[[:space:]]*$$' | grep -v '^#' > hostfiles-t diff --git a/appliance/init b/appliance/init index 3816dfd..e549df0 100755 --- a/appliance/init +++ b/appliance/init @@ -184,15 +184,8 @@ else echo "PS1='><rescue> '" >> $HOME/.bashrc echo "export TERM PS1" >> $HOME/.bashrc - echo - echo "------------------------------------------------------------" - echo - echo "Welcome to virt-rescue, the libguestfs rescue shell." - echo - echo "Note: The contents of / are the rescue appliance." - echo "You have to mount the guest's partitions under /sysroot" - echo "before you can examine them." - echo + cat /etc/issue + bash -i echo echo "virt-rescue: Syncing the disk now before exiting ..." diff --git a/appliance/issue b/appliance/issue new file mode 100644 index 0000000..40b8e17 --- /dev/null +++ b/appliance/issue @@ -0,0 +1,9 @@ + +------------------------------------------------------------ + +Welcome to virt-rescue, the libguestfs rescue shell. + +Note: The contents of / are the rescue appliance. +You have to mount the guest's partitions under /sysroot +before you can examine them. + -- 2.6.6
Richard W.M. Jones
2016-Jul-21 11:47 UTC
Re: [Libguestfs] [PATCH] appliance: move virt-rescue welcome to /etc/issue
On Thu, Jul 21, 2016 at 10:26:16AM +0200, Cédric Bosdonnat wrote:> @@ -49,6 +50,7 @@ superminfs_DATA = \ > supermin.d/base.tar.gz \ > supermin.d/daemon.tar.gz \ > supermin.d/excludefiles \ > + supermin.d/extras.tar.gz \Let's just call this 'issue.tar.gz' or 'etc_issue.tar.gz' or something that describes what it contains.> supermin.d/hostfiles \ > supermin.d/init.tar.gz \ > supermin.d/packages \ > @@ -107,6 +109,15 @@ supermin.d/excludefiles: excludefiles.in Makefile > cmp -s $@ excludefiles-t || mv excludefiles-t $@ > rm -f excludefiles-t > > +supermin.d/extras.tar.gz: issue > + rm -f $@ $@-t > + rm -rf tmp-d > + mkdir -p tmp-d/etc > + cp issue tmp-d/etc^ extra whitespace at the end of this line> + ( cd tmp-d && tar zcf - * ) > $@-t > + rm -r tmp-d > + mv $@-t $@ > + > supermin.d/hostfiles: hostfiles.in Makefile > m4 $(PACKAGELIST_CPP_FLAGS) $< | \ > grep -v '^[[:space:]]*$$' | grep -v '^#' > hostfiles-t > diff --git a/appliance/init b/appliance/init > index 3816dfd..e549df0 100755 > --- a/appliance/init > +++ b/appliance/init > @@ -184,15 +184,8 @@ else > echo "PS1='><rescue> '" >> $HOME/.bashrc > echo "export TERM PS1" >> $HOME/.bashrc > > - echo > - echo "------------------------------------------------------------" > - echo > - echo "Welcome to virt-rescue, the libguestfs rescue shell." > - echo > - echo "Note: The contents of / are the rescue appliance." > - echo "You have to mount the guest's partitions under /sysroot" > - echo "before you can examine them." > - echo > + cat /etc/issue > + > bash -i > echo > echo "virt-rescue: Syncing the disk now before exiting ..." > diff --git a/appliance/issue b/appliance/issue > new file mode 100644 > index 0000000..40b8e17 > --- /dev/null > +++ b/appliance/issue > @@ -0,0 +1,9 @@ > + > +------------------------------------------------------------ > + > +Welcome to virt-rescue, the libguestfs rescue shell. > + > +Note: The contents of / are the rescue appliance. > +You have to mount the guest's partitions under /sysroot > +before you can examine them. > +The rest looks OK to me, with the changes above. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-builder quickly builds VMs from scratch http://libguestfs.org/virt-builder.1.html
Pino Toscano
2016-Jul-22 09:57 UTC
Re: [Libguestfs] [PATCH] appliance: move virt-rescue welcome to /etc/issue
On Thursday, 21 July 2016 10:26:16 CEST Cédric Bosdonnat wrote:> To allow easier downstream tweaks to the virt-rescue welcome message, > just output the content of the /etc/issue file in the appliance. > Thus, a new extras.tar.gz file appeared in supermin.d containing > the etc/issue file and future tweaks like this one. > ---Why not include /etc/issue in daemon.tar.gz, and just patch appliance/issue downstream? Also, which kind of tweaks are going to be done downstream? Is there anything that could be done directly upstream? I'd interested to know the reasons behind this before. Thanks, -- Pino Toscano
Cedric Bosdonnat
2016-Nov-30 16:51 UTC
Re: [Libguestfs] [PATCH] appliance: move virt-rescue welcome to /etc/issue
On Fri, 2016-07-22 at 11:57 +0200, Pino Toscano wrote:> On Thursday, 21 July 2016 10:26:16 CEST Cédric Bosdonnat wrote: > > To allow easier downstream tweaks to the virt-rescue welcome message, > > just output the content of the /etc/issue file in the appliance. > > Thus, a new extras.tar.gz file appeared in supermin.d containing > > the etc/issue file and future tweaks like this one. > > --- > > Why not include /etc/issue in daemon.tar.gz, and just patch > appliance/issue downstream? > > Also, which kind of tweaks are going to be done downstream? Is there > anything that could be done directly upstream? > I'd interested to know the reasons behind this before.The change we do is to advertise for a helper script we provide (and could possibly upstreamed for sure). This script called mount-rootfs-and-chroot.sh mounts the root file system in /sysroot and chroot in it. -- Cedric
Reasonably Related Threads
- [PATCH] appliance: move virt-rescue welcome to /etc/issue
- ANNOUNCE: libguestfs 1.34 released
- Re: [PATCH] appliance: read ID_LIKE from os-release as a fallback
- Re: [PATCH] appliance: read ID_LIKE from os-release as a fallback
- Re: [PATCH 0/5] Introducing virt-builder-repository