3 # (C) Copyright 2009 Red Hat Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 # Written by Richard W.M. Jones <rjones@redhat.com>
23 --long groupinstall:,group-install:,help,install: \
24 -n febootstrap -- "$@"`
26 echo "febootstrap: problem parsing the command line arguments"
37 echo "Usage: febootstrap [--options] REPO TARGET [MIRROR]"
38 echo "Please read febootstrap(8) man page for more information."
46 --groupinstall|--group-install)
56 echo "Internal error!"
61 if [ $# -lt 2 -o $# -gt 3 ]; then
70 # Architecture is currently always the same as the current arch. We
71 # cannot do --foreign builds. See discussion in the manpage.
74 # Create a temporary directory, make sure it gets cleaned up at the end.
79 rm -rf "$tmpdir" && exit $status
81 trap remove_tmpdir EXIT
83 # Create the temporary repository configuration. The name of the
84 # repository is always 'febootstrap'.
85 cat > $tmpdir/febootstrap.repo <<__EOF__
87 name=febootstrap $repo $arch
88 failovermethod=priority
93 # "Mirror" parameter is a bit misnamed, but it means a local mirror,
94 # instead of the public Fedora mirrors.
95 if [ -n "$mirror" ]; then
96 echo "baseurl=$mirror" >> "$tmpdir"/febootstrap.repo
98 echo "mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=$repo&arch=$arch" >> "$tmpdir"/febootstrap.repo
101 # Create the target filesystem.
105 # This is necessary to keep yum happy. It's not clear why yum can't
106 # just create this file itself.
107 mkdir -p "$target"/var/cache/yum/febootstrap/packages
109 yumargs="-y --disablerepo=* --enablerepo=febootstrap --noplugins --nogpgcheck"
111 # If we are root, then we don't need to run fakeroot and fakechroot.
112 if [ $(id -u) -eq 0 ]; then
114 -c "$tmpdir"/febootstrap.repo \
116 --installroot="$target" \
117 install "${packages[@]}"
119 fakeroot -s "$target"/fakeroot.log \
122 -c "$tmpdir"/febootstrap.repo \
124 --installroot="$target" \
125 install "${packages[@]}"