On Fri, Mar 05, 2021 at 04:59:54PM +0800, Yu Chuan wrote:
Signed-off-by: Yu Chuan 13186087857@163.com
distro/depends/install-iso-release | 2 ++ tests/install-iso-release | 53 +++++++++++++++++++++++++++++-
tests/install-iso-release => tests/install-iso-sync-rootfs
2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 distro/depends/install-iso-release
diff --git a/distro/depends/install-iso-release b/distro/depends/install-iso-release new file mode 100644 index 000000000000..2abb6b833291 --- /dev/null +++ b/distro/depends/install-iso-release @@ -0,0 +1,2 @@ +nfs-common +lvm2 diff --git a/tests/install-iso-release b/tests/install-iso-release index 23e8fbff8e4f..8c925ee2bcd8 100755 --- a/tests/install-iso-release +++ b/tests/install-iso-release @@ -7,6 +7,20 @@ set -e . $LKP_SRC/lib/debug.sh . $LKP_SRC/lib/log.sh
+SKIP_RELEASE_DIRS=(
- "srv"
- "opt"
- "mnt"
- "media"
- "home"
- "lost+found"
- "dev"
- "proc"
- "run"
- "sys"
- "var/log"
+)
check_params() { log_info "start check params" @@ -29,9 +43,46 @@ check_params() done }
+prepare_exclude_file() +{
- local exclude_file=$1
- rm -rf $exclude_file
- for i in "${SKIP_RELEASE_DIRS[@]}"
- do
echo $i >> $exclude_file
- done
+}
release_rootfs() {
- :
- # mount nfs rootfs
- local nfs_rootfs_mount_point=/tmp/nfs_rootfs_${ROOTFS_SUFFIX}
- mkdir -p ${nfs_rootfs_mount_point}
- mount -t nfs ${NFS_SERVER_HOST}:${NFS_ROOT_DIR}/${os}/${os_arch}/${os_version}-iso-${ROOTFS_SUFFIX} ${nfs_rootfs_mount_point} || die "mount nfs rootfs failed"
- # activate the lvm
- vgchange -ay
- # mount local logical volume
- local lv_rootfs_mount_point=/tmp/lv_rootfs_${ROOTFS_SUFFIX}
- 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"
- # release rootfs
comment => sync rootfs to nfs server
-------- Thanks, Xijian
- local exclude_file=/tmp/exclude_file_${ROOTFS_SUFFIX}
- prepare_exclude_file "$exclude_file"
- rsync -az ${lv_rootfs_mount_point}/. ${nfs_rootfs_mount_point} --exclude-from=$exclude_file || die "copy out rootfs failed"
- cd ${nfs_rootfs_mount_point} && mkdir -p "${SKIP_RELEASE_DIRS[@]}"
- # umount nfs rootfs
- umount $nfs_rootfs_mount_point || log_warn "umount failed: nfs_rootfs_mount_point"
- # umount local logical volume
- umount $lv_rootfs_mount_point || log_warn "umount failed: $lv_rootfs_mount_point"
}
main()
2.23.0