From 19d266850364944b4aa39cb0c9cba2cc427bb70d Mon Sep 17 00:00:00 2001 From: wangchuanguo Date: Tue, 29 Aug 2023 09:52:26 +0800 Subject: [PATCH] support other repos for creating qcow2 Signed-off-by: wangchuanguo --- create-qcow2.sh | 12 ++++++++++++ qcow2.conf | 6 ++++++ qcow2.ks | 3 +++ 3 files changed, 21 insertions(+) diff --git a/create-qcow2.sh b/create-qcow2.sh index 1dfc319..42263bc 100755 --- a/create-qcow2.sh +++ b/create-qcow2.sh @@ -164,6 +164,18 @@ echo "BASEOS_REPO:$BASEOS_REPO" echo "APPSTREAM_REPO:$APPSTREAM_REPO" sed -i "s#^url --url=.*#url --url=\"$BASEOS_REPO\"#g" $KS_FILE sed -i "s#^repo --name=appstream --baseurl=.*#repo --name=appstream --baseurl=\"$APPSTREAM_REPO\"#g" $KS_FILE +#add other repos +sed -i '/###add otherrepos start###/,/###add otherrepos end###/{/###add otherrepos start###/!{/###add otherrepos end###/!d}}' $KS_FILE +for ((i=5; i>0; --i)) +do + tmp="OTHER_REPO$i" + if [ -z "${!tmp}" ]; then + continue + fi + repostr="repo --name=${tmp} --baseurl='${!tmp}' " + sed -i "/###add otherrepos start###/a $repostr" $KS_FILE +done + #add pkgs && groups sed -i '/###add packages start###/,/###add packages end###/{/###add packages start###/!{/###add packages end###/!d}}' $KS_FILE diff --git a/qcow2.conf b/qcow2.conf index 63c1315..02f116e 100644 --- a/qcow2.conf +++ b/qcow2.conf @@ -5,6 +5,12 @@ BASEOS_REPO="http://mirrors.openanolis.cn/anolis/8.6/BaseOS/x86_64/os/" #BASEOS_REPO="http://kos.ieisystem.com/kos/5.8/BaseOS/x86_64/os/" APPSTREAM_REPO="http://mirrors.openanolis.cn/anolis/8.6/AppStream/x86_64/os/" #APPSTREAM_REPO="http://kos.ieisystem.com/kos/5.8/AppStream/x86_64/os/" +OTHER_REPO1="" +OTHER_REPO2="" +OTHER_REPO3="" +OTHER_REPO4="" +OTHER_REPO5="" + IMAGE_MAIN_NAME="Anolis-8.6" #IMAGE_MAIN_NAME="kos-5.8" RESULT_MAIN_DIR="qcow2" diff --git a/qcow2.ks b/qcow2.ks index 7ed25c3..46ff61b 100644 --- a/qcow2.ks +++ b/qcow2.ks @@ -7,6 +7,9 @@ firewall --enabled # Use network installation url --url="http://mirrors.openanolis.cn/anolis/8.6/BaseOS/x86_64/os/" repo --name=appstream --baseurl="http://mirrors.openanolis.cn/anolis/8.6/AppStream/x86_64/os/" +###add otherrepos start### +###add otherrepos end### + # Network information network --bootproto=dhcp --device=link --activate -- Gitee