From c408cc553f0b420e82f3ed4f62722bd40148520e Mon Sep 17 00:00:00 2001 From: rjones Date: Thu, 19 Mar 2009 18:11:54 +0000 Subject: [PATCH] More updates. --- .cvsignore | 6 ++- Makefile.am | 35 +++++++++++++++-- febootstrap-fix-root.pod | 41 ++++++++++++++++++++ febootstrap-to-initramfs.pod | 91 ++++++++++++++++++++++++++++++++++++++++++++ febootstrap-to-initramfs.sh | 38 ++++++++++++++++++ febootstrap.pod | 10 ++--- 6 files changed, 211 insertions(+), 10 deletions(-) create mode 100644 febootstrap-fix-root.pod create mode 100644 febootstrap-to-initramfs.pod create mode 100755 febootstrap-to-initramfs.sh diff --git a/.cvsignore b/.cvsignore index 1d61e52..92eff90 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1,3 +1,5 @@ +febootstrap*.8 +febootstrap*.txt Makefile.in Makefile aclocal.m4 @@ -8,6 +10,6 @@ config.log config.status configure febootstrap -febootstrap.8 -febootstrap.txt +febootstrap-fix-root +febootstrap-to-initramfs stamp-h1 diff --git a/Makefile.am b/Makefile.am index 38a4e1d..61c8172 100644 --- a/Makefile.am +++ b/Makefile.am @@ -17,7 +17,7 @@ # # Written by Richard W.M. Jones -bin_SCRIPTS = febootstrap +bin_SCRIPTS = febootstrap febootstrap-to-initramfs febootstrap: febootstrap.sh rm -f $@ @@ -25,7 +25,13 @@ febootstrap: febootstrap.sh chmod 0555 $@-t mv $@-t $@ -man_MANS = febootstrap.8 +febootstrap-to-initramfs: febootstrap-to-initramfs.sh + rm -f $@ + cp $< $@-t + chmod 0555 $@-t + mv $@-t $@ + +man_MANS = febootstrap.8 febootstrap-to-initramfs.8 febootstrap-fix-root.8 if HAVE_PERLDOC febootstrap.8: febootstrap.pod @@ -37,6 +43,29 @@ febootstrap.8: febootstrap.pod febootstrap.txt: febootstrap.pod pod2text $< > $@ + +febootstrap-to-initramfs.8: febootstrap-to-initramfs.pod + pod2man \ + --section 8 \ + -c "Virtualization Support" \ + --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \ + $< > $@ + +febootstrap-to-initramfs.txt: febootstrap-to-initramfs.pod + pod2text $< > $@ + +febootstrap-fix-root.8: febootstrap-fix-root.pod + pod2man \ + --section 8 \ + -c "Virtualization Support" \ + --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \ + $< > $@ + +febootstrap-fix-root.txt: febootstrap-fix-root.pod + pod2text $< > $@ endif -EXTRA_DIST = febootstrap.8 febootstrap.txt +EXTRA_DIST = \ + febootstrap.8 febootstrap.txt \ + febootstrap-to-initramfs.8 febootstrap-to-initramfs.txt \ + febootstrap-fix-root.8 febootstrap-fix-root.txt diff --git a/febootstrap-fix-root.pod b/febootstrap-fix-root.pod new file mode 100644 index 0000000..78e5d3d --- /dev/null +++ b/febootstrap-fix-root.pod @@ -0,0 +1,41 @@ +=head1 NAME + +febootstrap-fix-root - Fix ownership and permissions inside febootstrap root + +=head1 SYNOPSIS + + febootstrap-fix-root DIR + +=head1 DESCRIPTION + + + + +=head1 SEE ALSO + +L, +L, +L. + +=head1 AUTHORS + +Richard W.M. Jones + +=head1 COPYRIGHT + +(C) Copyright 2009 Red Hat Inc., +L. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. diff --git a/febootstrap-to-initramfs.pod b/febootstrap-to-initramfs.pod new file mode 100644 index 0000000..ce0296d --- /dev/null +++ b/febootstrap-to-initramfs.pod @@ -0,0 +1,91 @@ +=head1 NAME + +febootstrap-to-initramfs - Convert febootstrap root to initramfs (cpio) file. + +=head1 SYNOPSIS + + febootstrap-to-initramfs DIR > initrd.img + +=head1 DESCRIPTION + +I converts the filesystem created by +L into an initramfs image. This allows the new system +to be booted on real hardware or inside a QEMU-based virtual machine. + +An initramfs image is just a compressed cpio file, so you could +uncompress it with L and use L to convert it into +other formats. + +The permissions inside the initrd image are corrected automatically +(see the discussion of fakeroot logfile in the L +page). You do I need to run this command as root. + +=head1 /init + +Normal initramfs images start by executing the program or script +called C. febootstrap does not create this script, so you may +wish to, particularly for very minimal bootstraps that don't have the +normal SysVinit/upstart machinery. + +Linux will try to run the following commands in turn, unless you +override it using the C> kernel option: + +=over 4 + +=item * + +/init + +=item * + +/sbin/init + +=item * + +/etc/init + +=item * + +/bin/init + +=item * + +/bin/sh + +=back + +=head1 MEMORY REQUIREMENTS + +Initramfs images are uncompressed by the kernel into memory. When +booting the new system you will need at least enough free RAM to store +the B filesystem plus extra to run any programs. Bear +this in mind when creating very large filesystems. + +=head1 SEE ALSO + +L, +L, +L. + +=head1 AUTHORS + +Richard W.M. Jones + +=head1 COPYRIGHT + +(C) Copyright 2009 Red Hat Inc., +L. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. diff --git a/febootstrap-to-initramfs.sh b/febootstrap-to-initramfs.sh new file mode 100755 index 0000000..1fdd50e --- /dev/null +++ b/febootstrap-to-initramfs.sh @@ -0,0 +1,38 @@ +#!/bin/bash - +# febootstrap-to-initramfs +# (C) Copyright 2009 Red Hat Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# Written by Richard W.M. Jones + +if [ $# -ne 1 ]; then + echo "febootstrap-to-initramfs DIR > initrd.img" + exit 1 +fi + +cd "$1" + +if [ ! -f fakeroot.log -a $(id -u) -ne 0 ]; then + echo "no fakeroot.log and not running as root" + exit 1 +fi + +if [ -f fakeroot.log ]; then + fakeroot -i fakeroot.log \ + sh -c 'find -not -name fakeroot.log -a -print0 | cpio -o0c | gzip --best' +else + find -not -name fakeroot.log -a -print0 | cpio -o0c | gzip --best +fi diff --git a/febootstrap.pod b/febootstrap.pod index a756464..b579799 100644 --- a/febootstrap.pod +++ b/febootstrap.pod @@ -21,8 +21,8 @@ I. Optionally I can point to a local mirror (otherwise the public Fedora mirrors are used). I names are C> (eg. C) or C. -febootstrap does not need to be run as root. If for some reason you -do run it as root, then it works slightly differently and may have +febootstrap does I need to be run as root. If for some reason +you do run it as root, then it works slightly differently and may have side effects such as stopping or starting system daemons. For more advanced needs, take a look at L and @@ -84,8 +84,8 @@ command with the faked file permissions. =item * -Generate an initrd (cpio) file containing the correct permissions -using the tool C. +Generate an initramfs (compressed cpio) file containing the correct +permissions using the tool C. =item * @@ -136,7 +136,7 @@ L =head1 SEE ALSO -L, +L, L, L, L, -- 1.8.3.1