From b2d6b98aeb4bf6f171f9576a40617bf1db6c3f52 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Tue, 16 Jun 2020 17:46:13 +0200 Subject: [PATCH] Adding and using snippets/tpl.180.repos_centos8.sh --- kickstart/template-centos8.ks | 5 +++++ snippets/tpl.180.repos_centos8.sh | 34 +++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 snippets/tpl.180.repos_centos8.sh diff --git a/kickstart/template-centos8.ks b/kickstart/template-centos8.ks index c1e1076..6836a99 100644 --- a/kickstart/template-centos8.ks +++ b/kickstart/template-centos8.ks @@ -184,4 +184,9 @@ echo echo "Using snippet $clear_repos_snippet" $SNIPPET($clear_repos_snippet) +#set $get_repos_snippet = "per_status/" + $SYSTEM_STATUS + "/tpl.180.repos_centos8.sh" +echo +echo "Using snippet $get_repos_snippet" +$SNIPPET($get_repos_snippet) + %end diff --git a/snippets/tpl.180.repos_centos8.sh b/snippets/tpl.180.repos_centos8.sh new file mode 100644 index 0000000..68663f9 --- /dev/null +++ b/snippets/tpl.180.repos_centos8.sh @@ -0,0 +1,34 @@ +## !/bin/bash +#raw + +#----------------------------------------------------------- +get_repos_centos8() { + + echo + echo "${HASH_LINE}" + echo "Calling get_repos_centos8() ..." + echo + local base_url="${COBBLER_URL}/${ws_rel_filesdir}/${system_status}/repos/centos8" + + local -a repos=('CentOS-AppStream' 'CentOS-Base' 'CentOS-centosplus' 'CentOS-CR' 'CentOS-Devel') + repos+=('CentOS-Extras' 'CentOS-fasttrack' 'CentOS-HA' 'CentOS-PowerTools') + repos+=('epel' 'icinga' 'pixelpark' 'prometheus' 'puppet') + + local repo= + local url= + local tmp_file= + for repo in "${repos[@]}" ; do + echo "Ensuring repo '${repo}.repo'..." + url="${base_url}/${repo}.repo" + tmp_file=$( mktemp ) + wget -O "${tmp_file}" --dns-timeout=2 --connect-timeout=3 --read-timeout=3 "${url}" || true + if [[ -s "${tmp_file}" ]] ; then + mv -pv "${tmp_file}" "/etc/yum.repos.d/${repo}.repo" + fi + rm -fv "${tmp_file}" + done + +} +get_repos_centos8 + +#end raw -- 2.39.5