]> Frank Brehm's Git Trees - pixelpark/create-vmware-tpl.git/commitdiff
Adding and using snippets/tpl.180.repos_centos7.sh
authorFrank Brehm <frank.brehm@pixelpark.com>
Thu, 25 Jun 2020 10:40:23 +0000 (12:40 +0200)
committerFrank Brehm <frank.brehm@pixelpark.com>
Thu, 25 Jun 2020 10:40:23 +0000 (12:40 +0200)
kickstart/template-centos7.ks
snippets/tpl.180.repos_centos7.sh [new file with mode: 0644]

index 9efe19f320d61efb06350e3ce27cc61f994b42c3..9751d3436df9bc0f9795bfe0fea678139f7e9fcd 100644 (file)
@@ -196,6 +196,16 @@ echo
 echo "Using snippet $clear_repos_snippet"
 $SNIPPET($clear_repos_snippet)
 
+#set $get_repos_snippet = "per_status/" + $SYSTEM_STATUS + "/tpl.180.repos_centos7.sh"
+echo
+echo "Using snippet $get_repos_snippet"
+$SNIPPET($get_repos_snippet)
+
+#set $init_repos_snippet = "per_status/" + $SYSTEM_STATUS + "/tpl.200.init-repos.sh"
+echo
+echo "Using snippet $init_repos_snippet"
+$SNIPPET($init_repos_snippet)
+
 
 ## ###########################
 ## Sees to be finished
diff --git a/snippets/tpl.180.repos_centos7.sh b/snippets/tpl.180.repos_centos7.sh
new file mode 100644 (file)
index 0000000..9f8a110
--- /dev/null
@@ -0,0 +1,33 @@
+## !/bin/bash
+#raw
+
+#-----------------------------------------------------------
+get_repos_centos7() {
+
+    echo
+    echo "${HASH_LINE}"
+    echo "Calling get_repos_centos8() ..."
+    echo
+    local base_url="${COBBLER_URL}/${ws_rel_filesdir}/${system_status}/repos/centos7"
+
+    local -a repos=('CentOS-Base' 'CentOS-CR' 'CentOS-fasttrack')
+    repos+=('epel' 'icinga' 'pixelpark' 'prometheus' 'puppet' 'wazuh')
+
+    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 -v "${tmp_file}" "/etc/yum.repos.d/${repo}.repo"
+        fi
+        rm -fv "${tmp_file}"
+    done
+
+}
+get_repos_centos7
+
+#end raw