mirror of
https://github.com/azlux/log2ram.git
synced 2023-10-10 13:37:24 +02:00
Update install.sh
try to detect init-system and install accordingly
This commit is contained in:
parent
1df730ac7a
commit
12662bc6ee
33
install.sh
33
install.sh
@ -1,18 +1,43 @@
|
|||||||
#!/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; }
|
|
||||||
[ "$(id -u)" -eq 0 ] || { echo "You need to be ROOT (sudo can be used)"; exit 1; }
|
[ "$(id -u)" -eq 0 ] || { echo "You need to be ROOT (sudo can be used)"; exit 1; }
|
||||||
|
|
||||||
|
# See if we can find out the init-system
|
||||||
|
echo "Try to detect init..."
|
||||||
|
if [ "$(systemctl --version)" != '' ] ; then
|
||||||
|
INIT='systemd'
|
||||||
|
elif [ "$(rc-service --version)" != '' ] ; then
|
||||||
|
INIT='openrc'
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$INIT" in
|
||||||
|
systemd)
|
||||||
|
systemctl -q is-active log2ram && { echo "ERROR: log2ram service is still running. Please run \"sudo service log2ram stop\" to stop it."; exit 1; } ;;
|
||||||
|
openrc)
|
||||||
|
rc-service log2ram status && { echo "ERROR: log2ram service is still running. Please run \"sudo rc-service log2ram stop\" to stop it."; exit 1; } ;;
|
||||||
|
*) echo 'ERROR: could not detect init-system' ; exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# log2ram
|
# log2ram
|
||||||
mkdir -p /usr/local/bin/
|
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 755 log2ram /usr/local/bin/log2ram
|
||||||
install -m 644 log2ram.conf /etc/log2ram.conf
|
install -m 644 log2ram.conf /etc/log2ram.conf
|
||||||
install -m 644 uninstall.sh /usr/local/bin/uninstall-log2ram.sh
|
install -m 644 uninstall.sh /usr/local/bin/uninstall-log2ram.sh
|
||||||
systemctl enable log2ram
|
if [ "$INIT" = 'systemd' ] ; then
|
||||||
|
install -m 644 log2ram.service /etc/systemd/system/log2ram.service
|
||||||
|
systemctl enable log2ram
|
||||||
|
elif [ "$INIT" = 'openrc' ] ; then
|
||||||
|
install -m 755 log2ram.initd /etc/init.d/log2ram
|
||||||
|
rc-update add log2ram boot
|
||||||
|
fi
|
||||||
|
|
||||||
# cron
|
# cron
|
||||||
install -m 755 log2ram.cron /etc/cron.daily/log2ram
|
if [ "$INIT" = 'systemd' ] ; then
|
||||||
|
install -m 755 log2ram.cron /etc/cron.daily/log2ram
|
||||||
|
elif [ "$INIT" = 'openrc' ] ; then
|
||||||
|
install -m 755 log2ram.openrc_cron /etc/cron.daily/log2ram
|
||||||
|
fi
|
||||||
install -m 644 log2ram.logrotate /etc/logrotate.d/log2ram
|
install -m 644 log2ram.logrotate /etc/logrotate.d/log2ram
|
||||||
|
|
||||||
# Remove a previous log2ram version
|
# Remove a previous log2ram version
|
||||||
|
Loading…
x
Reference in New Issue
Block a user