forked from xratzh/XRSK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
U16.sh
29 lines (22 loc) · 976 Bytes
/
U16.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#! /bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
[ "$EUID" -ne '0' ] && echo "Error,This script must be run as root! " && exit 1
apt install linux-image-4.4.0-47-generic
KernelList="$(dpkg -l |grep 'linux-image' |awk '{print $2}')"
[ -z "$(echo $KernelList |grep -o linux-image-4.4.0-47-generic)" ] && echo "Install error." && exit 1
for KernelTMP in `echo "$KernelList"`
do
[ "$KernelTMP" != "linux-image-4.4.0-47-generic" ] && echo -ne "Uninstall Old Kernel\n\t$KernelTMP\n" && apt-get purge "$KernelTMP" -y >/dev/null 2>&1
done
apt purge linux-headers* -y
apt install linux-headers-4.4.0-47-generic linux-image-extra-4.4.0-47-generic linux-tools-4.4.0-47-generic -y
apt-mark hold linux-image-4.4.0-47-generic
update-grub && update-grub2
echo
read -p "Info: The system needs to be restart. Do you want to reboot? [y/n]" is_reboot
if [[ ${is_reboot} == "y" || ${is_reboot} == "Y" ]]; then
reboot
else
exit
fi