From: Frank Brehm Date: Tue, 16 Jun 2020 14:02:50 +0000 (+0200) Subject: Adding and using snippets/tpl.100.clear_repos.sh X-Git-Tag: 2.1.2^2~9^2~31^2~39 X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=0eff637b979223630dc041cd4263574ccd1515f9;p=pixelpark%2Fcreate-vmware-tpl.git Adding and using snippets/tpl.100.clear_repos.sh --- diff --git a/kickstart/template-centos8.ks b/kickstart/template-centos8.ks index 4525507..c1e1076 100644 --- a/kickstart/template-centos8.ks +++ b/kickstart/template-centos8.ks @@ -179,4 +179,9 @@ echo echo "Using snippet $tweak_grub_snippet" $SNIPPET($tweak_grub_snippet) +#set $clear_repos_snippet = "per_status/" + $SYSTEM_STATUS + "/tpl.100.clear_repos.sh" +echo +echo "Using snippet $clear_repos_snippet" +$SNIPPET($clear_repos_snippet) + %end diff --git a/snippets/tpl.100.clear_repos.sh b/snippets/tpl.100.clear_repos.sh new file mode 100644 index 0000000..f20c15e --- /dev/null +++ b/snippets/tpl.100.clear_repos.sh @@ -0,0 +1,33 @@ +## !/bin/bash +#raw + +#----------------------------------------------------------- +clear_all_repo_files() { + + echo + echo "${HASH_LINE}" + echo + log "Cleaning all exiting repo files ..." + + local repo_dir="/etc/yum.repos.d" + local old_dir="${repo_dir}/.old" + local repo_file= + local bname= + + mkdir -pv "${old_dir}" + + for repo_file in "${repo_dir}"/*.repo ; do + if [[ ! -f "${repo_file}" ]] ; then + continue + fi + bname=$( echo "${repo_file}" | basename ) + echo " - ${bname}" + cp -pv "${repo_file}" "${old_dir}" + cp -v /dev/null "${repo_file}" + done + +} +clear_all_repo_files + +#end raw +## vim: ts=4 et list