mkimage-profiles/sub.in/rescue/image-scripts.d/90cleanup
Michael Shigorin 0e57149de9 initial rescue image
NB: this implementation is awfully cut-n-paste one,
there are lots of common code with install2
which are subject to careful surgery
2011-11-04 16:15:30 +02:00

124 lines
4.0 KiB
Bash
Executable File

#!/bin/sh
# remove all docs
rpmquery -adl |grep ^/ |xargs -r rm -f --
rm -rf /usr/share/{doc,man,info,license,gfxboot}
# remove unused icons
rm -rf /usr/share/icons/{hicolor,large,mini}
# remove PAM plugins
rm -rf /lib*/security
# remove some unused files
rm -rf /usr/share/ca-certificates
rm -rf /usr/lib/qt4/plugins/codecs
rm -f /usr/lib*/gconv/IBM*
rm -f /usr/lib*/gconv/BIG5*
rm -f /usr/lib*/gconv/EBCDIC*
# remove unneeded timezones
rm -rf /usr/share/zoneinfo/{posix,right}/
# remove unneeded l10n
find /usr/share/locale/ -type f \! -name 'alterator*' -delete
# remove non-utf8 locales
find /usr/lib*/locale -mindepth 1 -maxdepth 1 -type d \! -name '*.utf8' -print0 |
xargs -r0 rm -rf --
# xorg modules
rm -r /usr/lib*/X11/modules/dri
# remove ogfs
rm -f /lib*/evms/*/ogfs*
# remove cpp, gcc and perl
rpmquery -a cpp\* gcc\* perl-base |
xargs -r rpmi -e --nodeps --
# remove unneeded kernel modules
rm -rf /lib/modules/*/kernel/arch
rm -rf /lib/modules/*/kernel/drivers/atm
rm -rf /lib/modules/*/kernel/drivers/char/ipmi
rm -rf /lib/modules/*/kernel/drivers/char/watchdog
rm -rf /lib/modules/*/kernel/drivers/cpufreq
rm -rf /lib/modules/*/kernel/drivers/edac
rm -rf /lib/modules/*/kernel/drivers/firmware ###
rm -rf /lib/modules/*/kernel/drivers/hwmon
rm -rf /lib/modules/*/kernel/drivers/infiniband ###
rm -rf /lib/modules/*/kernel/drivers/input/{gameport,joy*}
rm -rf /lib/modules/*/kernel/drivers/isdn
rm -rf /lib/modules/*/kernel/drivers/media
rm -rf /lib/modules/*/kernel/drivers/mmc
rm -rf /lib/modules/*/kernel/drivers/mtd*
rm -rf /lib/modules/*/kernel/drivers/net/irda
rm -rf /lib/modules/*/kernel/drivers/net/wireless
rm -rf /lib/modules/*/kernel/drivers/staging
rm -rf /lib/modules/*/kernel/drivers/spi
rm -rf /lib/modules/*/kernel/drivers/telephony
rm -rf /lib/modules/*/kernel/drivers/usb/{misc,mon}
rm -rf /lib/modules/*/kernel/drivers/w1
rm -rf /lib/modules/*/kernel/fs/9p
rm -rf /lib/modules/*/kernel/fs/adfs
rm -rf /lib/modules/*/kernel/fs/affs
rm -rf /lib/modules/*/kernel/fs/afs
rm -rf /lib/modules/*/kernel/fs/autofs
rm -rf /lib/modules/*/kernel/fs/autofs4
rm -rf /lib/modules/*/kernel/fs/befs
rm -rf /lib/modules/*/kernel/fs/bfs
rm -rf /lib/modules/*/kernel/fs/btrfs
rm -rf /lib/modules/*/kernel/fs/cifs
rm -rf /lib/modules/*/kernel/fs/coda
rm -rf /lib/modules/*/kernel/fs/configfs
rm -rf /lib/modules/*/kernel/fs/cramfs
rm -rf /lib/modules/*/kernel/fs/efs
rm -rf /lib/modules/*/kernel/fs/freevxfs
rm -rf /lib/modules/*/kernel/fs/fuse
rm -rf /lib/modules/*/kernel/fs/hfs
rm -rf /lib/modules/*/kernel/fs/hfsplus
rm -rf /lib/modules/*/kernel/fs/hpfs
rm -rf /lib/modules/*/kernel/fs/jffs
rm -rf /lib/modules/*/kernel/fs/jffs2
rm -rf /lib/modules/*/kernel/fs/lockd
rm -rf /lib/modules/*/kernel/fs/minix
rm -rf /lib/modules/*/kernel/fs/ncpfs
rm -rf /lib/modules/*/kernel/fs/nilfs2
rm -rf /lib/modules/*/kernel/fs/ocfs2
rm -rf /lib/modules/*/kernel/fs/qnx4
rm -rf /lib/modules/*/kernel/fs/smbfs
rm -rf /lib/modules/*/kernel/fs/sysv
rm -rf /lib/modules/*/kernel/fs/udf
rm -rf /lib/modules/*/kernel/fs/ufs
rm -rf /lib/modules/*/kernel/net/*/netfilter
rm -rf /lib/modules/*/kernel/net/appletalk
rm -rf /lib/modules/*/kernel/net/ax25
rm -rf /lib/modules/*/kernel/net/bluetooth
rm -rf /lib/modules/*/kernel/net/dccp
rm -rf /lib/modules/*/kernel/net/decnet
rm -rf /lib/modules/*/kernel/net/econet
rm -rf /lib/modules/*/kernel/net/ipv6
rm -rf /lib/modules/*/kernel/net/ipx
rm -rf /lib/modules/*/kernel/net/irda
rm -rf /lib/modules/*/kernel/net/netfilter
rm -rf /lib/modules/*/kernel/net/netrom
rm -rf /lib/modules/*/kernel/net/rose
rm -rf /lib/modules/*/kernel/net/sctp
rm -rf /lib/modules/*/kernel/net/tipc
rm -rf /lib/modules/*/kernel/net/x25
rm -rf /lib/modules/*/kernel/sound
# remove blacklisted kernel modules
sed -n 's/^blacklist[[:space:]]\+\([^[:space:]]\+\).*/\1/p' /etc/modprobe.d/* |
while read i; do
find /lib/modules/ -type f -name "$i.ko" -delete
done
# run depmod after kernel modules removal
for i in /lib*/modules/*; do
/sbin/depmod -a -F /boot/System.map-${i##*/} ${i##*/}
done
# remove kernel images
rm -rf /boot/*