Version 1.4. Now uses FAKECHROOT_CMD_SUBST to remove most %post warnings.
[febootstrap.git] / febootstrap.pod
1 =head1 NAME
2
3 febootstrap - Bootstrap a basic Fedora system (like Debian debootstrap)
4
5 =head1 SYNOPSIS
6
7  febootstrap [--options] REPO TARGET [MIRROR]
8
9 =head1 EXAMPLES
10
11  febootstrap fedora-10 /tmp/f10
12  febootstrap rawhide /tmp/rawhide
13  febootstrap rawhide /tmp/rawhide http://mymirror/rawhide/x86_64/os
14  febootstrap --groupinstall="Mail Server" fedora-10 /tmp/mailserver
15
16 =head1 DESCRIPTION
17
18 febootstrap creates a Fedora root filesystem, based on the Fedora
19 version specified by I<REPO> under the directory specified by
20 I<TARGET>.  Optionally I<MIRROR> can point to a local mirror
21 (otherwise the public Fedora mirrors are used).  I<REPO> names are
22 C<fedora-I<VERSION>> (eg. C<fedora-10>) or C<rawhide>.
23
24 febootstrap does I<not> need to be run as root.  If for some reason
25 you do run it as root, then it works slightly differently and may have
26 side effects such as stopping or starting system daemons.
27
28 For more advanced needs, take a look at L<mock(1)>, C<livecd-creator>
29 and I<thincrust.net>'s C<appliance-creator>.
30
31 The normal output is a root directory located at I<TARGET> and
32 a fakeroot logfile at C<I<TARGET>/fakeroot.log>.
33
34 =head1 OPTIONS
35
36 =over 4
37
38 =item B<-i package>
39
40 =item B<--install=package>
41
42 =item B<-g "group">
43
44 =item B<--groupinstall="group">
45
46 Specify the package or group to install.  To list multiple packages or
47 groups, you must give multiple C<-i> or C<-g> options.  Group names
48 can contain spaces, so use quotes where necessary.
49
50 These are passed directly to C<yum install> or C<yum groupinstall>
51 commands, and thus any dependencies are also resolved by yum.  You can
52 also use shell globs and filenames here, as with ordinary yum.
53
54 If no packages or groups are given, then we install the C<Core> group
55 which is a small working Fedora installation (but by no means
56 minimal).  Use C<yum groupinfo Core> to list the packages currently in
57 the C<Core> group.
58
59 =item B<--no-clean>
60
61 Normally febootstrap will clean up the yum repository
62 (C</var/cache/yum> inside the image).  This contains the downloaded
63 RPMs and metadata.  However if you give the C<--no-clean> option, then
64 the yum repository is left.  This is useful if you want to run further
65 yum commands inside the filesystem by hand.
66
67 =back
68
69 =head1 REPOSITORIES
70
71 You can list available repositories by visiting this URL:
72
73 L<http://mirrors.fedoraproject.org/mirrorlist?repo=help&arch=i386>
74
75 (If necessary replace C<i386> with your architecture, but it seems
76 unlikely that this list will change based on architecture).
77
78 =head1 RUNNING EXTRA COMMANDS IN THE ROOT FILESYSTEM
79
80 If you want to run further commands inside the root filesystem, for
81 example additional C<yum> installs, then use C<febootstrap-run>.  See
82 the L<febootstrap-run(8)> manual page for more details.
83
84 You have to be careful about modifying files in the root filesystem
85 directly (without using C<febootstrap-run>).  It's easy to confuse
86 fakeroot and end up with the wrong permissions on files (see FAKEROOT
87 LOGFILE below).
88
89 C<febootstrap-run> runs the command inside the root filesystem, which
90 means it won't normally have access to files outside the root.  You
91 can use C<FAKECHROOT_EXCLUDE_PATH> environment variable (see
92 L<fakechroot(1)>) or copy files into the root first.
93
94 =head2 FAKEROOT LOGFILE
95
96 When febootstrap is run as non-root (the normal case) we use fakeroot
97 so that yum thinks it is running as root.  Fakeroot keeps track of
98 "real" file permissions in a log file which is saved into the target
99 directory as C<I<TARGET>/fakeroot.log>.
100
101 This logfile is indexed by inode number, which makes certain
102 operations safe and other operations unsafe.  For example, deleting
103 files is usually safe.  Files should be replaced only by doing:
104
105  echo updated-content > old-file
106
107 (since that preserves the original inode).  In most cases it's usually
108 safest to use C<febootstrap-run>.
109
110 You can use the fakeroot logfile in a number of ways:
111
112 =over 4
113
114 =item *
115
116 Use L<febootstrap-run(8)> to run a command with the faked file
117 permissions.
118
119 =item *
120
121 Generate an initramfs (compressed cpio) file containing the correct
122 permissions using the tool C<febootstrap-to-initramfs>.
123
124 =item *
125
126 Apply the permissions to the target directory using the forthcoming
127 tool C<febootstrap-fix-root> (requires root).
128
129 =back
130
131 =head1 RUNNING FEBOOTSTRAP AS ROOT
132
133 There is some rudimentary support for running C<febootstrap> as root.
134 However it is not well-tested and generally not recommended.
135
136 =head1 COMPARISON TO DEBOOTSTRAP
137
138 febootstrap cannot do cross-architecture installs (C<debootstrap
139 --foreign>).  The reason is that C<%pre> and C<%post> scripts cannot
140 run.  It may be possible to defer running of scriptlets (which is
141 basically how debootstrap works), and patches to do this are welcomed.
142
143 febootstrap cannot do 32-on-64 bit installs.  The reason is that
144 fakeroot and fakechroot do not load the correct preload library.  This
145 is really a bug in fakeroot/fakechroot, which we think would be easy
146 to fix.  (debootstrap deals with this case the same as for
147 C<--foreign> installs - see previous point).
148
149 =head1 OTHER RESTRICTIONS AND BUGS
150
151 C</sbin/ldconfig> and C</usr/sbin/glibc_post_upgrade> are not run
152 during C<%post> scriptlets (because they are statically linked, and
153 fakechroot cannot run statically linked programs).  If you wish, you
154 can run them the first time you boot into the new machine.
155
156 febootstrap recreates the repository anew each time, and this causes
157 yum to download all the RPMs every time.  This is very wasteful, and
158 we should provide a way to cache the repository.
159
160 =head1 HOME PAGE
161
162 L<http://et.redhat.com/~rjones/febootstrap>
163
164 =head1 SEE ALSO
165
166 L<febootstrap-to-initramfs(8)>,
167 L<febootstrap-minimize(8)>,
168 L<febootstrap-run(8)>,
169 L<fakeroot(1)>,
170 L<fakechroot(1)>,
171 L<yum(8)>,
172 L<rpm(8)>.
173
174 =head1 ALTERNATIVES
175
176 L<mock(1)>,
177 L<http://fedoraproject.org/wiki/FedoraLiveCD/LiveCDHowTo>,
178 L<http://thincrust.net/>,
179 L<debootstrap(8)>,
180 C<ubuntu-vm-builder>.
181
182 =head1 AUTHORS
183
184 Richard W.M. Jones <rjones @ redhat . com>
185
186 =head1 COPYRIGHT
187
188 (C) Copyright 2009 Red Hat Inc.,
189 L<http://et.redhat.com/~rjones/febootstrap>.
190
191 This program is free software; you can redistribute it and/or modify
192 it under the terms of the GNU General Public License as published by
193 the Free Software Foundation; either version 2 of the License, or
194 (at your option) any later version.
195
196 This program is distributed in the hope that it will be useful,
197 but WITHOUT ANY WARRANTY; without even the implied warranty of
198 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
199 GNU General Public License for more details.
200
201 You should have received a copy of the GNU General Public License
202 along with this program; if not, write to the Free Software
203 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.