Use febootstrap-run properly.
[febootstrap.git] / febootstrap-run.pod
1 =head1 NAME
2
3 febootstrap-run - Run extra commands in febootstrap root filesystem
4
5 =head1 SYNOPSIS
6
7  febootstrap-run [--options] DIR [--] [CMD ...]
8
9 =head1 DESCRIPTION
10
11 This can be used to run extra commands in the febootstrap root
12 filesystem.  It is just a simple wrapper around the standard
13 C<fakeroot> and C<fakechroot> commands.
14
15 If given, the C<CMD ...> is run inside the root filesystem.  The
16 command acts as if it was run as root and chrooted into the root
17 filesystem.
18
19 If the command is omitted, then we start a shell.
20
21 If C<CMD ...> could contain anything starting with a C<-> character
22 then use C<--> to separate C<febootstrap-run> parameters from the
23 command:
24
25  febootstrap-run ./f10 -- ls -l
26
27 =head1 OPTIONS
28
29 =over 4
30
31 =item B<--ro>
32
33 Usually any changes to permissions made by the command are recorded in
34 the C<fakeroot.log> file.  However if C<--ro> flag is given, then
35 changes to permissions are not recorded.  (Note: changes to file
36 contents still happen).
37
38 =back
39
40 =head1 EXAMPLES
41
42 One way to create a new file with specific ownership and permissions
43 from a script is to create new content for a file as C<root/file.new>:
44
45  #!/bin/bash
46
47  echo blah > root/file.new
48
49 then "install" it with the correct ownership and permissions.
50
51  febootstrap-run root -- install -m 0644 -o root -g root /file.new /file
52  rm root/file.new
53
54 (This requires that the C</usr/bin/install> command from coreutils
55 exists inside the root.)
56
57 Another way to do complex operations from a script is to export a
58 function:
59
60  #!/bin/bash
61
62  do_stuff ()
63  {
64      # complex operations inside the root
65  }
66  export -f do_stuff
67  febootstrap-run root -- bash -c do_stuff
68
69 =head1 ENVIRONMENT VARIABLES
70
71 Some L<fakechroot(1)> environment variables are applicable.  In
72 particular you may want to set:
73
74  export FAKECHROOT_EXCLUDE_PATH=/proc
75
76 =head1 SEE ALSO
77
78 L<febootstrap(8)>,
79 L<fakeroot(1)>,
80 L<fakechroot(1)>.
81
82 =head1 AUTHORS
83
84 Richard W.M. Jones <rjones @ redhat . com>
85
86 =head1 COPYRIGHT
87
88 (C) Copyright 2009 Red Hat Inc.,
89 L<http://et.redhat.com/~rjones/febootstrap>.
90
91 This program is free software; you can redistribute it and/or modify
92 it under the terms of the GNU General Public License as published by
93 the Free Software Foundation; either version 2 of the License, or
94 (at your option) any later version.
95
96 This program is distributed in the hope that it will be useful,
97 but WITHOUT ANY WARRANTY; without even the implied warranty of
98 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
99 GNU General Public License for more details.
100
101 You should have received a copy of the GNU General Public License
102 along with this program; if not, write to the Free Software
103 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.