From de36dbe00ffd6056ed5cdeecfa6ee58b83d50708 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Wed, 17 Jun 2020 13:03:21 +0200 Subject: [PATCH] Adding and using some snippets --- kickstart/template-centos8.ks | 17 ++++++++++++++++- snippets/tpl.200.init-repos.sh | 20 ++++++++++++++++++++ snippets/tpl.999.finish.sh | 30 ++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 snippets/tpl.200.init-repos.sh create mode 100644 snippets/tpl.999.finish.sh diff --git a/kickstart/template-centos8.ks b/kickstart/template-centos8.ks index 6836a99..e8d4059 100644 --- a/kickstart/template-centos8.ks +++ b/kickstart/template-centos8.ks @@ -105,8 +105,9 @@ yum-utils %post --interpreter=/usr/bin/bash ### output to console +mkdir -p "/var/log/anaconda" clear -POST_LOG="/var/log/post-install.log" +POST_LOG="/var/log/anaconda/post-install.log" exec < /dev/console &> >(tee -a "$POST_LOG") ###################################################################################### @@ -189,4 +190,18 @@ 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) + + + + + +#set $finish_snippet = "per_status/" + $SYSTEM_STATUS + "/tpl.999.finish.sh" +echo +echo "Using snippet $finish_snippet" +$SNIPPET($finish_snippet) + %end diff --git a/snippets/tpl.200.init-repos.sh b/snippets/tpl.200.init-repos.sh new file mode 100644 index 0000000..6cd9863 --- /dev/null +++ b/snippets/tpl.200.init-repos.sh @@ -0,0 +1,20 @@ +## !/bin/bash +#raw + +#----------------------------------------------------------- +init_yum_repos() { + + echo + echo "${HASH_LINE}" + echo + log "Cleaning YUM repos and making cache ..." + + yum clean all + yum makecache + +} + +init_yum_repos + +#end raw +## vim: ts=4 et list diff --git a/snippets/tpl.999.finish.sh b/snippets/tpl.999.finish.sh new file mode 100644 index 0000000..1514caf --- /dev/null +++ b/snippets/tpl.999.finish.sh @@ -0,0 +1,30 @@ +## !/bin/bash +#raw + +#----------------------------------------------------------- +finish_all() { + + echo + echo "${HASH_LINE}" + echo + log "Finishing post install tasks ..." + + local wait_for=5 + local i=${wait_for} + + while [[ "${i}" -gt 0 ]] ; do + printf "." + sleep 1 + i=$(( $i - 1 )) + done + + echo + echo "${HASH_LINE}" + echo "Done." + echo +} + +finish_all + +#end raw +## vim: ts=4 et list -- 2.39.5