summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrjones <rjones>2009-03-20 11:49:22 +0000
committerrjones <rjones>2009-03-20 11:49:22 +0000
commitd89a55b4a3249e74602f9dc3cd26a8cca3370e7f (patch)
tree4059b45a9e0b068c71cb1ea31bdea2add22b97a8
parentb6ac87d195dc62d38315799487972d71f97971d7 (diff)
downloadfebootstrap-d89a55b4a3249e74602f9dc3cd26a8cca3370e7f.tar.gz
febootstrap-d89a55b4a3249e74602f9dc3cd26a8cca3370e7f.tar.xz
febootstrap-d89a55b4a3249e74602f9dc3cd26a8cca3370e7f.zip
More minimization (now 15.9 MB)
-rw-r--r--configure.ac2
-rw-r--r--febootstrap-minimize.pod48
-rwxr-xr-xfebootstrap-minimize.sh129
3 files changed, 158 insertions, 21 deletions
diff --git a/configure.ac b/configure.ac
index d47d668..65f2983 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,7 +17,7 @@ dnl Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
dnl
dnl Written by Richard W.M. Jones <rjones@redhat.com>
-AC_INIT(febootstrap,0.9)
+AC_INIT(febootstrap,1.0)
AM_INIT_AUTOMAKE
AC_CHECK_PROG(PERLDOC,[perldoc],[perldoc],[no])
diff --git a/febootstrap-minimize.pod b/febootstrap-minimize.pod
index 8d02d5d..56ecea9 100644
--- a/febootstrap-minimize.pod
+++ b/febootstrap-minimize.pod
@@ -57,13 +57,7 @@ Keep or drop locale support.
=item B<--drop-docs>
-Keep or drop documentation and man pages.
-
-=item B<--keep-yum-cache>
-
-=item B<--drop-yum-cache>
-
-Keep or drop the yum cache.
+Keep or drop documentation, man pages and info files.
=item B<--keep-cracklib>
@@ -83,6 +77,46 @@ Keep or drop C</usr/share/i18n>.
Keep or drop all timezones (except UTC which is never deleted).
+=item B<--keep-rpmdb>
+
+=item B<--drop-rpmdb>
+
+Keep or drop the RPM package database. Obviously RPM will be
+completely non-functional if you drop this.
+
+=item B<--keep-yum-cache>
+
+=item B<--drop-yum-cache>
+
+Keep or drop the yum cache. Note that L<febootstrap(8)> has already
+deleted this directory unless you ran it with the C<--no-clean>
+option.
+
+=item B<--keep-services>
+
+=item B<--drop-services>
+
+Keep or drop the C</etc/services> file. If dropped, this file is
+replaced with a very minimal one which just lists the most common
+services. For less common services you will have to refer to them by
+port number instead of name.
+
+=item B<--keep-sln>
+
+=item B<--drop-sln>
+
+Keep or drop C</sbin/sln> (statically linked C<ln>). This is not
+really required in minimal appliances.
+
+=item B<--keep-ldconfig>
+
+=item B<--drop-ldconfig>
+
+Keep or drop C</sbin/ldconfig>, C</etc/ld.so.cache> and
+C</var/cache/ldconfig> (the dynamic linking cache). This is not
+needed. Dynamic linking during program execution will be marginally
+slower.
+
=back
=head1 SEE ALSO
diff --git a/febootstrap-minimize.sh b/febootstrap-minimize.sh
index f39beaa..58b86fa 100755
--- a/febootstrap-minimize.sh
+++ b/febootstrap-minimize.sh
@@ -20,7 +20,7 @@
TEMP=`getopt \
-o '' \
- --long help,all,none,keep-locales,drop-locales,keep-docs,drop-docs,keep-yum-cache,drop-yum-cache,keep-cracklib,drop-cracklib,keep-i18n,drop-i18n,keep-zoneinfo,drop-zoneinfo \
+ --long help,all,none,keep-locales,drop-locales,keep-docs,drop-docs,keep-cracklib,drop-cracklib,keep-i18n,drop-i18n,keep-zoneinfo,drop-zoneinfo,keep-rpmdb,drop-rpmdb,keep-yum-cache,drop-yum-cache,keep-services,drop-services,keep-sln,drop-sln,keep-ldconfig,drop-ldconfig \
-n febootstrap-minimize -- "$@"`
if [ $? != 0 ]; then
echo "febootstrap-minimize: problem parsing the command line arguments"
@@ -32,20 +32,28 @@ set_all ()
{
keep_locales=no
keep_docs=no
-keep_yum_cache=no
keep_cracklib=no
keep_i18n=no
keep_zoneinfo=no
+ keep_rpmdb=no
+keep_yum_cache=no
+ keep_services=no
+ keep_sln=no
+ keep_ldconfig=no
}
set_none ()
{
keep_locales=yes
keep_docs=yes
-keep_yum_cache=yes
keep_cracklib=yes
keep_i18n=yes
keep_zoneinfo=yes
+ keep_rpmdb=yes
+keep_yum_cache=yes
+ keep_services=yes
+ keep_sln=yes
+ keep_ldconfig=yes
}
set_all
@@ -76,12 +84,6 @@ while true; do
--drop-docs)
keep_docs=no
shift;;
- --keep-yum-cache)
- keep_yum_cache=yes
- shift;;
- --drop-yum-cache)
- keep_yum_cache=no
- shift;;
--keep-cracklib)
keep_cracklib=yes
shift;;
@@ -100,6 +102,36 @@ while true; do
--drop-zoneinfo)
keep_zoneinfo=no
shift;;
+ --keep-rpmdb)
+ keep_rpmdb=yes
+ shift;;
+ --drop-rpmdb)
+ keep_rpmdb=no
+ shift;;
+ --keep-yum-cache)
+ keep_yum_cache=yes
+ shift;;
+ --drop-yum-cache)
+ keep_yum_cache=no
+ shift;;
+ --keep-services)
+ keep_services=yes
+ shift;;
+ --drop-services)
+ keep_services=no
+ shift;;
+ --keep-sln)
+ keep_sln=yes
+ shift;;
+ --drop-sln)
+ keep_sln=no
+ shift;;
+ --keep-ldconfig)
+ keep_ldconfig=yes
+ shift;;
+ --drop-ldconfig)
+ keep_ldconfig=no
+ shift;;
--help)
usage
exit 0;;
@@ -131,15 +163,15 @@ fi
if [ "$keep_locales" != "yes" ]; then
rm -f "$target"/usr/lib/locale/*
rm -rf "$target"/usr/share/locale
+ rm -rf "$target"/usr/lib*/gconv
+ rm -f "$target"/usr/bin/localedef
+ rm -f "$target"/usr/sbin/build-locale-archive
fi
if [ "$keep_docs" != "yes" ]; then
rm -rf "$target"/usr/share/man
rm -rf "$target"/usr/share/doc
-fi
-
-if [ "$keep_yum_cache" != "yes" ]; then
- rm -rf "$target"/var/cache/yum/*
+ rm -rf "$target"/usr/share/info
fi
if [ "$keep_cracklib" != "yes" ]; then
@@ -157,3 +189,74 @@ if [ "$keep_zoneinfo" != "yes" ]; then
mv "$target"/{UCT,UTC,Universal,Zulu,GMT*,*.tab} \
"$target"/usr/share/zoneinfo/
fi
+
+if [ "$keep_rpmdb" != "yes" ]; then
+ rm -rf "$target"/var/lib/rpm/*
+fi
+
+if [ "$keep_yum_cache" != "yes" ]; then
+ rm -rf "$target"/var/cache/yum/*
+fi
+
+if [ "$keep_services" != "yes" ]; then
+ rm -f "$target"/etc/services
+ cat > "$target"/etc/services <<'__EOF__'
+tcpmux 1/tcp
+tcpmux 1/udp
+echo 7/tcp
+echo 7/udp
+discard 9/tcp sink null
+discard 9/udp sink null
+ftp 21/tcp
+ftp 21/udp fsp fspd
+ssh 22/tcp
+ssh 22/udp
+telnet 23/tcp
+telnet 23/udp
+smtp 25/tcp mail
+smtp 25/udp mail
+time 37/tcp timserver
+time 37/udp timserver
+nameserver 42/tcp name
+nameserver 42/udp name
+domain 53/tcp
+domain 53/udp
+bootps 67/tcp
+bootps 67/udp
+bootpc 68/tcp dhcpc
+bootpc 68/udp dhcpc
+tftp 69/tcp
+tftp 69/udp
+finger 79/tcp
+finger 79/udp
+http 80/tcp www www-http
+http 80/udp www www-http
+http 80/sctp
+kerberos 88/tcp kerberos5 krb5
+kerberos 88/udp kerberos5 krb5
+pop3 110/tcp pop-3
+pop3 110/udp pop-3
+sunrpc 111/tcp portmapper rpcbind
+sunrpc 111/udp portmapper rpcbind
+auth 113/tcp authentication tap ident
+auth 113/udp authentication tap ident
+ntp 123/tcp
+ntp 123/udp
+imap 143/tcp imap2
+imap 143/udp imap2
+snmp 161/tcp
+snmp 161/udp
+snmptrap 162/tcp
+snmptrap 162/udp snmp-trap
+__EOF__
+fi
+
+if [ "$keep_sln" != "yes" ]; then
+ rm -f "$target"/sbin/sln
+fi
+
+if [ "$keep_ldconfig" != "yes" ]; then
+ rm -f "$target"/sbin/ldconfig
+ rm -f "$target"/etc/ld.so.cache
+ rm -rf "$target"/var/cache/ldconfig/*
+fi \ No newline at end of file