cleanup scripts rehashed
There's much reason for reuse instead of duplication among the different stage2-based subprofiles. In particular, the rather monolithic driver cleanup script of the ancient is better done in several clear pieces with the final depmod run. Scripts dropping apt/rpm databases will dump pkglist first. A script purging /boot/* will honour live-install if present. Minor inno^Wfixups all over the map too.
This commit is contained in:
parent
ea5ae29ada
commit
1b885b3d24
@ -2,6 +2,7 @@
|
||||
# FIXME: there should be less brutal i18n tuning
|
||||
|
||||
cd /usr/share/locale
|
||||
rm -r *@*
|
||||
for i in */; do
|
||||
case "$i" in
|
||||
be*|en*|ru*|uk*) continue;;
|
||||
|
5
features.in/cleanup/live/image-scripts.d/90cleanup-docs
Executable file
5
features.in/cleanup/live/image-scripts.d/90cleanup-docs
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
# remove all docs
|
||||
|
||||
rpmquery -ad |grep ^/ |xargs -r rm -f --
|
||||
rm -rf /usr/share/{doc,man,info,license,gfxboot}
|
@ -1,3 +1,15 @@
|
||||
#!/bin/sh
|
||||
# remove rpm, apt databases and cache
|
||||
find /var/lib/rpm /var/lib/apt /var/cache/apt -type f -delete
|
||||
# dump what's here by this point
|
||||
echo "** live packages before rpmdb purge:"
|
||||
rpmquery -a --qf='%{NAME} %{VERSION}-%{RELEASE}\n'
|
||||
|
||||
# remove apt database and cache
|
||||
find /var/lib/apt /var/cache/apt -type f -delete
|
||||
|
||||
# not going to need them without rpmdb, it's not even rescue anymore
|
||||
rpm -e --nodeps apt libapt rpm librpmbuild librpm 2>/dev/null ||:
|
||||
|
||||
# finally, drop rpmdb
|
||||
find /var/lib/rpm -type f -delete
|
||||
|
||||
:
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/sh -x
|
||||
#!/bin/sh
|
||||
# create a barebone bootable freedos floppy
|
||||
# TODO: some sub-framework to populate it as well
|
||||
|
||||
|
@ -27,6 +27,4 @@ rpmquery -a cpp\* gcc\* perl-base file ipv6calc \
|
||||
rpmquery -a bind-utils libbind \
|
||||
| xargs -r rpmi -e --
|
||||
|
||||
# outstanding binaries
|
||||
rm -f /sbin/{sln,tc}
|
||||
rm -f /usr/bin/openssl
|
||||
:
|
||||
|
@ -107,17 +107,3 @@ rm -rf /lib/modules/*/kernel/net/tipc
|
||||
rm -rf /lib/modules/*/kernel/net/{wimax,wireless,mac80211}
|
||||
rm -rf /lib/modules/*/kernel/net/x25
|
||||
rm -rf /lib/modules/*/kernel/sound
|
||||
|
||||
# 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
|
||||
|
||||
# regenerate module dependencies
|
||||
for i in /lib*/modules/*; do
|
||||
/sbin/depmod -a -F /boot/System.map-${i##*/} ${i##*/}
|
||||
done
|
||||
|
||||
# kernel images
|
||||
rm -rf /boot/*
|
||||
|
@ -12,11 +12,14 @@ rm -f /usr/lib*/gconv/BIG5*
|
||||
rm -f /usr/lib*/gconv/EBCDIC*
|
||||
|
||||
# en_* variations
|
||||
rm -rf /usr/{lib*,share}/locale/en_[^U]*
|
||||
rm -rf /usr/{lib,share}/locale/en_[^U]*
|
||||
|
||||
# mods
|
||||
rm -rf /usr/{lib,share}/locale/*@*
|
||||
|
||||
# non-utf8 locales
|
||||
find /usr/lib*/locale -mindepth 1 -maxdepth 1 -type d \! -name '*.utf8' -print0 |
|
||||
find /usr/lib/locale -mindepth 1 -maxdepth 1 -type d \! -name '*.utf8' -print0 |
|
||||
xargs -r0 rm -rf --
|
||||
|
||||
# dangling symlinks
|
||||
find /usr/lib*/locale \! -readable -delete
|
||||
find /usr/lib/locale \! -readable -delete
|
||||
|
@ -1,3 +1,12 @@
|
||||
#!/bin/sh
|
||||
# dump what's here by this point
|
||||
echo "** install2 packages before rpmdb purge:"
|
||||
rpmquery -a --qf='%{NAME} %{VERSION}-%{RELEASE}\n'
|
||||
|
||||
# not going to need them without rpmdb, it's not even rescue anymore
|
||||
apt-get remove -f -y apt libapt
|
||||
|
||||
# remove rpm, apt databases and cache
|
||||
find /var/lib/rpm /var/lib/apt /var/cache/apt -type f -delete
|
||||
|
||||
:
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/sh -x
|
||||
#!/bin/sh
|
||||
# * reset password for root
|
||||
# * add user `altlinux' (without password)
|
||||
|
||||
|
@ -1,6 +0,0 @@
|
||||
#!/bin/sh
|
||||
# we don't really need the kernel in live root,
|
||||
# it's been booted already (unless it's a live-install)
|
||||
|
||||
rpm -q live-install || rm -f /boot/*
|
||||
:
|
@ -1,4 +1,4 @@
|
||||
#!/bin/sh -x
|
||||
#!/bin/sh
|
||||
# postprocess isolinux configuration
|
||||
# when the image sizes are finally known
|
||||
|
||||
|
@ -14,7 +14,7 @@ cd /usr/share/X11/locale && rm -rf ja* ko* th* vi* zh*
|
||||
cd /usr/share/X11/xkb/symbols && rm -rf jp kr th vn cn
|
||||
|
||||
# locales
|
||||
cd /usr/lib*/locale && rm -rf ja_* ko_* th_* zh_*
|
||||
cd /usr/lib/locale && rm -rf ja_* ko_* th_* zh_*
|
||||
|
||||
# gconv
|
||||
cd /usr/lib*/gconv && rm -f JIS* T*
|
||||
|
6
sub.in/stage2/image-scripts.d/90cleanup-bloat-bin
Executable file
6
sub.in/stage2/image-scripts.d/90cleanup-bloat-bin
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
# outstanding binaries
|
||||
|
||||
rm -f /sbin/{sash,sln,tc}
|
||||
rm -f /usr/bin/{openssl,ipv6log*}
|
||||
rm -f /bin/ipv6calc
|
5
sub.in/stage2/image-scripts.d/90cleanup-drm
Executable file
5
sub.in/stage2/image-scripts.d/90cleanup-drm
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
# no sense in xorg-dri-* without kernel-modules-drm*
|
||||
|
||||
stat /lib/modules/*/kernel/drivers/gpu/drm >&/dev/null \
|
||||
|| rm -rf /usr/lib*/X11/modules/dri/
|
7
sub.in/stage2/image-scripts.d/97cleanup-blacklisted
Executable file
7
sub.in/stage2/image-scripts.d/97cleanup-blacklisted
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
# 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
|
8
sub.in/stage2/image-scripts.d/98depmod
Executable file
8
sub.in/stage2/image-scripts.d/98depmod
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
# regenerate module dependencies after pruning kernel modules
|
||||
# (this script must run after anything touching /lib/modules)
|
||||
|
||||
cd /lib/modules
|
||||
for i in *.*; do
|
||||
depmod -a -F /boot/System.map-$i $i
|
||||
done
|
6
sub.in/stage2/image-scripts.d/99cleanup-boot
Executable file
6
sub.in/stage2/image-scripts.d/99cleanup-boot
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
# no need for the kernel in live root
|
||||
# (unless it's a live-install):
|
||||
# it's been booted already
|
||||
|
||||
[ -x /usr/sbin/live-install ] || rm -f /boot/*
|
Loading…
Reference in New Issue
Block a user