From f84d92d76f8713dff67a077e0a896ad5fa73995d Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Lallement Date: Wed, 30 Jan 2019 12:28:03 +0100 Subject: [PATCH] Calculate total size of the image + typos --- debian/tests/default-bootstraps | 2 +- live-build/auto/config | 44 ++++++++++++++++----------------- live-build/functions | 8 +++--- live-build/lb_binary_layered | 15 +++++++++-- live-build/lb_chroot_layered | 7 +++--- 5 files changed, 43 insertions(+), 33 deletions(-) diff --git a/debian/tests/default-bootstraps b/debian/tests/default-bootstraps index 3399932c..ea042caa 100755 --- a/debian/tests/default-bootstraps +++ b/debian/tests/default-bootstraps @@ -23,7 +23,7 @@ ALL_TRIPLETS=" lubuntu:: mythbuntu:: ubuntu:: - ubuntu:ubiquity-ng: + ubuntu:canary: ubuntu-base:: ubuntu-budgie:: ubuntu-budgie-desktop:: diff --git a/live-build/auto/config b/live-build/auto/config index c391eb14..0f7d2b0b 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -186,46 +186,46 @@ remove_package () } add_packages_from_seed_regexp () { - # Creates one or more passes, depending on base_pass_name, from any seeds matching seed_regexp. - # $1 base pass - # $2 seeds (regexp) + # Creates one or more passes, depending on base_pass_name, from any seeds matching seed_regexp. + # $1 base pass + # $2 seeds (regexp) local pass _check_immutable_passes_to_layers _check_layers_only_API "add_packages_from_seed_regexp" - for seed in $(ls config/germinate-output/|grep -P "$2"); do - pass=${1}.${seed} - _register_pass "$pass" - list_packages_from_seed ${seed} >> config/package-lists/livecd-rootfs.list.chroot_$pass - done + for seed in $(ls config/germinate-output/|grep -P "$2"); do + pass=${1}.${seed} + _register_pass "$pass" + list_packages_from_seed ${seed} >> config/package-lists/livecd-rootfs.list.chroot_$pass + done } remove_packages_from_seed_regexp() { - # Creates one or more passes, based on base_pass_name, from any seed matching seed_regexp. + # Creates one or more passes, based on base_pass_name, from any seed matching seed_regexp. # This package list is a list of packages to remove (and included in a previous dependent # pass then), resulting from base_seed - {current_seed_match_from_regexp}. - # $1 base pass - # $2 base seed - # $3 seeds to remove from base seed (regexp). If empty, a no- sublayer is generated. + # $1 base pass + # $2 base seed + # $3 seeds to remove from base seed (regexp). If empty, a no- sublayer is generated. local pass _check_immutable_passes_to_layers _check_layers_only_API "remove_packages_from_seed_regexp" - local seed_regexp="$3" - if [ -z "${seed_regexp}" ]; then + local seed_regexp="$3" + if [ -z "${seed_regexp}" ]; then pass="${1}.no-${2}" _register_pass "$pass" - subtract_package_lists ${2} "" >> config/package-lists/livecd-rootfs.removal-list.chroot_$pass - return - fi + subtract_package_lists ${2} "" >> config/package-lists/livecd-rootfs.removal-list.chroot_$pass + return + fi - for seed in $(ls config/germinate-output/|grep -P "$seed_regexp"); do - pass="${1}.${seed}" + for seed in $(ls config/germinate-output/|grep -P "$seed_regexp"); do + pass="${1}.${seed}" _register_pass "$pass" - subtract_package_lists ${2} ${seed} >> config/package-lists/livecd-rootfs.removal-list.chroot_$pass - done + subtract_package_lists ${2} ${seed} >> config/package-lists/livecd-rootfs.removal-list.chroot_$pass + done } add_chroot_hook () @@ -269,7 +269,7 @@ _get_live_passes () [ -z "$passes" ] && return for pass in $passes; do - if echo $pass | grep -Eq '\.live*'; then + if echo $pass | grep -Eq '\.live$'; then livepasses="$pass $livepasses" fi done diff --git a/live-build/functions b/live-build/functions index 30aaadff..4bf85af5 100644 --- a/live-build/functions +++ b/live-build/functions @@ -724,10 +724,10 @@ get_parent_pass () { } setenv_file () { - # Exposes an environment variable in a chroot - # $1 Name of the variable - # $2 Value of the variable - # $3 Path to the environment file of the chroot + # Exposes an environment variable in a chroot + # $1 Name of the variable + # $2 Value of the variable + # $3 Path to the environment file of the chroot local var="$1" local val="$2" local file="$3" diff --git a/live-build/lb_binary_layered b/live-build/lb_binary_layered index 91c64046..cf1837ed 100755 --- a/live-build/lb_binary_layered +++ b/live-build/lb_binary_layered @@ -96,7 +96,7 @@ build_layered_squashfs () { squashfs_f_size="${base}.size" du -B 1 -s "overlay.${pass}/" | cut -f1 > "${squashfs_f_size}" - # We take first live path for "global" ISO properties (used by installers and checkers): + # We take first live pass for "global" ISO properties (used by installers and checkers): # Prepare initrd + kernel # Main manifest and size files prefix="livecd.$PROJECT${SUBARCH:+-$SUBARCH}" @@ -104,7 +104,18 @@ build_layered_squashfs () { for livepass in $LIVE_PASSES; do [ "$livepass" != "$pass" ] && continue lb binary_linux-image ${*} - cp ${squashfs_f_size} "${prefix}.size" + + totalsize=$(cat ${squashfs_f_size}) + curpass="$pass" + while :; do + curpass=$(get_parent_pass $curpass) + # We climbed up the tree to the root layer, we are done + [ -z "$curpass" ] && break + + totalsize=$(expr $totalsize + $(cat "${PWD}/livecd.${PROJECT}.${curpass}.size")) + done + echo ${totalsize} > "${prefix}.size" + cp "${squashfs_f_manifest}.full" "${prefix}.manifest" break done diff --git a/live-build/lb_chroot_layered b/live-build/lb_chroot_layered index b1bf31fe..7f436528 100755 --- a/live-build/lb_chroot_layered +++ b/live-build/lb_chroot_layered @@ -8,7 +8,7 @@ ## under certain conditions; see COPYING for details. ## This is a fork of lb_chroot for layered live system. -## We don't want leaking host configuratino in each layer, and so, +## We don't want leaking host configuration in each layer, and so, ## we clean and setup the chroot each time. ## In addition, we create the squashfs for each layer, but top one (live) ## which still can be configured after lb chroot call. @@ -107,7 +107,7 @@ lb_chroot_includes () { } reduce_pass_size () { - # Remove duplicated files between parent and currant pass + # Remove duplicated files between parent and current pass # Note the empty directories created in a child pass are not removed local pass=$1 local parent="$(get_parent_pass $pass)" @@ -118,7 +118,7 @@ reduce_pass_size () { parent_pass_dir="overlay.${parent}" local list_pass=$(mktemp) - local list_parent=$(mktemp) + local list_parent=$(mktemp) (cd $pass_dir && find . ! -type d -printf "%h/%f|%s|%y|%U|%G|%m\n"|sort > $list_pass) (cd $parent_pass_dir && find . ! -type d -printf "%h/%f|%s|%y|%U|%G|%m\n"|sort > $list_parent) @@ -188,7 +188,6 @@ create_chroot_pass () { lb chroot_apt install ${*} # Note: this triggers an upgrade + dist-ugprade; which may impact sublayers with more # diff content than desired. So only running this on root pass. - # Also configure universe # Only configure universe on root passes if $(is_root_layer $pass); then lb chroot_archives chroot install ${*}