From: Frank Brehm Date: Wed, 11 Apr 2018 12:21:36 +0000 (+0200) Subject: Adding configuring logrotation X-Git-Tag: 0.1.1~50 X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=83f655a463c27a30ded921c209772d219cc1ca32;p=pixelpark%2Fcreate-vmware-tpl.git Adding configuring logrotation --- diff --git a/bin/postinst b/bin/postinst index f3fa810..6d1fbf9 100644 --- a/bin/postinst +++ b/bin/postinst @@ -66,7 +66,7 @@ create_authkeys() { if [[ -s "${tmp_file}" ]] ; then cat "${tmp_file}" >> /root/.ssh/authorized_keys fi - rm "${tmp_file}" + rm -v "${tmp_file}" } #----------------------------------------------------------- @@ -924,6 +924,45 @@ config_rsyslog_to_remote() { } +#----------------------------------------------------------- +config_logrotate() { + + echo + echo "${HASH_LINE}" + echo + log "Configuring logrotation ..." + echo + + mkdir -pv /etc/logrotate.d + + local base_url="${COBBLER_URL}/custom/create-vmware-tpl/files" + + local tmp_file=$( mktemp ) + local url="${base_url}/logrotate.conf" + local tgt="/etc/logrotate.conf" + + echo "Getting ${url} => ${tgt} ..." + wget -O "${tmp_file}" --dns-timeout=2 --connect-timeout=3 --read-timeout=3 "${url}" || true + if [[ -s "${tmp_file}" ]] ; then + cp -v "${tmp_file}" "${tgt}" + fi + + local base= + for base in btmp syslog wtmp ; do + url="${base_url}/logrotate.d.${base}" + tgt="/etc/logrotate.d/${base}" + cp -v /dev/null "${tmp_file}" + echo "Getting ${url} => ${tgt} ..." + wget -O "${tmp_file}" --dns-timeout=2 --connect-timeout=3 --read-timeout=3 "${url}" || true + if [[ -s "${tmp_file}" ]] ; then + cp -v "${tmp_file}" "${tgt}" + fi + done + + rm -v "${tmp_file}" + +} + #----------------------------------------------------------- main() { @@ -952,6 +991,7 @@ main() { install_clamav install_puppet install_postfix + config_logrotate config_rsyslog_to_remote remove_ipv6_localhost