浏览代码

refactor installation script

pull/49/head
nacho 6 年前
committed by Ignacio Nunez
父节点
当前提交
0205dae7d9
共有 1 个文件被更改,包括 16 次插入26 次删除
  1. +16
    -26
      install.sh

+ 16
- 26
install.sh 查看文件

@@ -1,34 +1,24 @@
#!/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; }

# 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 ]
then
[ -d /usr/local/bin/ ] || mkdir /usr/local/bin/
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
# cron
install -m 755 log2ram.hourly /etc/cron.hourly/log2ram
install -m 644 log2ram.logrotate /etc/logrotate.d/log2ram

# Remove a previous log2ram version
if [ -d /var/log.hdd ]; then
rm -r /var/log.hdd
fi
# Remove a previous log2ram version
rm -rf /var/log.hdd

if [ -d /var/hdd.log ]; then
rm -r /var/hdd.log
fi
# Make sure we start clean
rm -rf /var/hdd.log

echo "##### Reboot to activate log2ram #####"
else
echo "You need to be ROOT (sudo can be used)"
fi
echo "##### Reboot to activate log2ram #####"

正在加载...
取消
保存