-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathget_4.13.5_64-bit_Ubuntu
181 lines (140 loc) · 4.66 KB
/
get_4.13.5_64-bit_Ubuntu
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
#!/bin/bash
#----------------------------------------------------------------------------------
# Project Name - miscellaneous/install\ 4.13.5_64-bit\ \(Ubuntu\)
# Started On - Sun 5 Nov 20:46:28 GMT 2017
# Last Change - Fri 19 Jan 11:52:48 GMT 2018
# Author E-Mail - [email protected]
# Author GitHub - https://github.com/terminalforlife
#----------------------------------------------------------------------------------
# You can use this script by running the following, one line at a time:
#
# A="terminalforlife/miscellaneous/master/install%204.13.5_64-bit%20(Ubuntu)"
# wget -q "https://raw.githubusercontent.com/$A" -O /tmp/4.13.5_64-bit_${$}.tmp
# chmod u+x !$ && sudo !$ && rm !$ && unset A
#
# ...or do it manually, if you prefer.
#
# NOTE Wed 10 Jan 21:35:05 GMT 2018:
#
# This is now pretty much pointless. Perhaps somebody could use it as reference or
# as some sort of proof of concept.
#----------------------------------------------------------------------------------
#TODO - Rework this script as a kernel installer for many versions, per what's
# available online, whether in the standard Ubuntu repositories or not.
USAGE(){ printf "OPTS: --help|-h|-?, --no-check|-N, --version|-V DEB\n"; }
XERR(){ printf "[L%0.4d] ERROR: %s\n" "$1" "$2" 1>&2; exit 1; }
ERR(){ printf "[L%0.4d] ERROR: %s\n" "$1" "$2" 1>&2; }
declare -i DEPCOUNT=0
for DEP in /sbin/reboot /bin/{mkdir,rm,sync} /usr/bin/{wget,dpkg}; {
[ -x "$DEP" ] || {
ERR "$LINENO" "Dependency '$DEP' not met."
DEPCOUNT+=1
}
}
[ $DEPCOUNT -eq 0 ] || exit 1
URL="http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.13.5"
VER="4.13.5-041305-generic"
OS_CHECK_FUNC(){
if [ -f /etc/os-release -a -r /etc/os-release ]; then
while read -a X; do
if [[ "${X[0]}" == ID=* ]]; then
printf -v LSB "%s" "${X[0]/*=}"
break
fi
done < /etc/os-release
else
XERR "$LINENO" "Unable to determine the distribution ID."
fi
[ "$LSB" == "linuxmint" ] || {
ERR "$LINENO" "This script was written for Linux Mint 18.2."
}
}
while [ -n "$1" ]; do
case "$1" in
--help|-h|-\?)
USAGE; exit 0 ;;
--no-check|-N)
OS_CHECK_VAR="false" ;;
--version|-V)
shift
VER="$1" ;;
*)
USAGE; exit 1 ;;
esac
shift
done
[ "$OS_CHECK_VAR" == "false" ] || OS_CHECK_FUNC
while read X; do
printf "%s\n" "$X"
done <<-EOF
---------------------------------------------------------------------------
!! WARNING !! Kernel version not officially supported. !! WARNING !!
Version to Install:
$VER
Inspired by:
https://forums.linuxmint.com/viewtopic.php?f=213&t=256282
https://www.dropbox.com/s/jxmkurqnye9fe99/Kernal%20Updater.sh?dl=0
NOTE: Downloads from 'http://kernel.ubuntu.com', using wget.
Will you continue with the installation of this kernel version? If you are
sure, then enter "Yes, install!" exactly like that, by the prompt below...
---------------------------------------------------------------------------
EOF
read -e -p "ANSWER: " ANSWER
[ $UID -eq 0 ] || XERR "$LINENO" "Root access is required for this operation."
MAIN(){
for DEB in\
\
"$URL"/linux-headers-${VER%-generic}_4.13.5-041305.201710050600_all.deb\
"$URL"/linux-headers-${VER}_4.13.5-041305.201710050600_amd64.deb\
"$URL"/linux-image-${VER}_4.13.5-041305.201710050600_amd64.deb
{
F="${DEB//*\/}"
printf "DOWNLOAD: %s\n" "$F"
/usr/bin/wget -cq --show-progress "$DEB" -O /tmp/"$F"
# Scan for viruses, if you have clamav.
[ -x /usr/bin/clamscan ] && {
printf "SCAN: %s\n" "$F"
/usr/bin/clamscan -i /tmp/"$F"
}
printf "INSTALL: %s\n" "$F"
/usr/bin/dpkg -i /tmp/"$F"
# Just in-case.
printf "SYNC: %s\n" "$F"
/bin/sync
printf "CLEANUP: %s\n" "$F"
/bin/rm /tmp/"$F"
}
}
DONE(){
while read X; do
printf "%s\n" "$X"
done <<-EOF
---------------------------------------------------------------------------
Kernel '$VER' was downloaded and installed.
NOTE:
If you have any issues booting back into your Linux machine, you can
choose an earlier kernel (one which works) from within the GRUB menu
before Linux Mint 18.2 loads up.
UNINSTALL:
To remove this kernel version, run the following commands from within a
terminal using the BASH shell...
sudo apt-get purge --autoremove linux-{image-4.13.5\*}
Would you like to restart the machine now?
---------------------------------------------------------------------------
EOF
read -n 1 -p "ANSWER [Y/N]: " ANSWER
case "$ANSWER" in
[Yy])
/sbin/reboot ;;
[Nn])
printf "You chose not to reboot the system.\n" ;;
esac
}
case "$ANSWER" in
Yes,\ install\!)
MAIN
DONE ;;
*)
printf "Installation cancelled.\n" ;;
esac
# vim: noexpandtab colorcolumn=84 tabstop=8 noswapfile nobackup