initial features.in/cleanup

This is a sort of anti-feature which removes and not builds;
still with mkimage-profiles' approach we can at least build
up the removal procedures as well.

It's what triggered the tagged scripts, BTW.
This commit is contained in:
Michael Shigorin 2011-09-13 19:39:31 +03:00
parent f32b8d4f6e
commit c5bf0529bc
7 changed files with 56 additions and 6 deletions

View File

@ -26,7 +26,7 @@ distro/syslinux: distro/.init distro/.branding sub/stage1 \
use/syslinux/ui-vesamenu use/hdt use/memtest use/dos
# $(VAR) will be substituted before writing them to $(CONFIG);
# $$(VAR) will remain unsubstituted util $(CONFIG) is included
# $$(VAR) will remain unsubstituted until $(CONFIG) is included
# and their value requested (so the variable referenced
# can change its value during configuration _before_
# it's actually used); just peek inside $(CONFIG) ;-)
@ -50,7 +50,7 @@ distro/server-base: distro/installer sub/main \
use/syslinux/ui-menu use/memtest use/bootloader/grub
@$(call add,BASE_LISTS,server-base)
distro/server-mini: distro/server-base
distro/server-mini: distro/server-base use/cleanup/x11-alterator
@$(call set,KFLAVOURS,el-smp)
@$(call add,KMODULES,e1000e igb)
@$(call add,BASE_LISTS,\
@ -78,7 +78,8 @@ distro/desktop-base: distro/installer sub/main \
distro/icewm: distro/desktop-base \
use/lowmem use/x11/xdm use/x11/runlevel5 \
use/bootloader/lilo use/powerbutton/acpi
use/bootloader/lilo use/powerbutton/acpi \
use/cleanup/alterator
@$(call add,BASE_LISTS,$(call tags,icewm desktop))
# NB: if there are too many screens above, it might make sense to distro.d/

View File

@ -0,0 +1,6 @@
Эта фича вместо созидания занимается выкидыванием лишнего
(например, части модулей инсталятора из установленной системы).
По возможности стоит работать над дизайном инфраструктуры
и пакетной базой так, чтобы ставить-удалять приходилось как
можно меньше. В идеале такой антифичи не должно быть вовсе :)

View File

@ -0,0 +1,19 @@
use/cleanup:
@$(call add,FEATURES,cleanup)
use/cleanup/installer: use/cleanup
@$(call add,CLEANUP_PACKAGES,'installer-*')
use/cleanup/x11: use/cleanup
@$(call add,CLEANUP_PACKAGES,libSM libXext libXmu libXi)
# as some alterator modules are installed into stage3 (the destination
# root filesystem) to perform actions like bootloader setup, we might
# have to remove them (contrary to the usual build-up)...
use/cleanup/alterator: use/cleanup
@$(call add,CLEANUP_PACKAGES,'alterator*' rpm-macros-alterator)
@$(call add,CLEANUP_PACKAGES,'guile*' libvhttpd)
# for lightweight server distros
use/cleanup/x11-alterator: use/cleanup/x11 use/cleanup/alterator
@$(call add,CLEANUP_PACKAGES,libmng qt4-common)

View File

@ -0,0 +1,20 @@
#!/bin/sh -efu
if [ -n "$GLOBAL_VERBOSE" ]; then
echo "** GLOBAL_CLEANUP_PACKAGES: $GLOBAL_CLEANUP_PACKAGES"
fi >&2
SCRIPT="/usr/share/install2/postinstall.d/01+install2+cleanup"
cat > "$SCRIPT" << EOF
#!/bin/sh -efu
. install2-init-functions
# don't override the script start message on the same line
echo "removing $GLOBAL_CLEANUP_PACKAGES"
# remove extra packages from installed system
list="\$(exec_chroot rpmquery -a --qf='%{NAME}\\n' $GLOBAL_CLEANUP_PACKAGES)"
[ -z "\$list" ] || exec_chroot apt-get remove -f -y -- \$list
EOF
chmod +x "$SCRIPT"

View File

@ -1,4 +1,4 @@
use/install2: use/stage2 sub/stage2/install2
use/install2: use/stage2 sub/stage2/install2 use/cleanup/installer
@$(call add,FEATURES,install2)
@$(call set,INSTALL2_PACKAGES,installer-distro-$$(INSTALLER)-stage2)
@$(call add,INSTALL2_PACKAGES,branding-$$(BRANDING)-alterator)

View File

@ -11,3 +11,4 @@ HSH_EXCLUDE_DOCS = 1
debug:
@echo "** install2: IMAGE_PACKAGES: $(IMAGE_PACKAGES)"
@echo "** install2: IMAGE_PACKAGES_REGEXP: $(IMAGE_PACKAGES_REGEXP)"
@echo "** install2: CLEANUP_PACKAGES: $(CLEANUP_PACKAGES)"

View File

@ -36,8 +36,11 @@ IMAGE_PACKAGES_REGEXP = $(call kpackages,$(STAGE1_KMODULES),$(STAGE1_KFLAVOUR))
include $(MKIMAGE_PREFIX)/targets.mk
# NB: it's a collector variable, add()ing to a GLOBAL_ results in lost hair
GLOBAL_CLEANUP_PACKAGES := $(CLEANUP_PACKAGES)
all: | $(GLOBAL_DEBUG) build-image run-image-scripts pack-image \
$(GLOBAL_CLEAN_WORKDIR)
debug:
@echo "stage2: warning: dummy debug target not redefined"
# dummy
debug: ;