1
0
mirror of https://github.com/azlux/log2ram.git synced 2023-10-10 13:37:24 +02:00

Merge pull request #49 from nachoparker/master

refactor installation script
This commit is contained in:
azlux 2018-05-24 13:12:09 +02:00 committed by GitHub
commit 1b2183b4c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,34 +1,24 @@
#!/usr/bin/env sh #!/usr/bin/env sh
systemctl -q is-active log2ram && { echo "ERROR: log2ram service is still running. Please run \"sudo service log2ram stop\" to stop it."; exit 1; } systemctl -q is-active log2ram && { echo "ERROR: log2ram service is still running. Please run \"sudo service log2ram stop\" to stop it."; exit 1; }
[ "$(id -u)" -eq 0 ] || { echo "You need to be ROOT (sudo can be used)"; exit 1; }
# log2ram
mkdir -p /usr/local/bin/
install -m 644 log2ram.service /etc/systemd/system/log2ram.service
install -m 755 log2ram /usr/local/bin/log2ram
install -m 644 log2ram.conf /etc/log2ram.conf
install -m 644 uninstall.sh /usr/local/bin/uninstall-log2ram.sh
systemctl enable log2ram
if [ "$(id -u)" -eq 0 ] # cron
then install -m 755 log2ram.hourly /etc/cron.hourly/log2ram
[ -d /usr/local/bin/ ] || mkdir /usr/local/bin/ install -m 644 log2ram.logrotate /etc/logrotate.d/log2ram
cp log2ram.service /etc/systemd/system/log2ram.service
chmod 644 /etc/systemd/system/log2ram.service
cp log2ram /usr/local/bin/log2ram
chmod a+x /usr/local/bin/log2ram
cp log2ram.conf /etc/log2ram.conf
chmod 644 /etc/log2ram.conf
systemctl enable log2ram
cp log2ram.hourly /etc/cron.hourly/log2ram
chmod +x /etc/cron.hourly/log2ram
cp log2ram.logrotate /etc/logrotate.d/log2ram
chmod 644 /etc/logrotate.d/log2ram
cp uninstall.sh /usr/local/bin/uninstall-log2ram.sh
# Remove a previous log2ram version # Remove a previous log2ram version
if [ -d /var/log.hdd ]; then rm -rf /var/log.hdd
rm -r /var/log.hdd
fi
if [ -d /var/hdd.log ]; then # Make sure we start clean
rm -r /var/hdd.log rm -rf /var/hdd.log
fi
echo "##### Reboot to activate log2ram #####" echo "##### Reboot to activate log2ram #####"
else
echo "You need to be ROOT (sudo can be used)"
fi