You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

install.sh 1.2 KiB

8 jaren geleden
5 jaren geleden
123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/usr/bin/env bash
  2. systemctl -q is-active log2ram && {
  3. echo "ERROR: log2ram service is still running. Please run \"sudo systemctl stop log2ram\" to stop it."
  4. exit 1
  5. }
  6. [ "$(id -u)" -eq 0 ] || {
  7. echo "You need to be ROOT (sudo can be used)"
  8. exit 1
  9. }
  10. # log2ram
  11. mkdir -p /usr/local/bin/
  12. install -m 644 log2ram.service /etc/systemd/system/log2ram.service
  13. install -m 644 log2ram-daily.service /etc/systemd/system/log2ram-daily.service
  14. install -m 644 log2ram-daily.timer /etc/systemd/system/log2ram-daily.timer
  15. install -m 755 log2ram /usr/local/bin/log2ram
  16. if [ ! -f /etc/log2ram.conf ]; then
  17. install -m 644 log2ram.conf /etc/log2ram.conf
  18. fi
  19. install -m 644 uninstall.sh /usr/local/bin/uninstall-log2ram.sh
  20. systemctl enable log2ram.service log2ram-daily.timer
  21. # logrotate
  22. if [ -d /etc/logrotate.d ]; then
  23. install -m 644 log2ram.logrotate /etc/logrotate.d/log2ram
  24. else
  25. echo "##### Directory /etc/logrotate.d does not exist. #####"
  26. echo "##### Skipping log2ram.logrotate installation. #####"
  27. fi
  28. # Remove a previous log2ram version
  29. rm -rf /var/log.hdd
  30. # Make sure we start clean
  31. rm -rf /var/hdd.log
  32. echo "##### Reboot to activate log2ram #####"
  33. echo "##### edit /etc/log2ram.conf to configure options ####"