2022-12-13 15:11:13 +01:00
|
|
|
#!/usr/bin/env bash
|
2016-04-18 12:07:33 +02:00
|
|
|
|
2022-12-01 13:58:54 +01:00
|
|
|
systemctl -q is-active log2ram && {
|
2022-12-13 15:11:13 +01:00
|
|
|
echo "ERROR: log2ram service is still running. Please run \"sudo systemctl stop log2ram\" to stop it."
|
2022-12-01 13:58:54 +01:00
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
[ "$(id -u)" -eq 0 ] || {
|
|
|
|
echo "You need to be ROOT (sudo can be used)"
|
|
|
|
exit 1
|
|
|
|
}
|
2018-04-30 23:22:47 +02:00
|
|
|
|
2018-04-22 21:16:23 +02:00
|
|
|
# log2ram
|
|
|
|
mkdir -p /usr/local/bin/
|
|
|
|
install -m 644 log2ram.service /etc/systemd/system/log2ram.service
|
2020-07-02 11:49:15 +02:00
|
|
|
install -m 644 log2ram-daily.service /etc/systemd/system/log2ram-daily.service
|
|
|
|
install -m 644 log2ram-daily.timer /etc/systemd/system/log2ram-daily.timer
|
2018-04-22 21:16:23 +02:00
|
|
|
install -m 755 log2ram /usr/local/bin/log2ram
|
2022-09-11 23:41:35 +02:00
|
|
|
if [ ! -f /etc/log2ram.conf ]; then
|
2022-12-01 13:58:54 +01:00
|
|
|
install -m 644 log2ram.conf /etc/log2ram.conf
|
2022-09-11 23:41:35 +02:00
|
|
|
fi
|
2018-04-22 21:16:23 +02:00
|
|
|
install -m 644 uninstall.sh /usr/local/bin/uninstall-log2ram.sh
|
2020-07-02 11:49:15 +02:00
|
|
|
systemctl enable log2ram.service log2ram-daily.timer
|
2017-12-16 11:42:37 +01:00
|
|
|
|
2020-07-02 11:49:15 +02:00
|
|
|
# logrotate
|
2020-07-22 22:40:02 +02:00
|
|
|
if [ -d /etc/logrotate.d ]; then
|
2022-12-01 13:58:54 +01:00
|
|
|
install -m 644 log2ram.logrotate /etc/logrotate.d/log2ram
|
2020-07-22 22:40:02 +02:00
|
|
|
else
|
2022-12-01 13:58:54 +01:00
|
|
|
echo "##### Directory /etc/logrotate.d does not exist. #####"
|
|
|
|
echo "##### Skipping log2ram.logrotate installation. #####"
|
2020-07-22 22:40:02 +02:00
|
|
|
fi
|
2017-12-07 17:42:40 +01:00
|
|
|
|
2018-04-22 21:16:23 +02:00
|
|
|
# Remove a previous log2ram version
|
2019-08-20 01:32:46 +02:00
|
|
|
rm -rf /var/log.hdd
|
2017-12-11 08:55:38 +01:00
|
|
|
|
2018-04-22 21:16:23 +02:00
|
|
|
# Make sure we start clean
|
|
|
|
rm -rf /var/hdd.log
|
2016-11-30 18:41:41 +01:00
|
|
|
|
2019-03-09 04:24:27 +01:00
|
|
|
echo "##### Reboot to activate log2ram #####"
|
|
|
|
echo "##### edit /etc/log2ram.conf to configure options ####"
|