-
Notifications
You must be signed in to change notification settings - Fork 16
/
D8.sh
29 lines (22 loc) · 902 Bytes
/
D8.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-3.16.0-4-amd64
KernelList="$(dpkg -l |grep 'linux-image' |awk '{print $2}')"
[ -z "$(echo $KernelList |grep -o linux-image-3.16.0-4-amd64)" ] && echo "Install error." && exit 1
for KernelTMP in `echo "$KernelList"`
do
[ "$KernelTMP" != "linux-image-3.16.0-4-amd64" ] && 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-3.16.0-4-amd64 -y
apt-mark hold linux-image-3.16.0-4-amd64
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