On Saturday 01 July 2006 17:53, Frans Pop wrote: > I've drawn some conclusions for myself based on this data, but am > curious what others think. Here's one of the ideas I had to reduce the current memory requirements of the installer. Instead of installing partman-crypto itself and all its dependencies, only install a "placeholder" udeb that contains just enough functionality to be able to show the basic options to the user (if the system has sufficient memory) and that pulls in the "real" partman-crypto (with its total of 2.5 MB of dependencies) only if the user actually selects it. The attached patch is untested, but I think it implements this idea. This does involve some code duplication, but the resulting partman-crypto-placeholder udeb is relatively so small that I feel it is worth it. Note: the patch is only meant as a proof of concept at the moment. This solution not only reduces the memory footprint of a basic installation, but only the udeb download for network based installs. Comments welcome.
Index: choose_method/crypto/choices =================================================================== --- choose_method/crypto/choices (revision 38567) +++ choose_method/crypto/choices (working copy) @@ -1,8 +1,5 @@ #!/bin/sh -. /lib/partman/definitions.sh -. /lib/partman/crypto_tools.sh - dev=$1 id=$2 Index: debian/control =================================================================== --- debian/control (revision 38567) +++ debian/control (working copy) @@ -1,10 +1,17 @@ Source: partman-crypto Section: debian-installer -Priority: standard +Priority: optional Maintainer: Debian Install System Team <debian-boot@lists.debian.org> Uploaders: Max Vozeler <xam@debian.org> Build-Depends: debhelper (>= 5.0.25), po-debconf (>= 0.5.0) +Package: partman-crypto-placeholder +XC-Package-Type: udeb +Architecture: all +Priority: standard +Depends: partman-base (>= 87), ${shlibs:Depends}, ${misc:Depends} +Description: Placeholder for partman-crypto to allow selection from partman's menu + Package: partman-crypto XC-Package-Type: udeb Architecture: any Index: debian/install-rc.placeholder =================================================================== --- debian/install-rc.placeholder (revision 0) +++ debian/install-rc.placeholder (revision 0) @@ -0,0 +1,21 @@ +#!/bin/sh + +set -e + +PACKAGE=$1 +shift +partman=debian/${PACKAGE}/lib/partman + +install -d $partman/$1 + +cp -r $1.placeholder/* $partman/$1/ + +if [ -f $partman/$1/_numbers ]; then + numbers=$(cat $partman/$1/_numbers) + rm $partman/$1/_numbers + echo "$numbers" | + while read number name; do + set -e + mv $partman/$1/$name $partman/$1/${number}${name} + done +fi Property changes on: debian/install-rc.placeholder ___________________________________________________________________ Name: svn:executable + * Index: debian/rules =================================================================== --- debian/rules (revision 38567) +++ debian/rules (working copy) @@ -29,6 +29,8 @@ dh_clean -k dh_install -p $(PACKAGE)-dm ciphers/dm-crypt lib/partman/ciphers dh_install -p $(PACKAGE)-loop ciphers/loop-AES lib/partman/ciphers + debian/install-rc.placeholder $(PACKAGE)-placeholder choose_partition + debian/install-rc.placeholder $(PACKAGE)-placeholder choose_method rm -rf `find debian/$(PACKAGE)-dm debian/$(PACKAGE)-loop -name .svn` install-arch: build @@ -51,6 +53,7 @@ binary-indep: install-indep dh_testdir dh_testroot + dh_installdebconf -i dh_fixperms -i dh_installdeb -i dh_gencontrol -i Index: debian/partman-crypto-placeholder.templates =================================================================== --- debian/partman-crypto-placeholder.templates (revision 0) +++ debian/partman-crypto-placeholder.templates (revision 0) @@ -0,0 +1,9 @@ +Template: partman/method_long/crypto_ph +Type: text +# File system name +# Keep translations short enough +_Description: physical volume for encryption + +Template: partman-crypto-placeholder/text/configure_crypto +Type: text +_Description: Configure encrypted volumes Index: debian/po/POTFILES.in =================================================================== --- debian/po/POTFILES.in (revision 38567) +++ debian/po/POTFILES.in (working copy) @@ -1 +1,2 @@ [type: gettext/rfc822deb] partman-crypto.templates +[type: gettext/rfc822deb] partman-crypto-placeholder.templates Index: choose_partition.placeholder/crypto/do_option =================================================================== --- choose_partition.placeholder/crypto/do_option (revision 0) +++ choose_partition.placeholder/crypto/do_option (revision 0) @@ -0,0 +1,16 @@ +#!/bin/sh + +anna-install partman-crypto + +if [ ! -f /lib/partman/crypto_tools.sh ]; then + exit 1 +fi + +. /lib/partman/definitions.sh +. /lib/partman/crypto_tools.sh + +crypto_check_setup || exit 1 + +confirm_changes "partman-crypto" || exit 0 + +crypto_setup yes || exit 1 Property changes on: choose_partition.placeholder/crypto/do_option ___________________________________________________________________ Name: svn:executable + * Index: choose_partition.placeholder/crypto/choices =================================================================== --- choose_partition.placeholder/crypto/choices (revision 0) +++ choose_partition.placeholder/crypto/choices (revision 0) @@ -0,0 +1,32 @@ +#!/bin/sh + +# Don't display if partman-crypto is installed +if [ -f /lib/partman/crypto_tools.sh ]; then + exit 0 +fi + +# TODO: add check for available memory; show error when not + +. /lib/partman/definitions.sh + +use_crypto=no + +for dev in $DEVICES/*; do + [ -d "$dev" ] || continue + cd $dev + open_dialog PARTITIONS + while { read_line num id size type fs path name; [ "$id" ]; }; do + if [ -f $id/method ]; then + method=$(cat $id/method) + if [ $method = "crypto" ]; then + use_crypto=yes + fi + fi + done + close_dialog +done + +if [ "$use_crypto" = yes ]; then + db_metaget partman-crypto-placeholder/text/configure_crypto description + printf "crypto\t%s\n" "$RET" +fi Property changes on: choose_partition.placeholder/crypto/choices ___________________________________________________________________ Name: svn:executable + * Index: choose_partition.placeholder/_numbers =================================================================== --- choose_partition.placeholder/_numbers (revision 0) +++ choose_partition.placeholder/_numbers (revision 0) @@ -0,0 +1 @@ +35 crypto Index: README =================================================================== --- README (revision 38567) +++ README (working copy) @@ -6,10 +6,20 @@ ------------------------------------------------------------------------ STATUS: - See http://wiki.debian.org/DebianInstaller/PartmanCrypto - and also TODO and BUGS in the source tree + See http://wiki.debian.org/DebianInstaller/PartmanCrypto + and also TODO and BUGS in the source tree ------------------------------------------------------------------------ + partman-crypto-placeholder + partman-crypto in total pulls in 2.5 MB in dependencies. The placeholder + udeb is an attempt to avoid increasing the memory requirements for all + installations by only really installing partman-crypto: + - if the system has sufficient memory + - the user actually chooses to use crypto + This means there is some code duplication: please make sure that + corresponding scripts are kept in sync! + +------------------------------------------------------------------------ The scripts do stuff more or less in the following order: 1. choose_method/crypto Index: choose_method.placeholder/crypto/do_option =================================================================== --- choose_method.placeholder/crypto/do_option (revision 0) +++ choose_method.placeholder/crypto/do_option (revision 0) @@ -0,0 +1,30 @@ +#!/bin/sh + +anna-install partman-crypto + +if [ ! -f /lib/partman/crypto_tools.sh ]; then + exit 1 +fi + +. /lib/partman/crypto_tools.sh + +type=$1 +dev=$2 +id=$3 +part=$dev/$id + +[ -d $part ] || mkdir $part +rm -f $part/use_filesystem +rm -f $part/format + +# Set defaults +if [ -d /lib/partman/ciphers/dm-crypt ]; then + echo dm-crypt > $part/crypto_type + crypto_set_defaults $part dm-crypt +elif [ -d /lib/partman/ciphers/loop-AES ]; then + echo loop-AES > $part/crypto_type + crypto_set_defaults $part loop-AES +else + exit 1 +fi +echo crypto > $part/method Property changes on: choose_method.placeholder/crypto/do_option ___________________________________________________________________ Name: svn:executable + * Index: choose_method.placeholder/crypto/choices =================================================================== --- choose_method.placeholder/crypto/choices (revision 0) +++ choose_method.placeholder/crypto/choices (revision 0) @@ -0,0 +1,21 @@ +#!/bin/sh + +# Don't display if partman-crypto is installed +if [ -f /lib/partman/crypto_tools.sh ]; then + exit 0 +fi + +# TODO: add check for available memory; show error when not + +dev=$1 +id=$2 + +cd $dev + +# don't show crypto for already encrypted partitions +if [ -f crypt_realdev ]; then + exit 0 +fi + +db_metaget partman/method_long/crypto_ph description +printf "%s\t%s\n" crypto "$RET" Property changes on: choose_method.placeholder/crypto/choices ___________________________________________________________________ Name: svn:executable + * Index: choose_method.placeholder/_numbers =================================================================== --- choose_method.placeholder/_numbers (revision 0) +++ choose_method.placeholder/_numbers (revision 0) @@ -0,0 +1 @@ +41 crypto
Attachment:
pgpzRF52boEBj.pgp
Description: PGP signature