automate kernel updates #16
Replies: 4 comments 22 replies
-
I was thinking about a script as well, but I don't get time for the same. In that, you though have to run the script manually, but you can easily upgrade. If you can develop, PRs are welcome. |
Beta Was this translation helpful? Give feedback.
-
I will write a script then, and it can just be placed in , /etc/cron.monthly |
Beta Was this translation helpful? Give feedback.
-
#!/bin/bash
#upgrading script apple linux T2 Kernel
#place script in /etc/cron.weekly
if [ $USER != root ]
then
chmod 755 $0
sudo $0 $1
exit 0
fi
if [[ $1 != -v ]]
then
exec 3>&1 4>&2
trap 'exec 2>&4 1>&3' 0 1 2 3
exec 1>/var/log/t2-kernel-update.log 2>&1
fi
set -e
cd /tmp
use_lts=false
lts_version=5.15
if [[ $use_lts != true ]]
then
latest=$(curl -sL https://github.com/t2linux/T2-Ubuntu-Kernel/releases/latest/ | grep "<title>Release" | awk -F " " '{print $2}' )
else
getkernelver=$(curl -sL https://github.com/t2linux/T2-Ubuntu-Kernel/releases | grep "{{ urlEncodedRefName }}" | grep -v "generic" | grep v${lts_version} | cut -d "{" -f 3 | cut -c 25- | head -1)
latest=${getkernelver::-76}
fi
latestkver=$(echo $latest | cut -d "v" -f 2)
latestk=$(echo $latest | cut -c 2- | cut -d "-" -f 1 | awk '{print $1"-t2"}')
currentk=$(uname -r)
if [ \( $latestk != $currentk \) ]; then
curl -L https://github.com/t2linux/T2-Ubuntu-Kernel/releases/download/${latest}/linux-headers-${latestk}_${latestkver}_amd64.deb > headers.deb
curl -L https://github.com/t2linux/T2-Ubuntu-Kernel/releases/download/${latest}/linux-image-${latestk}_${latestkver}_amd64.deb > image.deb
if [ -f headers.deb -a -f image.deb ]; then
#install
echo "Installing new kernel $latest"
apt install ./headers.deb
apt install ./image.deb
#shutdown -r 02:00 "reboot scheduled for the next 2am to update runnning kernel"
rm -f headers.deb image.deb
#uninstall old kernel
if [[ $(uname -r | cut -d "-" -f 2) = t2 ]]
then
dpkg -r linux-headers-$(uname -r)
dpkg -r linux-image-$(uname -r)
fi
fi
else
echo "Kernel is up to date"
fi |
Beta Was this translation helpful? Give feedback.
-
Closing this since kernels are now hosted on the apt repo. And thanks for this work, it helped a lot of people for a long time! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
How could I automate the kernel updates, such as a script like;
Beta Was this translation helpful? Give feedback.
All reactions