wash, rinse, repeat

install2 cleanups:

- functionally indifferent ones: particularly, install2/*/98system's
  "mkdir -p /image" was superfluous as it was done by that time already
  by sub.in/stage2/image-scripts.d/00stage1

- taken apart, prepared for tags: so far it's a mostly moot change
  since the installer cleanup scripts themselves are mostly the same as
  preceding 90cleanup was (with some additions corresponding to recent
  kernel development); it's still unclear what the mechanism for
  configuring the cleanups in effect will be, either directory/package
  regex lists or tagged scripts excluded from execution by yet another tag

fixes:

- image.in/Makefile: fix metadata related test; the actual test was
  assuming that stage1 kernel means installer, which is not the case
  since generic stage2 introduction; oh well

- 85cleanup-lowmem: a "_" too much was the culprit in destroying the
  needed translations along with those deemed superfluous; thanks go to
  Oleg Ivanov and Lenar Shakirov for finding the bug and proposing the
  fix altogether

additions:

- features.in/Makefile: reworked help target; it was rather inaccessible
  due to BUILDDIR normally undefined at the time of direct make
  invocation, and BUILDDIR is normally defined during normal builds
  anyways so let's try it this way.

- README++

daydreams:

- 01-genbasedir: we should drop bzip2 compressed pkglists some day
  but see genbasedir and apt-cdrom first, 90-pkg.sh (alterator-pkg)
  will fail miserably otherwise
This commit is contained in:
Michael Shigorin 2011-09-19 10:55:45 +03:00
parent b474bff468
commit 720a579690
16 changed files with 150 additions and 92 deletions

8
README
View File

@ -1,13 +1,15 @@
see also http://www.altlinux.org/Mkimage/Profiles/next
quickstart: make server-base.iso
(NB: requires configured http://en.altlinux.org/Hasher)
quickstart: make server-base.iso;
see http://en.altlinux.org/Hasher (and a large tmpfs)
configurables: ~/.mkimage/profiles.mk,
configurables: ~/.mkimage/profiles.mk;
see doc/profiles.mk.sample and libdistro.mk
license: GPLv2+, see COPYING
most docs in Russian, welcome to learn it or ask for English
Концепция:
- метапрофиль служит репозиторием для построения индивидуального
профиля, по которому создаётся итоговый дистрибутив

View File

@ -1,9 +1,9 @@
### sample ~/.mkimage/profiles.mk
# sample ~/.mkimage/profiles.mk
### where to look for apt.conf; system one used by default
# where to look for apt.conf; system one used by default
#APTCONF = ~/apt/apt.conf.$(ARCH)
### turns on GLOBAL_VERBOSE and prettier output
# turns on GLOBAL_VERBOSE and prettier output
#DEBUG = 1
# spares tmpfs, quite recommended unless you need raw workdir chroots

View File

@ -2,8 +2,16 @@
# (only regarding the needed subprofiles)
ifndef BUILDDIR
$(error BUILDDIR not defined)
endif
help all:
@echo "** BUILDDIR not defined; available features:"
@for dir in */; do \
echo -n "$$dir: "; \
grep -h '^use/' $$dir/config.mk \
| cut -f1 -d: \
| tr '\n' ' ' \
| sort -u; \
done
else
include $(BUILDDIR)/distcfg.mk
@ -69,8 +77,4 @@ all:
done
@find "$(BUILDDIR)/" -name '*~' \
| sed "s,$(BUILDDIR)/,** warning: file clash: ," >&2
# FIXME: drop or fix regarding undefined BUILDDIR being ok
#help:
# @echo "** available features:"
# @grep -h '^use/' */config.mk | fmt -sw"$$((COLUMNS>>1))" | column -t
endif

View File

@ -1,4 +1,5 @@
#!/bin/sh -efu
# create a postinstall script to drop temporarily needed packages
if [ -n "$GLOBAL_VERBOSE" ]; then
echo "** GLOBAL_CLEANUP_PACKAGES: $GLOBAL_CLEANUP_PACKAGES"

View File

@ -9,12 +9,10 @@ use/firmware/server: use/firmware
@$(call add,SYSTEM_PACKAGES,firmware-aic94xx-seq)
@$(call add,MAIN_PACKAGES_REGEXP,firmware-ql.*)
use/firmware/desktop: use/firmware
@$(call add,SYSTEM_PACKAGES,firmware-psb)
use/firmware/wireless: use/firmware
@$(call add,MAIN_PACKAGES,firmware-acx100)
@$(call add,MAIN_PACKAGES,firmware-i2400m)
@$(call add,MAIN_PACKAGES,firmware-carl9170)
@$(call add,MAIN_PACKAGES_REGEXP,firmware-ipw.*)
@$(call add,MAIN_PACKAGES_REGEXP,firmware-iwl.*)
@$(call add,MAIN_PACKAGES_REGEXP,firmware-rt.*)

View File

@ -2,5 +2,3 @@ use/hdt: use/syslinux use/memtest
@$(call add,FEATURES,hdt)
@$(call add,STAGE1_PACKAGES,pciids)
@$(call add,SYSLINUX_MODULES,hdt)
### moved to scripts.d/02-hdt along with compression
# @$(call add,SYSLINUX_FILES,/usr/share/misc/pci.ids)

View File

@ -1,7 +1,4 @@
#!/bin/sh
# stage1 needs this
mkdir -p /image
# setup stage2 as init
mv -f /usr/sbin/install2-init /sbin/init

View File

@ -0,0 +1,32 @@
#!/bin/sh
# purge anything unused during installation
rm -rf /usr/share/icons/{hicolor,large,mini}
# PAM plugins
rm -rf /lib*/security
rm -rf /usr/share/ca-certificates
rm -rf /usr/lib/qt4/plugins/codecs
rm -rf /usr/lib/qt4/plugins/bearer
rm -rf /usr/lib/qt4/plugins/inputmethods
rm -rf /usr/share/qt4/{doc,mkspecs,phrasebooks}
rm -rf /usr/share/guile/*/{*.txt,scripts}
rm -rf /usr/share/awk/
### could it be handled with any grace?
### TODO: x11vnc, xorg-xvfb: fix installer-common-stage2
rpmquery -a cpp\* gcc\* perl-base file ipv6calc \
bind-utils libbind \
gnupg libgcrypt libgnutls\* libgpg-error libsoup\* \
libGL glxinfo xdriinfo \
make make-initrd x11vnc xorg-xvfb \
| xargs -r rpmi -e --nodeps --
rpmquery -a bind-utils libbind \
| xargs -r rpmi -e --
# outstanding binaries
rm -f /sbin/{sln,tc}
rm -f /usr/bin/openssl

View 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}

View File

@ -1,64 +1,50 @@
#!/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 --
# drop extra drivers et al, purge kernel image(s)
# xorg modules
rm -r /usr/lib*/X11/modules/dri
# remove ogfs
rm -f /lib*/evms/*/ogfs*
# evms modules; see http://evms.sourceforge.net/user_guide/
rm -f /lib*/evms/*/{bbr,csm,drivelink,ogfs,replace,snapshot}*
# remove cpp, gcc and perl
rpmquery -a cpp\* gcc\* perl-base |
xargs -r rpmi -e --nodeps --
# remove unneeded kernel modules
# unneeded kernel modules
### some of these removals belong to a purge grade script
### TODO: mostly scsi-less and net-less cleanup for antique
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/bluetooth
rm -rf /lib/modules/*/kernel/drivers/char/{ipmi,hw_random,mwave,tpm}
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/gpio
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/leds
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/can
rm -rf /lib/modules/*/kernel/drivers/net/hamradio
rm -rf /lib/modules/*/kernel/drivers/net/irda
rm -rf /lib/modules/*/kernel/drivers/net/tokenring
rm -rf /lib/modules/*/kernel/drivers/net/wimax
rm -rf /lib/modules/*/kernel/drivers/net/wireless
rm -rf /lib/modules/*/kernel/drivers/net/wan
rm -rf /lib/modules/*/kernel/drivers/regulator
rm -rf /lib/modules/*/kernel/drivers/staging
rm -rf /lib/modules/*/kernel/drivers/spi
rm -rf /lib/modules/*/kernel/drivers/target
rm -rf /lib/modules/*/kernel/drivers/telephony
rm -rf /lib/modules/*/kernel/drivers/usb/{misc,mon}
rm -rf /lib/modules/*/kernel/drivers/tty/[^s][^e]*
rm -rf /lib/modules/*/kernel/drivers/usb/{atm,c67*,image,misc,mon,otg,serial,wusbcore}
rm -rf /lib/modules/*/kernel/drivers/usb/storage/ums*
rm -rf /lib/modules/*/kernel/drivers/uwb
rm -rf /lib/modules/*/kernel/drivers/w1
rm -rf /lib/modules/*/kernel/drivers/watchdog
rm -rf /lib/modules/*/kernel/fs/9p
rm -rf /lib/modules/*/kernel/fs/adfs
rm -rf /lib/modules/*/kernel/fs/affs
@ -68,12 +54,16 @@ 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/ceph
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/dlm
rm -rf /lib/modules/*/kernel/fs/efs
rm -rf /lib/modules/*/kernel/fs/exofs
rm -rf /lib/modules/*/kernel/fs/freevxfs
rm -rf /lib/modules/*/kernel/fs/fscache
rm -rf /lib/modules/*/kernel/fs/fuse
rm -rf /lib/modules/*/kernel/fs/hfs
rm -rf /lib/modules/*/kernel/fs/hfsplus
@ -81,18 +71,26 @@ 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/logfs
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/omfs
rm -rf /lib/modules/*/kernel/fs/qnx4
rm -rf /lib/modules/*/kernel/fs/romfs
rm -rf /lib/modules/*/kernel/fs/smbfs
rm -rf /lib/modules/*/kernel/fs/sysv
rm -rf /lib/modules/*/kernel/fs/ubifs
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/9p
rm -rf /lib/modules/*/kernel/net/appletalk
rm -rf /lib/modules/*/kernel/net/atm
rm -rf /lib/modules/*/kernel/net/ax25
rm -rf /lib/modules/*/kernel/net/can
rm -rf /lib/modules/*/kernel/net/ceph
rm -rf /lib/modules/*/kernel/net/bluetooth
rm -rf /lib/modules/*/kernel/net/dccp
rm -rf /lib/modules/*/kernel/net/decnet
@ -102,22 +100,24 @@ 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/rds
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/{wimax,wireless,mac80211}
rm -rf /lib/modules/*/kernel/net/x25
rm -rf /lib/modules/*/kernel/sound
# remove blacklisted kernel modules
# 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
# regenerate module dependencies
for i in /lib*/modules/*; do
/sbin/depmod -a -F /boot/System.map-${i##*/} ${i##*/}
/sbin/depmod -a -F /boot/System.map-${i##*/} ${i##*/}
done
# remove kernel images
# kernel images
rm -rf /boot/*

View File

@ -0,0 +1,22 @@
#!/bin/sh
# drop unused l10n/i18n data
# the fell swoop
find /usr/share/locale/ -type f \! -name 'alterator*' -delete
rm -rf /usr/share/zoneinfo/{posix,right}/
# charset conversion tables
### NB: BIG5* and friends should be handled consistently
rm -f /usr/lib*/gconv/IBM*
rm -f /usr/lib*/gconv/BIG5*
rm -f /usr/lib*/gconv/EBCDIC*
# en_* variations
rm -rf /usr/{lib*,share}/locale/en_[^U]*
# non-utf8 locales
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

View File

@ -7,8 +7,8 @@ cd /usr/share/fonts/bitmap/misc/ &&
# drop unneeded translation
# FIXME: whitelist is reasonable
cd /usr/share/qt4/translations/ &&
rm -f *_ar* *_cs* *_da* *_de* *_es* *_fr* \
*_gl* *_he* *_hu* *_pl* \
rm -f *_ar* *_cs* *_da* *_de* *_es* *_fa* *_fr* \
*_gl* *_he* *_hu* *_ko* *_pl* \
*_sk* *_sl* *_sv*
# ...l10n...
@ -20,23 +20,19 @@ cd /usr/share/X11/locale &&
cd /usr/share/X11/xkb/symbols &&
ls \
| egrep -v 'by|en|kz|pt|ru|ua|us|pc|....*' \
| xargs rm -rf
| xargs rm -rf --
# gconv
cd /usr/lib*/gconv &&
rm -f EUC* G* I*
# locales
cd /usr/lib*/locale &&
for dir in /usr/{lib*,share}/locale; do
cd "$dir" && \
ls \
| egrep -v '^(be|en|kk|pt|ru|uk)_' \
| xargs rm -rf
# remove kbd data
# FIXME: might break things?
#rm -rf /lib/kbd/
# outstanding binaries
rm /bin/ipv6calc /sbin/sln
| egrep -v '^be|en|kk|pt|ru|uk' \
| xargs rm -rf --;
done
### consider cleaning up kbd data (partially?)
:

View File

@ -1,8 +1,5 @@
#!/bin/sh
# stage1 needs this <-- FIXME: duplicated in sub.in/stage2/image-scripts.d/00propagator
#mkdir -p /image
# m-p-d::profiles/rescue/image-scripts.d/999system
mv -f -- /etc/inittab.rescue /etc/inittab

View File

@ -17,7 +17,6 @@ SUBDIRS = $(notdir $(SUBPROFILES))
# "main" subprofile needs genbasedir
CHROOT_PACKAGES = apt-utils
###
MKI_PACK_RESULTS = isoboot:$(IMAGENAME)
COPY_TREE = ./files
BOOT_TYPE = isolinux
@ -33,7 +32,8 @@ GLOBAL_HSH_APT_CONFIG = $(APTCONF)
endif
# Metadata/ needed only for installers (and not for e.g. syslinux.iso)
ifneq "$(STAGE1_KFLAVOUR)$(KFLAVOURS)" ""
### what about installable live?
ifneq (,$(findstring install2,$(FEATURES)))
METADATA = metadata
endif

View File

@ -17,12 +17,15 @@ comps="$(find -mindepth 1 -maxdepth 1 -type d -name 'RPMS.*' -printf '%f\n' |
verbose "comps=$comps"
[ -n "$comps" ] || exit 1
genbasedir \
--topdir="$WORKDIR" \
--architecture="$INFO_ARCH" \
--no-oldhashfile \
--partial \
--bz2only \
--xz \
--bz2 \
--create \
--notautomatic=false \
${INFO_NAME:+--archive="$INFO_NAME"} \
@ -31,4 +34,7 @@ genbasedir \
${INFO_LABEL:+--label="$INFO_LABEL"} \
ALTLinux $comps
### drop this when genbasedir is fixed (--no-uncompressed)
for comp in $comps; do rm -f base/{pkg,src}list.$comp; done
verbose finished

View File

@ -1,4 +1,4 @@
### Startup
# Startup
rootfiles
sysvinit
interactivesystem
@ -7,7 +7,7 @@ startup-rescue
udev
### Common
# Common
coreutils
glibc-locales
glibc-nss
@ -19,11 +19,11 @@ sysfsutils
sysklogd
util-linux
### CPU utils
# CPU utils
cpuburn
x86info
### Disk utils
# Disk utils
bonnie++
cfdisk
ddrescue
@ -43,7 +43,7 @@ testdisk
mtools
partimage
### Applications
# Applications
binutils
dmidecode
hexedit
@ -55,7 +55,7 @@ sharutils
time
openssl
### Applications/Archiving
# Applications/Archiving
arj
bzip2
gzip
@ -63,16 +63,16 @@ unrar
unzip
zip
### Applications/Editors
# Applications/Editors
vim-console
### Applications/File
# Applications/File
findutils
file
less
mtools
### Filesystem utils
# Filesystem utils
dosfstools
e2fsprogs
jfsprogs
@ -84,7 +84,7 @@ xfsprogs
btrfs-progs
ext3grep
### Applications/Networking
# Applications/Networking
arpwatch
elinks
hostinfo
@ -113,7 +113,7 @@ traceroute
wget
whois
### Applications/Shells
# Applications/Shells
zsh
ash
bash
@ -121,6 +121,6 @@ bc
gpm
mc
### Development/Debuggers
# Development/Debuggers
strace
sysstat