From 0fdf8827e57f830ef0884821e75342d5e4fa2e94 Mon Sep 17 00:00:00 2001 From: Samuel FORESTIER Date: Wed, 22 Jul 2020 20:40:02 +0000 Subject: [PATCH] Silence errors when logrotate is not installed Co-authored-by: emwe1 --- install.sh | 7 ++++++- uninstall.sh | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index d6e2abd..52316e0 100755 --- a/install.sh +++ b/install.sh @@ -14,7 +14,12 @@ install -m 644 uninstall.sh /usr/local/bin/uninstall-log2ram.sh systemctl enable log2ram.service log2ram-daily.timer # logrotate -install -m 644 log2ram.logrotate /etc/logrotate.d/log2ram +if [ -d /etc/logrotate.d ]; then + install -m 644 log2ram.logrotate /etc/logrotate.d/log2ram +else + echo "##### Directory /etc/logrotate.d does not exist. #####" + echo "##### Skipping log2ram.logrotate installation. #####" +fi # Remove a previous log2ram version rm -rf /var/log.hdd diff --git a/uninstall.sh b/uninstall.sh index 9b42052..dd243fc 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -13,7 +13,7 @@ then rm -rf /etc/systemd/system/log2ram* rm /usr/local/bin/log2ram rm /etc/log2ram.conf - rm /etc/logrotate.d/log2ram + rm -f /etc/logrotate.d/log2ram if [ -d /var/hdd.log ]; then rm -r /var/hdd.log