[PATCH lkp-tests] install-iso-sync-rootfs: delete cgz content for firstboot reboot

[Why] In install-iso-firstboot step, we put the reboot-after-systemd-logind.cgz to rootfs, so we need delete all file in that cgz before we archive the result rootfs. Signed-off-by: Yu Chuan <13186087857@163.com> --- distro/depends/install-iso-sync-rootfs | 1 + tests/install-iso-sync-rootfs | 28 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/distro/depends/install-iso-sync-rootfs b/distro/depends/install-iso-sync-rootfs index 2abb6b833291..41c472eda77e 100644 --- a/distro/depends/install-iso-sync-rootfs +++ b/distro/depends/install-iso-sync-rootfs @@ -1,2 +1,3 @@ nfs-common lvm2 +wget diff --git a/tests/install-iso-sync-rootfs b/tests/install-iso-sync-rootfs index b74c7bed2044..c2b64a2b44d8 100755 --- a/tests/install-iso-sync-rootfs +++ b/tests/install-iso-sync-rootfs @@ -53,6 +53,31 @@ prepare_exclude_file() done } +delete_firstboot_cgz() +{ + local cgz_url="http://${INITRD_HTTP_HOST}:${INITRD_HTTP_PORT}/initrd/custom_bootstrap/reboot-after-systemd-logind.cgz" + + local tmp_dir="/tmp/$(basename $cgz_url)_${ROOTFS_SUFFIX}" + rm -rf $tmp_dir && mkdir -p $tmp_dir && cd $tmp_dir + + wget $cgz_url || { + log_info "wget cgz failed, skip delete it: $cgz_url" + return 0 + } + + gzip -dc reboot-after-systemd-logind.cgz | cpio -id + + [ -d "custom_bootstrap" ] || { + log_info "cannot find custom_bootstrap dir after unzip" + return 0 + } + + for i in $(find custom_bootstrap/* -not -type d) + do + rm -f ${lv_rootfs_mount_point}/${i#custom_bootstrap/} + done +} + sync_rootfs_to_nfs_server() { # mount nfs rootfs @@ -70,6 +95,9 @@ sync_rootfs_to_nfs_server() mkdir -p ${lv_rootfs_mount_point} mount /dev/mapper/${VG_NAME}-${iso_os}_${iso_arch}_${iso_version}_${ROOTFS_SUFFIX} ${lv_rootfs_mount_point} || die "mount lv rootfs failed" + # delete cgz for firstboot reboot + delete_firstboot_cgz + # sync rootfs local exclude_file=/tmp/exclude_file_${ROOTFS_SUFFIX} -- 2.23.0
participants (1)
-
Yu Chuan