On Mon, Apr 26, 2021 at 04:47:12PM +0800, Liu Yinsi wrote:
the default os_mount=initramfs, so download osimage to run qemu kvm.
Signed-off-by: Liu Yinsi liuyinsi@163.com
sbin/download-rootfs | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-)
diff --git a/sbin/download-rootfs b/sbin/download-rootfs index 68a68039..4edd1952 100755 --- a/sbin/download-rootfs +++ b/sbin/download-rootfs @@ -18,23 +18,36 @@ os_version=${3:-20.03}
load_cci_defaults
-rootfs_dir=/srv/os/${os}/${os_arch}/${os_version} +rootfs_dir="/srv/os/${os}/${os_arch}/${os_version}" +osimage_dir="/srv/initrd/osimage/${os}/${os_arch}/${os_version}"
-download_os_rootfs() -{
mkdir -p $rootfs_dir
cd $rootfs_dir
+mkdir -p $rootfs_dir $osimage_dir
download_url="http://api.compass-ci.openeuler.org:${SRV_HTTP_OS_PORT}/os/${os}/${os_arch}/${os_version}.cgz"
wget $download_url
+wget_download() +{
- local download_url=$1
- wget $download_url || {
log_error "failed to download os rootfs: $download_url"
"failed to download file: $download_url" may be better.
Thanks, Xueliang
exit 1
- }
+}
[ "$?" -ne 0 ] && {
log_error "failed to download os rootfs: $download_url"
exit 1
}
+download_os_rootfs() +{
- cd $rootfs_dir && {
wget_download "http://api.compass-ci.openeuler.org:${SRV_HTTP_OS_PORT}/os/${os}/${os_arch}/${os_version}.cgz"
gzip -dc ${os_version}.cgz | cpio -id
rm -rf ${os_version}.cgz
- }
+}
gzip -dc ${os_version}.cgz | cpio -id
rm -rf ${os_version}.cgz
+download_osimage() +{
- cd $osimage_dir && {
wget_download "http://api.compass-ci.openeuler.org:${SRV_HTTP_INITRD_PORT}/initrd/osimage/${os}/${os_arch}/${os_version}/current"
wget_download "http://api.compass-ci.openeuler.org:${SRV_HTTP_INITRD_PORT}/initrd/deps/nfs/debian/aarch64/sid/run-ipconfig.cgz"
- }
}
is_virtual() @@ -42,4 +55,4 @@ is_virtual() dmidecode -s system-product-name | grep -iq "virtual" }
-is_virtual || download_os_rootfs
+is_virtual || ( download_os_rootfs && download_osimage )
2.23.0