cb243b55c6dfcf6bd5fda2f449d8ec55ce9e29e6
[libguestfs.git] / appliance / make.sh.in
1 #!/bin/bash -
2 # @configure_input@
3 # Copyright (C) 2009-2010 Red Hat Inc.
4 #
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.
9 #
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.
14 #
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.
18
19 unset CDPATH
20
21 set -e
22
23 # Turn excludelist file into command line arguments.
24 exec 5<excludelist
25 while read regexp <&5; do
26     excludes="$excludes --exclude $regexp"
27 done
28 exec 5<&-
29
30 # Run febootstrap on the package list.
31 if [ "x@FEBOOTSTRAP_YUM_CONFIG@" != "xno" ]; then
32     extra="--yum-config @FEBOOTSTRAP_YUM_CONFIG@"
33 fi
34
35 echo @FEBOOTSTRAP@ -v -o supermin.d --names $(< packagelist ) $excludes $extra
36 @FEBOOTSTRAP@ -v -o supermin.d --names $(< packagelist ) $excludes $extra
37
38 # Remove some things that we don't want in the appliance.  This is
39 # copied from the old febootstrap-minimize.  However minimization is
40 # not so important now that we are caching the appliance.
41 < supermin.d/hostfiles \
42 grep -v '^/usr/lib/locale' |
43 grep -v '^/usr/share/locale' |
44 grep -v '^/usr/lib/gconv' |
45 grep -v '^/usr/lib64/gconv' |
46 grep -v '^/usr/bin/localedef' |
47 grep -v '^/usr/sbin/build-locale-archive' |
48 grep -v '^/usr/share/man/' |
49 grep -v '^/usr/share/doc/' |
50 grep -v '^/usr/share/info/' |
51 grep -v '^/usr/share/gnome/help/' |
52 grep -v '^/usr/share/cracklib/' |
53 grep -v '^/usr/share/i18n/' > supermin.d/hostfiles-t
54
55 # XXX resolv.conf?  The old script had:
56 # echo nameserver 169.254.2.3 > resolv.conf
57 if ! grep -q /etc/resolv.conf supermin.d/hostfiles-t; then
58     echo /etc/resolv.conf >> supermin.d/hostfiles-t
59 fi
60
61 # Include any Augeas lenses from the host.
62 if grep -q /usr/share/augeas/lenses supermin.d/hostfiles-t; then
63     echo "/usr/share/augeas/lenses/*.aug" >> supermin.d/hostfiles-t
64 fi
65
66 mv supermin.d/hostfiles-t supermin.d/hostfiles