From dac8e5772149b0f68556c56f656469357045e9ed Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Thu, 30 Jun 2022 14:36:33 +0200 Subject: [PATCH] Updating snippets, adding snippets for EL9 --- snippets/tpl.200.init-repos.sh | 9 ++++- ...ashrc-centos8.sh => tpl.210.bashrc-el8.sh} | 0 snippets/tpl.211.bashrc-el9.sh | 40 +++++++++++++++++++ ...ales-centos8.sh => tpl.220.locales-el8.sh} | 0 snippets/tpl.221.locales-el9.sh | 26 ++++++++++++ ....vimrc-centos8.sh => tpl.230.vimrc-el8.sh} | 0 snippets/tpl.231.vimrc-el9.sh | 32 +++++++++++++++ ...50.pkgs-centos8.sh => tpl.250.pkgs-el8.sh} | 0 snippets/tpl.280.dist-upgrade.sh | 8 +++- snippets/tpl.450.puppet.sh | 1 + 10 files changed, 113 insertions(+), 3 deletions(-) rename snippets/{tpl.210.bashrc-centos8.sh => tpl.210.bashrc-el8.sh} (100%) create mode 100644 snippets/tpl.211.bashrc-el9.sh rename snippets/{tpl.220.locales-centos8.sh => tpl.220.locales-el8.sh} (100%) create mode 100644 snippets/tpl.221.locales-el9.sh rename snippets/{tpl.230.vimrc-centos8.sh => tpl.230.vimrc-el8.sh} (100%) create mode 100644 snippets/tpl.231.vimrc-el9.sh rename snippets/{tpl.250.pkgs-centos8.sh => tpl.250.pkgs-el8.sh} (100%) diff --git a/snippets/tpl.200.init-repos.sh b/snippets/tpl.200.init-repos.sh index 0d5ad76..b8346ae 100644 --- a/snippets/tpl.200.init-repos.sh +++ b/snippets/tpl.200.init-repos.sh @@ -10,8 +10,13 @@ init_yum_repos() { echo log "Cleaning YUM repos and making cache ..." - yum clean all - yum makecache + if [[ -x /bin/dnf ]] ; then + dnf clean all + dnf makecache + else + yum clean all + yum makecache + fi echo -e "\e[0Ksection_end:$( date +%s ):ks_init_yum_repos\r\e[0K" } diff --git a/snippets/tpl.210.bashrc-centos8.sh b/snippets/tpl.210.bashrc-el8.sh similarity index 100% rename from snippets/tpl.210.bashrc-centos8.sh rename to snippets/tpl.210.bashrc-el8.sh diff --git a/snippets/tpl.211.bashrc-el9.sh b/snippets/tpl.211.bashrc-el9.sh new file mode 100644 index 0000000..d2dd3a3 --- /dev/null +++ b/snippets/tpl.211.bashrc-el9.sh @@ -0,0 +1,40 @@ +## !/bin/bash +#raw + +#----------------------------------------------------------- +set_bashrc_centos8() { + + echo -e "\e[0Ksection_start:$( date +%s ):ks_set_bashrc_centos8[collapsed=true]\r\e[0KRewriting /etc/bashrc ..." + echo + echo "${HASH_LINE}" + echo "Calling set_bashrc_centos8() ..." + echo + local url="${COBBLER_URL}/${ws_rel_filesdir}/${system_status}/bashrc-centos8" + + echo + log "Rewriting /etc/bashrc ..." + + local tmp_file=$( mktemp ) + wget -O "${tmp_file}" --dns-timeout=2 --connect-timeout=3 --read-timeout=3 "${url}" || true + if [[ -s "${tmp_file}" ]] ; then + cp -p /etc/bashrc /etc/bashrc.original + mv -v "${tmp_file}" /etc/bashrc + chmod -v 0644 /etc/bashrc + fi + rm -fv "${tmp_file}" + + echo + log "Installing bash-completion ..." + if yum install -y "bash-completion" ; then + : + else + echo "[$(date)]: Could not install bash-completion" | tee -a "${ERROR_POINTER}" + fi + + echo -e "\e[0Ksection_end:$( date +%s ):ks_set_bashrc_centos8\r\e[0K" +} + +set_bashrc_centos8 + +#end raw +## vim: ts=4 et list diff --git a/snippets/tpl.220.locales-centos8.sh b/snippets/tpl.220.locales-el8.sh similarity index 100% rename from snippets/tpl.220.locales-centos8.sh rename to snippets/tpl.220.locales-el8.sh diff --git a/snippets/tpl.221.locales-el9.sh b/snippets/tpl.221.locales-el9.sh new file mode 100644 index 0000000..5b66d39 --- /dev/null +++ b/snippets/tpl.221.locales-el9.sh @@ -0,0 +1,26 @@ +## !/bin/bash +#raw + +#----------------------------------------------------------- +set_locales_centos8() { + + echo -e "\e[0Ksection_start:$( date +%s ):ks_set_locales_centos8[collapsed=true]\r\e[0KInstalling german locales ..." + echo + echo "${HASH_LINE}" + echo "Calling set_locales_centos8() ..." + echo + + log "Installing german locales (langpacks-de) ..." + if yum install -y "langpacks-de" ; then + : + else + echo "[$(date)]: Could not install german locales (langpacks-de)" | tee -a "${ERROR_POINTER}" + fi + + echo -e "\e[0Ksection_end:$( date +%s ):ks_set_locales_centos8\r\e[0K" +} + +set_locales_centos8 + +#end raw +## vim: ts=4 et list diff --git a/snippets/tpl.230.vimrc-centos8.sh b/snippets/tpl.230.vimrc-el8.sh similarity index 100% rename from snippets/tpl.230.vimrc-centos8.sh rename to snippets/tpl.230.vimrc-el8.sh diff --git a/snippets/tpl.231.vimrc-el9.sh b/snippets/tpl.231.vimrc-el9.sh new file mode 100644 index 0000000..d85c3f7 --- /dev/null +++ b/snippets/tpl.231.vimrc-el9.sh @@ -0,0 +1,32 @@ +## !/bin/bash +#raw + +#----------------------------------------------------------- +set_vimrc_centos8() { + + echo -e "\e[0Ksection_start:$( date +%s ):ks_set_vimrc_centos8[collapsed=true]\r\e[0KGet yum repository files ..." + echo + echo "${HASH_LINE}" + echo "Calling set_vimrc_centos8() ..." + echo + local url="${COBBLER_URL}/${ws_rel_filesdir}/${system_status}/vimrc-centos8" + + echo + log "Rewriting /etc/vimrc ..." + + local tmp_file=$( mktemp ) + wget -O "${tmp_file}" --dns-timeout=2 --connect-timeout=3 --read-timeout=3 "${url}" || true + if [[ -s "${tmp_file}" ]] ; then + cp -p /etc/vimrc /etc/vimrc.original + mv -v "${tmp_file}" /etc/vimrc + chmod -v 0644 /etc/vimrc + fi + rm -fv "${tmp_file}" + + echo -e "\e[0Ksection_end:$( date +%s ):ks_set_vimrc_centos8\r\e[0K" +} + +set_vimrc_centos8 + +#end raw +## vim: ts=4 et list diff --git a/snippets/tpl.250.pkgs-centos8.sh b/snippets/tpl.250.pkgs-el8.sh similarity index 100% rename from snippets/tpl.250.pkgs-centos8.sh rename to snippets/tpl.250.pkgs-el8.sh diff --git a/snippets/tpl.280.dist-upgrade.sh b/snippets/tpl.280.dist-upgrade.sh index 98840e0..9c2ad99 100644 --- a/snippets/tpl.280.dist-upgrade.sh +++ b/snippets/tpl.280.dist-upgrade.sh @@ -12,7 +12,13 @@ dist_upgrade() { log "Upgrading all packages ..." echo - if yum upgrade -y ; then + if [[ -x /bin/dnf ]] ; then + YUM=dnf + else + YUM=yum + fi + + if $YUM upgrade --assumeyes ; then : else echo "[$(date)]: Upgrading system not successful." | tee -a "${ERROR_POINTER}" diff --git a/snippets/tpl.450.puppet.sh b/snippets/tpl.450.puppet.sh index 8d1da60..06c1129 100644 --- a/snippets/tpl.450.puppet.sh +++ b/snippets/tpl.450.puppet.sh @@ -68,6 +68,7 @@ install_puppet() { cat <<-EOF >"${facter_conf_dir}/customer.yaml" --- customer: pixelpark + project: unknown EOF echo -- 2.39.5