aps/altools/sel
2021-08-25 11:37:56 +02:00

33 lines
1.1 KiB
Bash
Executable file

#!/bin/sh
#########################
# Alnux sel(ect) Script #
#########################
. "/etc/al/lnver.cfg"
case $1 in
linux) if [ $(whoami) != root ]; then
case $2 in
# Lists all kernels
list) ls /usr/src/ | grep 'linux' &&
ls -L /usr/src/linux 2>/dev/null
;;
# Sets a kernel version
set) lnver=${3} > /etc/al/lnver.cfg
;;
# Links the set kernel version.
link) ln -sv /usr/src/linux-${lnver} /usr/src/linux &&
mkdir -pv /var/aps/packages/linux/ &&
echo "/boot/vmlinuz-linux-${lnver}" > /var/aps/packages/linux/payloadfiles &&
echo "/usr/src/${lnver}" >> /var/aps/packages/linux/payloadfiles &&
echo "pkg_config_deploy=true" > /var/aps/packages/linux/package &&
echo "pkg_config_ver='${lnver}'" >> /var/aps/packages/linux/package &&
echo "pkg_config_name='linux'" >> /var/aps/packages/linux/package &&
echo "pkg_config_makedepends=''" >> /var/aps/packages/linux/package &&
echo "pkg_config_depends=''" >> /var/aps/packages/linux/package
;;
# Destroys the symlink.
destroy) rm -rfv /usr/src/linux ;;
esac
fi
esac