summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrjones <rjones>2009-03-19 15:01:50 +0000
committerrjones <rjones>2009-03-19 15:01:50 +0000
commit1ef78043a28df140e5302a4e00635e3d0792dbeb (patch)
tree6ec98bed60287b1654d50564e1d5703c47a75432
downloadfebootstrap-1ef78043a28df140e5302a4e00635e3d0792dbeb.tar.gz
febootstrap-1ef78043a28df140e5302a4e00635e3d0792dbeb.tar.xz
febootstrap-1ef78043a28df140e5302a4e00635e3d0792dbeb.zip
Basic build environment and man page.
-rw-r--r--.cvsignore2
-rw-r--r--Makefile.am18
-rw-r--r--README46
-rw-r--r--configure.ac49
-rw-r--r--fakechroot-2.8-relchroot.patch47
-rw-r--r--febootstrap.pod153
-rwxr-xr-xfebootstrap.sh20
7 files changed, 335 insertions, 0 deletions
diff --git a/.cvsignore b/.cvsignore
new file mode 100644
index 0000000..68734ff
--- /dev/null
+++ b/.cvsignore
@@ -0,0 +1,2 @@
+febootstrap
+febootstrap.8
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..81c874a
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,18 @@
+# febootstrap Makefile.am
+# (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>
diff --git a/README b/README
new file mode 100644
index 0000000..5f2a8a7
--- /dev/null
+++ b/README
@@ -0,0 +1,46 @@
+febootstrap - Bootstrap a basic Fedora system
+by Richard W.M. Jones (rjones@redhat.com)
+----------------------------------------------------------------------
+
+febootstrap is a Fedora equivalent to Debian's debootstrap. You can
+use it to create a basic Fedora filesystem.
+
+There are currently some restrictions compared to debootstrap.
+
+For instructions, restrictions, examples etc. please read the manpage
+febootstrap(8).
+
+Requirements
+------------
+
+ fakeroot
+ - 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.
+
+ yum
+ - Tested with version 3.2.
+ - Needs network access to a Fedora repository, or a local
+ Fedora mirror.
+
+ perldoc
+ - This is just used to generate the manpage.
+
+ bash
+
+Building and installing
+-----------------------
+
+ ./configure
+ make
+ sudo make install
+
+Feedback and bugs
+-----------------
+
+Send feedback to rjones@redhat.com. You can file bugs in
+http://bugzilla.redhat.com/
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..169617c
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,49 @@
+dnl febootstrap configure.ac
+dnl (C) Copyright 2009 Red Hat Inc.
+dnl
+dnl This program is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 2 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program; if not, write to the Free Software
+dnl Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+dnl
+dnl Written by Richard W.M. Jones <rjones@redhat.com>
+
+AC_INIT(febootstrap,1.0)
+AM_INIT_AUTOMAKE
+
+AC_PROG_CC
+AM_PROG_CC_C_O
+
+AC_CHECK_PROG(PERLDOC,[perldoc],[perldoc],[no])
+if test "x$PERLDOC" = "xno" ; then
+ AC_MSG_WARN([perldoc not found - install perl to make man pages])
+fi
+AM_CONDITIONAL(PERLDOC,[test "$perldoc" != "no"])
+
+AC_CHECK_PROG(FAKEROOT,[fakeroot],[fakeroot],[no])
+if test "x$FAKEROOT" = "xno" ; then
+ AC_MSG_FAILURE([fakeroot program not found])
+fi
+
+AC_CHECK_PROG(FAKECHROOT,[fakechroot],[fakechroot],[no])
+if test "x$FAKECHROOT" = "xno" ; then
+ AC_MSG_FAILURE([fakechroot program not found])
+fi
+
+AC_CHECK_PROG(YUM,[yum],[yum],[no])
+if test "x$YUM" = "xno" ; then
+ AC_MSG_FAILURE([yum program not found])
+fi
+
+AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
diff --git a/fakechroot-2.8-relchroot.patch b/fakechroot-2.8-relchroot.patch
new file mode 100644
index 0000000..9ba4d80
--- /dev/null
+++ b/fakechroot-2.8-relchroot.patch
@@ -0,0 +1,47 @@
+This patch must be applied to fakeroot 2.8 in order to
+enable correct handling of relative chroots, for rpm and yum.
+
+--- fakechroot-2.8.orig/src/libfakechroot.c 2009-03-18 11:39:33.000000000 +0000
++++ fakechroot-2.8.rpm/src/libfakechroot.c 2009-03-18 12:43:51.000000000 +0000
+@@ -1110,7 +1110,7 @@ int chroot (const char *path)
+ {
+ char *ptr, *ld_library_path, *tmp, *fakechroot_path;
+ int status, len;
+- char dir[FAKECHROOT_MAXPATH], cwd[FAKECHROOT_MAXPATH], full_path[FAKECHROOT_MAXPATH];
++ char dir[FAKECHROOT_MAXPATH], cwd[FAKECHROOT_MAXPATH];
+ #if !defined(HAVE_SETENV)
+ char *envbuf;
+ #endif
+@@ -1134,23 +1134,21 @@ int chroot (const char *path)
+ return -1;
+ }
+ if (strcmp(cwd, "/") == 0) {
+- snprintf(full_path, FAKECHROOT_MAXPATH, "/%s", path);
++ snprintf(dir, FAKECHROOT_MAXPATH, "/%s", path);
+ }
+ else {
+- snprintf(full_path, FAKECHROOT_MAXPATH, "%s/%s", cwd, path);
++ snprintf(dir, FAKECHROOT_MAXPATH, "%s/%s", cwd, path);
+ }
+ }
+ else {
+- snprintf(full_path, FAKECHROOT_MAXPATH, "%s", path);
+- }
+-
+- fakechroot_path = getenv("FAKECHROOT_BASE");
++ fakechroot_path = getenv("FAKECHROOT_BASE");
+
+- if (fakechroot_path != NULL) {
+- snprintf(dir, FAKECHROOT_MAXPATH, "%s%s", fakechroot_path, full_path);
+- }
+- else {
+- snprintf(dir, FAKECHROOT_MAXPATH, "%s", full_path);
++ if (fakechroot_path != NULL) {
++ snprintf(dir, FAKECHROOT_MAXPATH, "%s%s", fakechroot_path, path);
++ }
++ else {
++ snprintf(dir, FAKECHROOT_MAXPATH, "%s", path);
++ }
+ }
+
+ #if defined(HAVE___XSTAT) && defined(_STAT_VER)
diff --git a/febootstrap.pod b/febootstrap.pod
new file mode 100644
index 0000000..eac9573
--- /dev/null
+++ b/febootstrap.pod
@@ -0,0 +1,153 @@
+=head1 NAME
+
+febootstrap - Bootstrap a basic Fedora system (like Debian debootstrap)
+
+=head1 SYNOPSIS
+
+ febootstrap [--options] REPO TARGET [MIRROR]
+
+=head1 EXAMPLES
+
+ febootstrap fedora-10 /tmp/f10
+ febootstrap rawhide /tmp/rawhide
+ febootstrap rawhide /tmp/rawhide http://mymirror/rawhide/x86_64/os
+ febootstrap --groupinstall="Mail Server" rawhide /tmp/rawhide
+
+=head1 DESCRIPTION
+
+febootstrap creates a Fedora root filesystem, based on the Fedora
+version specified by I<REPO> under the directory specified by
+I<TARGET>. Optionally I<MIRROR> can point to a local mirror
+(otherwise the public Fedora mirrors are used). I<REPO> names are
+C<fedora-I<VERSION>> (eg. C<fedora-10>) or C<rawhide>.
+
+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
+side effects such as stopping or starting system daemons.
+
+For more advanced needs, take a look at L<mock(1)> and
+C<livecd-creator>.
+
+The normal output is a root directory located at I<TARGET> and
+a fakeroot logfile at C<I<TARGET>/fakeroot.log>.
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<--install="list of packages separated by commas">
+
+=item B<--groupinstall="list of groups separated by commas">
+
+Specify the list of packages or groups to install. These are passed
+directly to C<yum install> or C<yum groupinstall> commands, and thus
+any dependencies are also resolved by yum. You can also use shell
+globs and filenames here, as with ordinary yum.
+
+If no packages or groups are given, then we install the C<Core> group
+which is the smallest working Fedora installation. Use C<yum
+groupinfo Core> to list the packages currently in the C<Core> group.
+
+=back
+
+=head1 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:
+
+=over 4
+
+=item *
+
+Run C<fakeroot -i fakeroot.log I<command>> in order to run a
+command with the faked file permissions.
+
+=item *
+
+Generate an initrd (cpio) file containing the correct permissions
+using the tool C<febootstrap-to-initrd>.
+
+=item *
+
+Apply the permissions to the target directory using the tool
+C<febootstrap-fix-root> (requires root).
+
+=back
+
+=head1 COMPARISON TO debootstrap
+
+febootstrap cannot do cross-architecture installs (C<debootstrap
+--foreign>). The reason is that C<%pre> and C<%post> scripts cannot
+run. It may be possible to defer running of scriptlets (which is
+basically how debootstrap works), and patches to do this are welcomed.
+
+febootstrap cannot do 32-on-64 bit installs. The reason is that
+fakeroot and fakechroot do not load the correct preload library. This
+is really a bug in fakeroot/fakechroot, which we think would be easy
+to fix. (debootstrap deals with this case the same as for
+C<--foreign> installs - see previous point).
+
+=head1 OTHER RESTRICTIONS AND BUGS
+
+Some C<%post> scripts do not run correctly. The most common case is
+C</sbin/ldconfig>. Since this binary is statically linked, fakeroot
+and fakechroot's LD_PRELOAD hack does not work, so effectively
+ldconfig tries to update the system cache. You will see the following
+error:
+
+ /sbin/ldconfig: Can't create temporary cache file /etc/ld.so.cache~: Permission denied
+
+This error is mostly harmless. Just run C</sbin/ldconfig> the first
+time you boot into the newly created Fedora system.
+
+Another error you will see is with C</usr/sbin/glibc_post_upgrade>
+which is caused for the same reason - this binary is statically
+linked. We have examined what this binary does, and it is not really
+necessary for installs. If it makes you happier, you can run it the
+first time you boot the new system.
+
+=head1 HOME PAGE
+
+L<http://et.redhat.com/~rjones/febootstrap>
+
+=head1 SEE ALSO
+
+L<febootstrap-to-initrd(8)>,
+L<febootstrap-fix-root(8)>,
+L<fakeroot(1)>,
+L<fakechroot(1)>,
+L<yum(8)>,
+L<rpm(8)>.
+
+=head1 ALTERNATIVES
+
+L<mock(1)>,
+L<http://fedoraproject.org/wiki/FedoraLiveCD/LiveCDHowTo>,
+L<debootstrap(8)>.
+
+=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.
diff --git a/febootstrap.sh b/febootstrap.sh
new file mode 100755
index 0000000..908d47e
--- /dev/null
+++ b/febootstrap.sh
@@ -0,0 +1,20 @@
+#!/bin/sh -
+# febootstrap
+# (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>
+