Added support for generic Linux

This commit is contained in:
toloveru 2017-04-08 17:58:34 +02:00
parent 86846e29ed
commit d61238cd0b
3 changed files with 52 additions and 18 deletions

View File

@ -11,7 +11,7 @@ IMPORTANT: this tool is still to be considered a development / pre-alpha release
* Verify the kernel signature * Verify the kernel signature
* Compile and install the kernel * Compile and install the kernel
* Nofity the users about what is going on (tested only on Xfce). * Nofity the users about what is going on (tested only on Xfce).
* Remove a distribution kernel if present (currently only on Arch and Manjaro). * Remove a distribution kernel if present (disabled by default).
### Installation ### Installation
1. Clone and navigate to the repository, then run `./install` 1. Clone and navigate to the repository, then run `./install`

34
install
View File

@ -35,7 +35,35 @@ function install_arch_manjaro(){
fi fi
printf "Installation complete.\n" printf "Installation complete.\n"
} }
function install_generic(){
cp kernelcheck /usr/local/sbin/kernelcheck
cp notify_all /usr/local/sbin/notify_all
if ! hash crontab &>/dev/null
then
printf "This tool depends on cron to schedule kernel checks. Exiting..\n"
exit 1
fi
if hash systemctl &>/dev/null
then
if [ $(systemctl is-active cronie) == inactive ]
then
printf "Enabling cronie command scheduler..\n"
systemctl start cronie.service &>/dev/null
systemctl enable cronie.service &>/dev/null
fi
else
printf "You don't seem to be using systemd.. Please enable cronie manually.\n"
fi
if ! grep -Fxq "@hourly /usr/local/sbin/kernelcheck" /var/spool/cron/root 2>/dev/null
then
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
then
printf "Crontab entry found. Skipping..\n"
fi
printf "Installation complete.\n"
}
if [ -f /etc/manjaro-release ] if [ -f /etc/manjaro-release ]
then then
printf "Installing for Manjaro Linux...\n" printf "Installing for Manjaro Linux...\n"
@ -44,4 +72,8 @@ elif [ -f /etc/arch-release ]
then then
printf "Installing for Arch Linux...\n" printf "Installing for Arch Linux...\n"
install_arch_manjaro install_arch_manjaro
elif [ $(uname) == Linux ]
then
printf "Distribution not yet supported.\nInstalling for generic Linux..\n"
install_generic
fi fi

View File

@ -54,23 +54,25 @@ then
make modules_install &>/dev/null make modules_install &>/dev/null
cp arch/$(uname -m)/boot/bzImage /boot/vmlinuz-$latest cp arch/$(uname -m)/boot/bzImage /boot/vmlinuz-$latest
mkinitcpio -k $latest -g /boot/initramfs-$latest.img &>/dev/null mkinitcpio -k $latest -g /boot/initramfs-$latest.img &>/dev/null
## Uncomment this code block only if you really know what you are doing!! function remove_distr_kernel(){
if [ "$(echo $(uname -r) | sed 's/ARCH//')" != "$(uname -r)" ]
then
/usr/local/sbin/notify_all "Kernel update tracker" "Removing the Arch distribution kernel.." --icon=dialog-information
pacman -R --noconfirm linux
elif [ "$(echo $(uname -r) | sed 's/MANJARO//')" != "$(uname -r)" ]
then
/usr/local/sbin/notify_all "Kernel update tracker" "Removing the Manjaro distribution kernel.." --icon=dialog-information
pacman -R --noconfirm linux
else
/usr/local/sbin/notify_all "Kernel update tracker" "Removing the current kernel.." --icon=dialog-information
rm -f /boot/initramfs-$current.img
rm -f /boot/vmlinuz-$current
rm -rf /usr/lib/modules/$current
fi
}
## Uncomment this function only if you really know what you are doing!!
## It removes the Arch / Manjaro distribution kernel, and should only be done if you know how to recover from chroot! ## It removes the Arch / Manjaro distribution kernel, and should only be done if you know how to recover from chroot!
# remove_distr_kernel
# if [ "$(echo $(uname -r) | sed 's/ARCH//')" != "$(uname -r)" ]
# then
# /usr/local/sbin/notify_all "Kernel update tracker" "Removing the Arch distribution kernel.." --icon=dialog-information
# pacman -R --noconfirm linux
# elif [ "$(echo $(uname -r) | sed 's/MANJARO//')" != "$(uname -r)" ]
# then
# /usr/local/sbin/notify_all "Kernel update tracker" "Removing the Manjaro distribution kernel.." --icon=dialog-information
# pacman -R --noconfirm linux
# else
/usr/local/sbin/notify_all "Kernel update tracker" "Removing the current kernel.." --icon=dialog-information
rm -f /boot/initramfs-$current.img
rm -f /boot/vmlinuz-$current
rm -rf /usr/lib/modules/$current
# fi
grub-mkconfig -o /boot/grub/grub.cfg &>/dev/null grub-mkconfig -o /boot/grub/grub.cfg &>/dev/null
/usr/local/sbin/notify_all "Kernel update tracker" "New kernel installed\!" --icon=dialog-information /usr/local/sbin/notify_all "Kernel update tracker" "New kernel installed\!" --icon=dialog-information
elif [[ "$latest" == "$current" ]] && [[ ! -z $latest ]] elif [[ "$latest" == "$current" ]] && [[ ! -z $latest ]]