From e02268a95d0cde46d365209f712cb9ff75261fec Mon Sep 17 00:00:00 2001 From: Li Zhou Date: Tue, 21 Mar 2023 09:27:11 +0800 Subject: [PATCH] installer: inc number of digits in scripts' names The sections in kickstart cfg file are chopped up into scripts named with number increased. They are executed in the default sequence of 'ls' output, which aren't aligned with the number in names when the number in name is 10 and above. To make the scripts run in sequence according to their names, increase the number of digits in the names, so that 'ls' can list them in number sequence. Test plan: - PASS: Check about the installation log that "hook script"/"pre install script"/"post install script"/"post install nochroot script" run in right number sequence. - PASS: AIO-DX lib installation succeeds. Closes-bug: 2012447 Signed-off-by: Li Zhou Change-Id: I80801d4c53dbb1867028f64d9bf51a774b8e12e7 --- ...nc-number-of-digits-in-scripts-names.patch | 61 +++++++++++++++++++ ostree/initramfs-ostree/debian/patches/series | 1 + 2 files changed, 62 insertions(+) create mode 100644 ostree/initramfs-ostree/debian/patches/0012-installer-inc-number-of-digits-in-scripts-names.patch diff --git a/ostree/initramfs-ostree/debian/patches/0012-installer-inc-number-of-digits-in-scripts-names.patch b/ostree/initramfs-ostree/debian/patches/0012-installer-inc-number-of-digits-in-scripts-names.patch new file mode 100644 index 000000000..71c789ced --- /dev/null +++ b/ostree/initramfs-ostree/debian/patches/0012-installer-inc-number-of-digits-in-scripts-names.patch @@ -0,0 +1,61 @@ +From 3e3fa7363c871756f489b3b2eeb7472b98db0664 Mon Sep 17 00:00:00 2001 +From: Li Zhou +Date: Tue, 21 Mar 2023 14:39:57 +0800 +Subject: [PATCH] installer: inc number of digits in scripts' names + +The sections in kickstart cfg file are chopped up into scripts +named with number increased. +They are executed in the default sequence of 'ls' output, which +aren't aligned with the number in names when the number in name +is 10 and above. +To make the scripts run in sequence according to their names, +increase the number of digits in the names, so that 'ls' can list +them in number sequence. + +Signed-off-by: Li Zhou +--- + lat-installer.hook | 2 +- + lat-installer.sh | 6 +++--- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/lat-installer.hook b/lat-installer.hook +index 851e3f2..569519e 100755 +--- a/lat-installer.hook ++++ b/lat-installer.hook +@@ -49,7 +49,7 @@ ks_parse_hook() { + + # ${line} starts with ${key} + if [ "${line#${key}}" != "${line}" ]; then +- script="${script_dir}/${i}_script" ++ script="${script_dir}/$(printf "%02d" ${i})_script" + elif [ "${line::4}" = "%end" ]; then + chmod a+x ${script} + i=$((i+1)) +diff --git a/lat-installer.sh b/lat-installer.sh +index c4462ca..510897d 100755 +--- a/lat-installer.sh ++++ b/lat-installer.sh +@@ -402,7 +402,7 @@ ks_pre_script() { + [ "${line::1}" = "#" -o "${line::1}" = "" -o "${line::1}" = " " ] && continue + + if [ "${line::4}" = "%pre" ]; then +- script="${lat_pre_script}/${i}_script" ++ script="${lat_pre_script}/$(printf "%02d" ${i})_script" + local shebang=`expr "$line" : '.*--interpreter=\(.*\)[ $]'` + if [ -z "$shebang" ]; then + shebang="/bin/sh" +@@ -429,9 +429,9 @@ ks_post_script() { + if [ "${line::5}" = "%post" ]; then + local nochroot=`expr "$line" : '.* --\(nochroot\)'` + if [ "$nochroot" = "nochroot" ]; then +- script="${lat_post_nochroot_script}/${i}_script" ++ script="${lat_post_nochroot_script}/$(printf "%02d" ${i})_script" + else +- script="${lat_post_script}/${i}_script" ++ script="${lat_post_script}/$(printf "%02d" ${i})_script" + fi + + local shebang=`expr "$line" : '.*--interpreter=\(.*\)[ $]'` +-- +2.25.1 + diff --git a/ostree/initramfs-ostree/debian/patches/series b/ostree/initramfs-ostree/debian/patches/series index 090d0a938..afb723d7c 100644 --- a/ostree/initramfs-ostree/debian/patches/series +++ b/ostree/initramfs-ostree/debian/patches/series @@ -9,3 +9,4 @@ 0009-Allow-specifying-var-device-for-installs.patch 0010-Add-Installer-and-Init-Multipath-support.patch 0011-Add-H-W-Settle-time-to-installer-init.patch +0012-installer-inc-number-of-digits-in-scripts-names.patch