You need to sign in or sign up before continuing.
Commit 1b885b3d authored by Michael Shigorin's avatar Michael Shigorin

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.
parent ea5ae29a
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
# FIXME: there should be less brutal i18n tuning # FIXME: there should be less brutal i18n tuning
cd /usr/share/locale cd /usr/share/locale
rm -r *@*
for i in */; do for i in */; do
case "$i" in case "$i" in
be*|en*|ru*|uk*) continue;; be*|en*|ru*|uk*) continue;;
......
#!/bin/sh
# remove all docs
rpmquery -ad |grep ^/ |xargs -r rm -f --
rm -rf /usr/share/{doc,man,info,license,gfxboot}
#!/bin/sh #!/bin/sh
# remove rpm, apt databases and cache # dump what's here by this point
find /var/lib/rpm /var/lib/apt /var/cache/apt -type f -delete 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
:
#!/bin/sh -x #!/bin/sh
# create a barebone bootable freedos floppy # create a barebone bootable freedos floppy
# TODO: some sub-framework to populate it as well # TODO: some sub-framework to populate it as well
......
...@@ -27,6 +27,4 @@ rpmquery -a cpp\* gcc\* perl-base file ipv6calc \ ...@@ -27,6 +27,4 @@ rpmquery -a cpp\* gcc\* perl-base file ipv6calc \
rpmquery -a bind-utils libbind \ rpmquery -a bind-utils libbind \
| xargs -r rpmi -e -- | 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 ...@@ -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/{wimax,wireless,mac80211}
rm -rf /lib/modules/*/kernel/net/x25 rm -rf /lib/modules/*/kernel/net/x25
rm -rf /lib/modules/*/kernel/sound 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* ...@@ -12,11 +12,14 @@ rm -f /usr/lib*/gconv/BIG5*
rm -f /usr/lib*/gconv/EBCDIC* rm -f /usr/lib*/gconv/EBCDIC*
# en_* variations # 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 # 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 -- xargs -r0 rm -rf --
# dangling symlinks # dangling symlinks
find /usr/lib*/locale \! -readable -delete find /usr/lib/locale \! -readable -delete
#!/bin/sh #!/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 # remove rpm, apt databases and cache
find /var/lib/rpm /var/lib/apt /var/cache/apt -type f -delete find /var/lib/rpm /var/lib/apt /var/cache/apt -type f -delete
:
#!/bin/sh -x #!/bin/sh
# * reset password for root # * reset password for root
# * add user `altlinux' (without password) # * add user `altlinux' (without password)
......
#!/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/*
:
#!/bin/sh -x #!/bin/sh
# postprocess isolinux configuration # postprocess isolinux configuration
# when the image sizes are finally known # when the image sizes are finally known
......
...@@ -14,7 +14,7 @@ cd /usr/share/X11/locale && rm -rf ja* ko* th* vi* zh* ...@@ -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 cd /usr/share/X11/xkb/symbols && rm -rf jp kr th vn cn
# locales # locales
cd /usr/lib*/locale && rm -rf ja_* ko_* th_* zh_* cd /usr/lib/locale && rm -rf ja_* ko_* th_* zh_*
# gconv # gconv
cd /usr/lib*/gconv && rm -f JIS* T* cd /usr/lib*/gconv && rm -f JIS* T*
......
#!/bin/sh
# outstanding binaries
rm -f /sbin/{sash,sln,tc}
rm -f /usr/bin/{openssl,ipv6log*}
rm -f /bin/ipv6calc
#!/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/
#!/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
#!/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
#!/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/*
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment