#!/bin/sh
if [ $EUID != 0 ]
then
printf "This script needs to be run as root.\n"
exit 1
fi
function install_arch_manjaro(){
cp kernelcheck /usr/local/sbin/kernelcheck
cp notify_all /usr/local/sbin/notify_all
if ! hash crontab &>/dev/null
printf "Installing cronie command scheduler..\n"
pacman -S --noconfirm cronie &>/dev/null
if hash systemctl &>/dev/null
if [ $(systemctl is-active cronie) == inactive ]
printf "Enabling cronie command scheduler..\n"
systemctl start cronie.service &>/dev/null
systemctl enable cronie.service &>/dev/null
else
printf "You don't seem to be using systemd.. Please enable cronie manually.\n"
if ! grep -Fxq "@hourly /usr/local/sbin/kernelcheck" /var/spool/cron/root 2>/dev/null
printf "Installing hourly service in crontab..\n"
(crontab -l 2>/dev/null; echo "@hourly /usr/local/sbin/kernelcheck" ) | crontab -
elif grep -Fxq "@hourly /usr/local/sbin/kernelcheck" /var/spool/cron/root
printf "Crontab entry found. Skipping..\n"
printf "Installation complete.\n"
}
if [ -f /etc/manjaro-release ]
printf "Installing for Manjaro Linux...\n"
install_arch_manjaro
elif [ -f /etc/arch-release ]
printf "Installing for Arch Linux...\n"