From e99033e6556f0f90f0a8220a35ca6df0e481dd27 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Thu, 25 Jun 2020 15:15:53 +0200 Subject: [PATCH] Adding some Snippets for EL7 --- ...os_centos7.sh => tpl.170.repos_centos7.sh} | 2 +- snippets/tpl.205.bashrc-el7.sh | 38 +++++++++++++++++++ snippets/tpl.225.vimrc-el7.sh | 30 +++++++++++++++ snippets/tpl.240.pkgs-el7.sh | 36 ++++++++++++++++++ 4 files changed, 105 insertions(+), 1 deletion(-) rename snippets/{tpl.180.repos_centos7.sh => tpl.170.repos_centos7.sh} (95%) create mode 100644 snippets/tpl.205.bashrc-el7.sh create mode 100644 snippets/tpl.225.vimrc-el7.sh create mode 100644 snippets/tpl.240.pkgs-el7.sh diff --git a/snippets/tpl.180.repos_centos7.sh b/snippets/tpl.170.repos_centos7.sh similarity index 95% rename from snippets/tpl.180.repos_centos7.sh rename to snippets/tpl.170.repos_centos7.sh index 9f8a110..d62b0a1 100644 --- a/snippets/tpl.180.repos_centos7.sh +++ b/snippets/tpl.170.repos_centos7.sh @@ -6,7 +6,7 @@ get_repos_centos7() { echo echo "${HASH_LINE}" - echo "Calling get_repos_centos8() ..." + echo "Calling get_repos_centos7() ..." echo local base_url="${COBBLER_URL}/${ws_rel_filesdir}/${system_status}/repos/centos7" diff --git a/snippets/tpl.205.bashrc-el7.sh b/snippets/tpl.205.bashrc-el7.sh new file mode 100644 index 0000000..7ea934e --- /dev/null +++ b/snippets/tpl.205.bashrc-el7.sh @@ -0,0 +1,38 @@ +## !/bin/bash +#raw + +#----------------------------------------------------------- +set_bashrc_el7() { + + echo + echo "${HASH_LINE}" + echo "Calling set_bashrc_el7() ..." + echo + local url="${COBBLER_URL}/${ws_rel_filesdir}/${system_status}/bashrc-el7" + + 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 + +} + +set_bashrc_el7 + +#end raw +## vim: ts=4 et list diff --git a/snippets/tpl.225.vimrc-el7.sh b/snippets/tpl.225.vimrc-el7.sh new file mode 100644 index 0000000..4cc15c0 --- /dev/null +++ b/snippets/tpl.225.vimrc-el7.sh @@ -0,0 +1,30 @@ +## !/bin/bash +#raw + +#----------------------------------------------------------- +set_vimrc_el7() { + + echo + echo "${HASH_LINE}" + echo "Calling set_vimrc_el7() ..." + echo + local url="${COBBLER_URL}/${ws_rel_filesdir}/${system_status}/vimrc-el7" + + 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}" + +} + +set_vimrc_el7 + +#end raw +## vim: ts=4 et list diff --git a/snippets/tpl.240.pkgs-el7.sh b/snippets/tpl.240.pkgs-el7.sh new file mode 100644 index 0000000..b1622b6 --- /dev/null +++ b/snippets/tpl.240.pkgs-el7.sh @@ -0,0 +1,36 @@ +## !/bin/bash +#raw + +#----------------------------------------------------------- +install_pkgs_el7() { + + echo + echo "${HASH_LINE}" + echo "Calling install_pkgs_el7() ..." + echo + echo + log "Installing additional packages ..." + echo + + local -a pkgs_add=('colordiff' 'p7zip' 'screen') + local -a pkgs_remove=('nfs*' 'rpcbind') + + echo "Installing packages: ${pkgs_add[*]}" + yum install -y "${pkgs_add[@]}" + + echo + echo "Removing packages: ${pkgs_remove[*]}" + yum remove -y "${pkgs_remove[@]}" + + echo + echo "Creating /etc/gitconfig ..." + cat <<-EOF >/etc/gitconfig + [color] + ui = true + EOF +} + +install_pkgs_el7 + +#end raw +## vim: ts=4 et list -- 2.39.5