+*~
febootstrap*.8
febootstrap*.txt
febootstrap-*.tar.gz
configure
febootstrap.spec
febootstrap
+febootstrap-run
febootstrap-minimize
febootstrap-to-initramfs
install-sh
bin_SCRIPTS = \
febootstrap \
+ febootstrap-run \
febootstrap-minimize \
febootstrap-to-initramfs
DISTCLEANFILES = $(bin_SCRIPTS)
chmod 0555 $@-t
mv $@-t $@
+febootstrap-run: febootstrap-run.sh
+ rm -f $@
+ cp $< $@-t
+ chmod 0555 $@-t
+ mv $@-t $@
+
febootstrap-minimize: febootstrap-minimize.sh
rm -f $@
cp $< $@-t
man_MANS = \
febootstrap.8 \
+ febootstrap-run.8 \
febootstrap-minimize.8 \
febootstrap-to-initramfs.8
febootstrap.txt: febootstrap.pod
pod2text $< > $@
+febootstrap-run.8: febootstrap-run.pod
+ pod2man \
+ --section 8 \
+ -c "Virtualization Support" \
+ --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
+ $< > $@
+
+febootstrap-run.txt: febootstrap-run.pod
+ pod2text $< > $@
+
febootstrap-minimize.8: febootstrap-minimize.pod
pod2man \
--section 8 \
fakechroot-svn-no-dup-envs.patch \
febootstrap.8 febootstrap.txt febootstrap.pod \
febootstrap.sh \
+ febootstrap-run.8 febootstrap-run.txt febootstrap-run.pod \
+ febootstrap-run.sh \
febootstrap-minimize.8 febootstrap-minimize.txt \
febootstrap-minimize.pod \
febootstrap-minimize.sh \
- Tested with version 1.11.
fakechroot > 2.8 or 2.8 + patch
- - NB. KNOWN NOT TO WORK WITH 2.8. You MUST apply the patch
- 'fakechroot-2.8-relchroot.patch' to the fakechroot sources
- and recompile. Hopefully this patch will be included in
- future versions of fakechroot.
+ - **** NB. KNOWN NOT TO WORK WITH 2.8 ***** You MUST apply
+ the patch 'fakechroot-2.8-relchroot.patch' to the fakechroot
+ sources and recompile. Hopefully this patch will be included
+ in future versions of fakechroot.
yum
- Tested with version 3.2.
# This is a realistic example for 'libguestfs', which contains a
# selection of command-line tools, LVM, NTFS and an NFS server.
+set -e
+
if [ $(id -u) -eq 0 ]; then
echo "Don't run this script as root. Read instructions in script first."
exit 1
# Now run qemu to boot this guestfs system.
qemu-system-$(arch) \
- -m 128 \
+ -m 256 \
-kernel vmlinuz -initrd guestfs-initrd.img \
-hda guest-image -boot c
# few command line utilities. One of the joys of Fedora is that even
# this minimal install is still 200 MB ...
+set -e
+
if [ $(id -u) -eq 0 ]; then
echo "Don't run this script as root. Read instructions in script first."
exit 1
# Now run qemu to boot this minimal system.
qemu-system-$(arch) \
- -m 128 \
+ -m 256 \
-kernel vmlinuz -initrd minimal-initrd.img \
-hda zero -boot c
--- /dev/null
+=head1 NAME
+
+febootstrap-run - Run extra commands in febootstrap root filesystem
+
+=head1 SYNOPSIS
+
+ febootstrap-run [--options] DIR [--] [CMD ...]
+
+=head1 DESCRIPTION
+
+This can be used to run extra commands in the febootstrap root
+filesystem. It is just a simple wrapper around the standard
+C<fakeroot> and C<fakechroot> commands.
+
+If given, the C<CMD ...> is run inside the root filesystem. The
+command acts as if it was run as root and chrooted into the root
+filesystem.
+
+If the command is omitted, then we start a shell.
+
+If C<CMD ...> could contain anything starting with a C<-> character
+then use C<--> to separate C<febootstrap-run> parameters from the
+command:
+
+ febootstrap-run ./f10 -- ls -l
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<--ro>
+
+Usually any changes to permissions made by the command are recorded in
+the C<fakeroot.log> file. However if C<--ro> flag is given, then
+changes to permissions are not recorded. (Note: changes to file
+contents still happen).
+
+=back
+
+=head1 ENVIRONMENT VARIABLES
+
+Some L<fakechroot(1)> environment variables are applicable. In
+particular you may want to set:
+
+ export FAKECHROOT_EXCLUDE_PATH=/proc
+
+=head1 SEE ALSO
+
+L<febootstrap(8)>,
+L<fakeroot(1)>,
+L<fakechroot(1)>.
+
+=head1 AUTHORS
+
+Richard W.M. Jones <rjones @ redhat . com>
+
+=head1 COPYRIGHT
+
+(C) Copyright 2009 Red Hat Inc.,
+L<http://et.redhat.com/~rjones/febootstrap>.
+
+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.
--- /dev/null
+#!/bin/bash -
+# febootstrap-run
+# (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 <rjones@redhat.com>
+
+TEMP=`getopt \
+ -o g:i: \
+ --long help,ro \
+ -n febootstrap-run -- "$@"`
+if [ $? != 0 ]; then
+ echo "febootstrap-run: problem parsing the command line arguments"
+ exit 1
+fi
+eval set -- "$TEMP"
+
+readonly=no
+
+usage ()
+{
+ echo "Usage: febootstrap-run [--options] DIR [CMD]"
+ echo "Please read febootstrap-run(8) man page for more information."
+}
+
+while true; do
+ case "$1" in
+ --ro)
+ readonly=yes
+ shift;;
+ --help)
+ usage
+ exit 0;;
+ --)
+ shift
+ break;;
+ *)
+ echo "Internal error!"
+ exit 1;;
+ esac
+done
+
+if [ $# -lt 1 ]; then
+ usage
+ exit 1
+fi
+
+target="$1"
+shift
+
+if [ ! -f "$target"/fakeroot.log ]; then
+ echo "febootstrap-run: $target: not a root filesystem"
+ exit 1
+fi
+
+if [ "$readonly" = "no" ]; then
+ fakeroot -i "$target"/fakeroot.log -s "$target"/fakeroot.log \
+ fakechroot -s \
+ chroot "$target" "$@"
+else
+ fakeroot -i "$target"/fakeroot.log \
+ fakechroot -s \
+ chroot "$target" "$@"
+fi
(If necessary replace C<i386> with your architecture, but it seems
unlikely that this list will change based on architecture).
-=head1 FAKEROOT LOGFILE
+=head1 RUNNING EXTRA COMMANDS IN THE ROOT FILESYSTEM
+
+If you want to run further commands inside the root filesystem, for
+example additional C<yum> installs, then use C<febootstrap-run>. See
+the L<febootstrap-run(8)> manual page for more details.
+
+You have to be careful about modifying files in the root filesystem
+directly (without using C<febootstrap-run>). It's easy to confuse
+fakeroot and end up with the wrong permissions on files (see FAKEROOT
+LOGFILE below).
+
+C<febootstrap-run> runs the command inside the root filesystem, which
+means it won't normally have access to files outside the root. You
+can use C<FAKECHROOT_EXCLUDE_PATH> environment variable (see
+L<fakechroot(1)>) or copy files into the root first.
+
+=head2 FAKEROOT LOGFILE
When febootstrap is run as non-root (the normal case) we use fakeroot
so that yum thinks it is running as root. Fakeroot keeps track of
"real" file permissions in a log file which is saved into the target
directory as C<I<TARGET>/fakeroot.log>.
-You can use the fakeroot logfile in a number of ways:
+This logfile is indexed by inode number, which makes certain
+operations safe and other operations unsafe. For example, deleting
+files is usually safe. Files should be replaced only by doing:
-=over 4
+ echo updated-content > old-file
-=item *
+(since that preserves the original inode). In most cases it's usually
+safest to use C<febootstrap-run>.
-Run
+You can use the fakeroot logfile in a number of ways:
- fakeroot -i fakeroot.log command
+=over 4
-in order to run a command with the faked file permissions. If the
-command will make updates, then do:
+=item *
- fakeroot -i fakeroot.log -s fakeroot.log command
+Use L<febootstrap-run(8)> to run a command with the faked file
+permissions.
=item *
=back
-=head1 COMPARISON TO debootstrap
+=head1 RUNNING FEBOOTSTRAP AS ROOT
+
+There is some rudimentary support for running C<febootstrap> as root.
+However it is not well-tested and generally not recommended.
+
+=head1 COMPARISON TO DEBOOTSTRAP
febootstrap cannot do cross-architecture installs (C<debootstrap
--foreign>). The reason is that C<%pre> and C<%post> scripts cannot
L<febootstrap-to-initramfs(8)>,
L<febootstrap-minimize(8)>,
+L<febootstrap-run(8)>,
L<fakeroot(1)>,
L<fakechroot(1)>,
L<yum(8)>,