For locally deploy compass-ci, download os rootfs to run qemu test, the default download os rootfs is openeuler aarch64 20.03, user can also use this script to download other os rootfs if they need.
Signed-off-by: Liu Yinsi liuyinsi@163.com --- sbin/download-rootfs | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 sbin/download-rootfs
diff --git a/sbin/download-rootfs b/sbin/download-rootfs new file mode 100755 index 0000000..208ac7d --- /dev/null +++ b/sbin/download-rootfs @@ -0,0 +1,40 @@ +#!/bin/bash +# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved. + +# download os rootfs. +# 1. download default os rootfs openeuler aarch64 20.03 +# example usage: +# ./download-rootfs +# 2. download os rootfs you want by add params $os, $os_arch, $os_version. +# example usage: +# ./download-rootfs debian aarch64 sid + +os=${1:-openeuler} +os_arch=${2:-aarch64} +os_version=${3:-20.03} + +. ${CCI_SRC}/container/defconfig.sh +. ${CCI_SRC}/lib/log.sh + +load_cci_defaults + +rootfs_dir=${os}/${os_arch}/${os_version} + +download_os_rootfs() +{ + mkdir -p /srv/os/${rootfs_dir} + cd /srv/os/$rootfs_dir + + download_url="http://api.compass-ci.openeuler.org:$%7BSRV_HTTP_PORT%7D/os/$%7Brootfs_dir%7..." + wget $download_url + + [ "$?" -ne 0 ] && { + log_error "failed to download os rootfs: $download_url" + exit 1 + } + + gzip -dc ${os_version}.cgz | cpio -id + rm -rf ${os_version}.cgz +} + +download_os_rootfs
+load_cci_defaults
+rootfs_dir=${os}/${os_arch}/${os_version}
+download_os_rootfs() +{
mkdir -p /srv/os/${rootfs_dir}
cd /srv/os/$rootfs_dir
download_url="http://api.compass-ci.openeuler.org:${SRV_HTTP_PORT}/os/${rootfs_dir}.cgz"
wget $download_url
variable download_url is redundant, just use: wget 'http://xxxxx'
Thanks, Luan Shengde
[ "$?" -ne 0 ] && {
log_error "failed to download os rootfs: $download_url"
exit 1
}
gzip -dc ${os_version}.cgz | cpio -id
rm -rf ${os_version}.cgz
+}
+download_os_rootfs
2.23.0
cd /srv/os/$rootfs_dir
download_url="http://api.compass-ci.openeuler.org:${SRV_HTTP_PORT}/os/${rootfs_dir}.cgz"
wget $download_url
variable download_url is redundant, just use: wget 'http://xxxxx'
no, download_url will use twice, variable download_url is necessary
Thanks, Yinsi
Thanks, Luan Shengde
[ "$?" -ne 0 ] && {
log_error "failed to download os rootfs: $download_url"
exit 1
}
gzip -dc ${os_version}.cgz | cpio -id
rm -rf ${os_version}.cgz
+}
+download_os_rootfs
2.23.0
+download_os_rootfs() +{
mkdir -p /srv/os/${rootfs_dir}
cd /srv/os/$rootfs_dir
download_url="http://api.compass-ci.openeuler.org:${SRV_HTTP_PORT}/os/${rootfs_dir}.cgz"
wget $download_url
[ "$?" -ne 0 ] && {
log_error "failed to download os rootfs: $download_url"
exit 1
}
gzip -dc ${os_version}.cgz | cpio -id
rm -rf ${os_version}.cgz
the file download with wget is $os_version.cgz? I think it's better add '-O filename' to specified the filename for the wget command.
Thanks, Luan Shengde
+}
+download_os_rootfs
2.23.0
gzip -dc ${os_version}.cgz | cpio -id
rm -rf ${os_version}.cgz
the file download with wget is $os_version.cgz?
yes,
I think it's better add '-O filename' to specified the filename for the wget command.
unnecessary
Thanks, Yinsi
Thanks, Luan Shengde
+}
+download_os_rootfs
2.23.0
On Tue, Feb 02, 2021 at 10:16:28AM +0800, Liu Yinsi wrote:
For locally deploy compass-ci, download os rootfs to run qemu test, the default download os rootfs is openeuler aarch64 20.03, user can also use this script to download other os rootfs if they need.
Signed-off-by: Liu Yinsi liuyinsi@163.com
sbin/download-rootfs | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 sbin/download-rootfs
diff --git a/sbin/download-rootfs b/sbin/download-rootfs new file mode 100755 index 0000000..208ac7d --- /dev/null +++ b/sbin/download-rootfs @@ -0,0 +1,40 @@ +#!/bin/bash +# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+# download os rootfs. +# 1. download default os rootfs openeuler aarch64 20.03 +# example usage: +# ./download-rootfs +# 2. download os rootfs you want by add params $os, $os_arch, $os_version. +# example usage: +# ./download-rootfs debian aarch64 sid
+os=${1:-openeuler} +os_arch=${2:-aarch64} +os_version=${3:-20.03}
+. ${CCI_SRC}/container/defconfig.sh +. ${CCI_SRC}/lib/log.sh
+load_cci_defaults
+rootfs_dir=${os}/${os_arch}/${os_version}
the path is fixed rootfs_dir=/srv/os/${os}/${os_arch}/${os_version} mkdir -p rootfs_dir
+download_os_rootfs() +{
mkdir -p /srv/os/${rootfs_dir}
cd /srv/os/$rootfs_dir
download_url="http://api.compass-ci.openeuler.org:${SRV_HTTP_PORT}/os/${rootfs_dir}.cgz"
no need download use url directly?
wget $download_url
wget --timestamping --progress=bar:force $url
Thanks, Shenwei
[ "$?" -ne 0 ] && {
log_error "failed to download os rootfs: $download_url"
exit 1
}
gzip -dc ${os_version}.cgz | cpio -id
rm -rf ${os_version}.cgz
+}
+download_os_rootfs
2.23.0
+rootfs_dir=${os}/${os_arch}/${os_version}
the path is fixed rootfs_dir=/srv/os/${os}/${os_arch}/${os_version} mkdir -p rootfs_dir
ok
+download_os_rootfs() +{
mkdir -p /srv/os/${rootfs_dir}
cd /srv/os/$rootfs_dir
download_url="http://api.compass-ci.openeuler.org:${SRV_HTTP_PORT}/os/${rootfs_dir}.cgz"
no need download use url directly?
no, here will use url also: log_error "failed to download os rootfs: $download_url"
wget $download_url
wget --timestamping --progress=bar:force $url
uncecessary, os rootfs no need to download repeated download.
Thanks, Yinsi
Thanks, Shenwei
[ "$?" -ne 0 ] && {
exit 1
}
gzip -dc ${os_version}.cgz | cpio -id
rm -rf ${os_version}.cgz
+}
+download_os_rootfs
2.23.0
On Tue, Feb 02, 2021 at 10:16:28AM +0800, Liu Yinsi wrote:
For locally deploy compass-ci, download os rootfs to run qemu test, the default download os rootfs is openeuler aarch64 20.03, user can also use this script to download other os rootfs if they need.
Signed-off-by: Liu Yinsi liuyinsi@163.com
sbin/download-rootfs | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 sbin/download-rootfs
diff --git a/sbin/download-rootfs b/sbin/download-rootfs new file mode 100755 index 0000000..208ac7d --- /dev/null +++ b/sbin/download-rootfs @@ -0,0 +1,40 @@ +#!/bin/bash +# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+# download os rootfs. +# 1. download default os rootfs openeuler aarch64 20.03 +# example usage: +# ./download-rootfs +# 2. download os rootfs you want by add params $os, $os_arch, $os_version. +# example usage: +# ./download-rootfs debian aarch64 sid
+os=${1:-openeuler} +os_arch=${2:-aarch64} +os_version=${3:-20.03}
+. ${CCI_SRC}/container/defconfig.sh +. ${CCI_SRC}/lib/log.sh
+load_cci_defaults
+rootfs_dir=${os}/${os_arch}/${os_version}
+download_os_rootfs() +{
mkdir -p /srv/os/${rootfs_dir}
cd /srv/os/$rootfs_dir
download_url="http://api.compass-ci.openeuler.org:${SRV_HTTP_PORT}/os/${rootfs_dir}.cgz"
wget $download_url
wget -qc $download_url
-q, --quiet quiet (no output) -c, --continue resume getting a partially-downloaded file
[ "$?" -ne 0 ] && {
log_error "failed to download os rootfs: $download_url"
exit 1
}
gzip -dc ${os_version}.cgz | cpio -id
cpio --quiet -id
Thanks, Jiaxin
rm -rf ${os_version}.cgz
+}
+download_os_rootfs
2.23.0
cd /srv/os/$rootfs_dir
download_url="http://api.compass-ci.openeuler.org:${SRV_HTTP_PORT}/os/${rootfs_dir}.cgz"
wget $download_url
wget -qc $download_url
unnecessary
Thanks, Yinsi
-q, --quiet quiet (no output) -c, --continue resume getting a partially-downloaded file
[ "$?" -ne 0 ] && {
log_error "failed to download os rootfs: $download_url"
exit 1
}
gzip -dc ${os_version}.cgz | cpio -id
cpio --quiet -id
Thanks, Jiaxin
rm -rf ${os_version}.cgz
+}
+download_os_rootfs
2.23.0