$rootfs_src is what we want to get timestamp and os_info, $rootfs_src is fixed formatted, $root can have several other format.
Signed-off-by: Xu Xijian hdxuxijian@163.com --- container/dracut-initrd/bin/set-local-sysroot.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/container/dracut-initrd/bin/set-local-sysroot.sh b/container/dracut-initrd/bin/set-local-sysroot.sh index 240551a..835bdd2 100644 --- a/container/dracut-initrd/bin/set-local-sysroot.sh +++ b/container/dracut-initrd/bin/set-local-sysroot.sh @@ -4,7 +4,7 @@ analyse_kernel_cmdline_params() { rootfs="$(getarg root=)" # example: $nfs_server_ip:/os/${os}/${os_arch}/${os_version}-snapshots/20210310005959 rootfs_src=$(echo $"$rootfs" | sed 's////') - timestamp="$(basename $root)" + timestamp="$(basename $rootfs_src)" os="$(echo $rootfs_src | awk -F '/|-' '{print $2}')" os_arch="$(echo $rootfs_src | awk -F '/|-' '{print $3}')" os_version="$(echo $rootfs_src | awk -F '/|-' '{print $4}')"