forked from muddman/linux-kernel-utilities
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_ubuntu_kernel.sh
More file actions
executable file
·77 lines (60 loc) · 1.79 KB
/
update_ubuntu_kernel.sh
File metadata and controls
executable file
·77 lines (60 loc) · 1.79 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/bash
# Clear the terminal so we can see things
tput clear
# Source terminal colors
. ./colors
# Source error trap
. ./error_trap
# Source variables
. ./variables
# Source functions
. ./functions
# Source whiptail messages
. ./messages
chk_version
# Reset GETOPTS
OPTIND=1
# Set overlap variables
DEPENDENCIES+="lynx "
# shellcheck disable=SC2034
BASEURL=kernel.ubuntu.com/~kernel-ppa/mainline/
if ! [[ $# == 0 ]]; then
if ! [[ $1 =~ ^- ]]; then
echo -e "DEPRICATED: Please use the standard argument form (${Yellow}--latest${Reg}).\n"
echo -e "Example: ${Yellow}./${0##*/} --latest${Reg}\n"
echo -e "Try ${Yellow}--help${Reg} for more information.\n"
exit 1
fi
fi
# Parse arguments
parse_opts_ubu "$@"
# Check OS
echo -e "${PLUS} Checking Distro"
chk_os
echo -e "${Cyan} \_ Distro identified as ${Yellow}${OS}${Reg}.\n"
echo -e "${PLUS} Checking Dependencies"
chk_deps
echo -e "${PLUS} Changing to temporary directory to work in . . ."
cd "$TMP_FLDR" 2>/dev/null || { echo "Unable to access temporary workspace ... exiting." >&2; exit 1; }
# shellcheck disable=SC2154
echo -e "${Cyan} \_ Temporary directory access granted:\t${Reg}${TMP_FLDR}\n"
echo -e "${PLUS} Removing any conflicting remnants . . ."
if ls /tmp/linux-* 1> /dev/null 2>&1; then
rm /tmp/linux-*
fi
echo -e "${Cyan} \_ Done${Reg}\n"
echo -e "${PLUS} Retrieving available kernel choices . . ."
print_kernels_ubu
select_kernel_ubu
echo -e "${PLUS} Processing selection"
get_precompiled_ubu_kernel
echo -e "${PLUS} Checking AntiVirus flag and disabling if necessary"
if [ $AV -eq 1 ] && [ -e "${AV_BINARY}" ]; then
if ${SUDO} "${AV_BINARY}" | grep -w "on-access scanning is running" > /dev/null; then
sophosOFF
AV_ACTIVE=1
fi
fi
echo -e "${PLUS} Installing kernel . . ."
${SUDO} dpkg -i linux*.deb
echo -e "${Cyan} \_ Done${Reg}\n"