]> Frank Brehm's Git Trees - pixelpark/create-vmware-tpl.git/commitdiff
Adding configuring logrotation
authorFrank Brehm <frank.brehm@pixelpark.com>
Wed, 11 Apr 2018 12:21:36 +0000 (14:21 +0200)
committerFrank Brehm <frank.brehm@pixelpark.com>
Wed, 11 Apr 2018 12:21:36 +0000 (14:21 +0200)
bin/postinst

index f3fa810a4fa00d0e9ce96b1a55d0c8e1f24d921d..6d1fbf9f3d1524a5459d225ec3b7fba6c4132acd 100644 (file)
@@ -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