appliance: Don't hard-code febootstrap --exclude parameters.
authorRichard W.M. Jones <rjones@redhat.com>
Sun, 19 Dec 2010 10:56:06 +0000 (10:56 +0000)
committerRichard W.M. Jones <rjones@redhat.com>
Sun, 19 Dec 2010 10:57:06 +0000 (10:57 +0000)
Create a separate file 'excludelist.in' that contains these
regular expressions, and process it the same way as packagelist.in.

.gitignore
appliance/Makefile.am
appliance/excludelist.in [new file with mode: 0644]
appliance/make.sh.in
appliance/packagelist.in
configure.ac

index 4887c31..3fe4eb0 100644 (file)
@@ -2,6 +2,7 @@
 *.a
 ABOUT-NLS
 aclocal.m4
 *.a
 ABOUT-NLS
 aclocal.m4
+appliance/excludelist
 appliance/make.sh
 appliance/packagelist
 appliance/stamp-supermin
 appliance/make.sh
 appliance/packagelist
 appliance/stamp-supermin
index f1c2327..503160e 100644 (file)
@@ -19,6 +19,7 @@ include $(top_srcdir)/subdir-rules.mk
 
 EXTRA_DIST = \
        packagelist.in \
 
 EXTRA_DIST = \
        packagelist.in \
+       excludelist.in \
        init \
        make.sh.in
 
        init \
        make.sh.in
 
@@ -46,8 +47,13 @@ packagelist: packagelist.in
        grep -v '^[[:space:]]*$$' | grep -v '^#' > $@-t
        mv $@-t $@
 
        grep -v '^[[:space:]]*$$' | grep -v '^#' > $@-t
        mv $@-t $@
 
+excludelist: excludelist.in
+       cpp -undef -D$(DISTRO)=1 < $< | \
+       grep -v '^[[:space:]]*$$' | grep -v '^#' > $@-t
+       mv $@-t $@
+
 supermin.d/base.img supermin.d/hostfiles: stamp-supermin
 supermin.d/base.img supermin.d/hostfiles: stamp-supermin
-stamp-supermin: make.sh packagelist
+stamp-supermin: make.sh packagelist excludelist
        mkdir -p supermin.d
        rm -f $@ supermin.d/base.img supermin.d/hostfiles
        ./make.sh
        mkdir -p supermin.d
        rm -f $@ supermin.d/base.img supermin.d/hostfiles
        ./make.sh
@@ -70,7 +76,7 @@ supermin.d/init.img: init
 
 # Make clean.
 
 
 # Make clean.
 
-CLEANFILES = packagelist
+CLEANFILES = packagelist excludelist
 
 clean-local:
        rm -rf supermin.d
 
 clean-local:
        rm -rf supermin.d
diff --git a/appliance/excludelist.in b/appliance/excludelist.in
new file mode 100644 (file)
index 0000000..7e2abc2
--- /dev/null
@@ -0,0 +1,58 @@
+/* This is the list of distro packages which are
+ * excluded from the appliance, even if they appear in
+ * packagelist.in (or more likely, as dependencies of
+ * packages in packagelist.in).
+ *
+ * List is a list of basic regular expressions, one per line.
+ *
+ * This file is processed by cpp with one of the
+ * following symbols defined (depending on the distro):
+ *
+ *   REDHAT=1     For Fedora, RHEL, EPEL and workalikes.
+ *   DEBIAN=1     For Debian.
+ *   UBUNTU=1     For Ubuntu.
+ *   ARCHLINUX=1  For Archlinux.
+ *
+ * Note that any file provided by one of these packages will
+ * be dropped from the appliance.  Of course, this may break
+ * the appliance, so be careful.  Other files are also dropped
+ * from the appliance such as docs and man pages: see 'make.sh.in'
+ * for the full details.
+ */
+
+/* Basically the same with a few minor tweaks. */
+#ifdef UBUNTU
+#define DEBIAN 1
+#endif
+
+/* Don't need any Perl or Python appearing in the appliance. */
+^perl
+^python
+
+/* Plymouth is a graphical boot thing - not needed. */
+^plymouth
+
+/* Replacements for SysVinit.  We don't use ordinary init in the
+ * appliance.
+ */
+^upstart
+^systemd
+
+/* Linux firmware.  Note that febootstrap itself excludes the kernel
+ * which is also not needed since we get the kernel, modules etc
+ * from the host at appliance boot.
+ */
+^linux-firmware
+
+/* Keyboard maps - appliance is not interactive. */
+^kbd-misc
+
+#ifdef REDHAT
+^fedora-logos
+^redhat-logos
+^dracut
+#endif
+
+#ifdef DEBIAN
+^file-rc
+#endif
index 10609da..cb243b5 100755 (executable)
@@ -20,11 +20,12 @@ unset CDPATH
 
 set -e
 
 
 set -e
 
-# XXX Distro-dependent in future.
-excludes="--exclude ^perl --exclude ^python --exclude ^fedora-logos --exclude ^redhat-logos --exclude ^dracut --exclude ^upstart --exclude ^plymouth --exclude ^systemd --exclude ^linux-firmware --exclude ^kbd-misc"
-
-# For Debian:
-excludes="$excludes --exclude ^file-rc"
+# Turn excludelist file into command line arguments.
+exec 5<excludelist
+while read regexp <&5; do
+    excludes="$excludes --exclude $regexp"
+done
+exec 5<&-
 
 # Run febootstrap on the package list.
 if [ "x@FEBOOTSTRAP_YUM_CONFIG@" != "xno" ]; then
 
 # Run febootstrap on the package list.
 if [ "x@FEBOOTSTRAP_YUM_CONFIG@" != "xno" ]; then
index f479a9b..2562e59 100644 (file)
@@ -8,6 +8,9 @@
  *   DEBIAN=1     For Debian.
  *   UBUNTU=1     For Ubuntu.
  *   ARCHLINUX=1  For Archlinux.
  *   DEBIAN=1     For Debian.
  *   UBUNTU=1     For Ubuntu.
  *   ARCHLINUX=1  For Archlinux.
+ *
+ * There is also a list of packages which are excluded if they appear
+ * as dependencies of the packages below.  See: excludelist.in
  */
 
 /* Basically the same with a few minor tweaks. */
  */
 
 /* Basically the same with a few minor tweaks. */
index 2c37457..3df4c5b 100644 (file)
@@ -204,7 +204,8 @@ if test "x$enable_appliance" = "xyes"; then
     dnl
     dnl This used to be Very Important but is now just used to select
     dnl which packages to install in the appliance, since the package
     dnl
     dnl This used to be Very Important but is now just used to select
     dnl which packages to install in the appliance, since the package
-    dnl names vary slightly across distros.  (See appliance/packagelist.in)
+    dnl names vary slightly across distros.  (See
+    dnl appliance/packagelist.in and appliance/excludelist.in)
     AC_MSG_CHECKING([which Linux distro for package names])
     DISTRO=REDHAT
     if test -f /etc/debian_version; then
     AC_MSG_CHECKING([which Linux distro for package names])
     DISTRO=REDHAT
     if test -f /etc/debian_version; then