Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Config
Commits
70f495c7
Commit
70f495c7
authored
Oct 23, 2018
by
Igor Pecovnik
Browse files
[feature] Switching between available kernel versions which are in repository
parent
ddea9151
Changes
3
Hide whitespace changes
Inline
Side-by-side
debian-config-functions
View file @
70f495c7
...
@@ -333,6 +333,56 @@ function reload_bsp(){
...
@@ -333,6 +333,56 @@ function reload_bsp(){
}
}
function
other_kernel_version
()
{
IFS
=
$'
\r\n
'
GLOBIGNORE
=
'*'
TARGET_BRANCH
=
"-"
${
BRANCH
}
[[
$BRANCH
==
"default"
]]
&&
TARGET_BRANCH
=
""
CURRENT_VERSION
=
$(
apt-cache policy linux-image
${
TARGET_BRANCH
}
-
${
LINUXFAMILY
}
|
grep
Installed|
sed
-n
-e
's/^.*Installed: //p'
)
LIST
=(
$(
apt-cache show linux-image
${
TARGET_BRANCH
}
-
${
LINUXFAMILY
}
|
grep
-E
"version: |Version:"
|
sed
-n
-e
's/^.*ersion: //p'
|
sed
's/\.$//g'
|
head
-20
)
)
# make a temporally array
new_list
=()
for
((
n
=
0
;
n<
$((${#
LIST
[@]
}))
;
n++
))
;
do
# skip currently installed package
if
[[
${
LIST
[
$n
]
}
==
$CURRENT_VERSION
]]
;
then
n
=
$((
$n
+
1
))
else
echo
${
LIST
[
$n
]
}
new_list+
=(
"
${
LIST
[
$n
]
}
"
)
fi
done
# copy back to main array
LIST
=(
"
${
new_list
[@]
}
"
)
LIST_LENGHT
=
$((${#
LIST
[@]
}
/
2
))
;
if
[
"
$LIST_LENGHT
"
-eq
0
]
;
then
dialog
--backtitle
"
$BACKTITLE
"
--title
" linux-image
${
TARGET_BRANCH
}
-
${
LINUXFAMILY
}
"
--msgbox
"
\n
Other versions are not available!"
7 38
else
beta_disclaimer
"Switching between kernels might change functionality of your board or it might fail to boot."
if
[[
-n
$ACKNOWLEDGEMENT
]]
;
then
exec
3>&1
TARGET_VERSION
=
$(
dialog
--cancel-label
"Cancel"
--backtitle
"
$BACKTITLE
"
--no-collapse
\
--title
"Switch to other kernel versions"
--clear
--menu
"
\n
Switch from package (
${
CURRENT_VERSION
}
) to:
\n
\n
"
$((
9
+
${
LIST_LENGHT
}))
60 25
"
${
LIST
[@]
}
"
2>&1 1>&3
)
exitstatus
=
$?
;
exec
3>&-
if
[[
$?
=
0
]]
;
then
# install packages
INSTALL_DTB
=
""
[[
-n
$(
apt-cache search
--names-only
"^linux-dtb
$TARGET_BRANCH
-
$LINUXFAMILY
"
)
]]
&&
INSTALL_DTB
=
"linux-dtb
$TARGET_BRANCH
-
$LINUXFAMILY
=
$TARGET_VERSION
"
debconf-apt-progress
--
apt-get
-y
-qq
--allow-downgrades
--no-install-recommends
install
linux-image
${
TARGET_BRANCH
}
-
${
LINUXFAMILY
}
=
$TARGET_VERSION
$INSTALL_DTB
dialog
--title
"Switching to
$TARGET_VERSION
"
--backtitle
"
$BACKTITLE
"
--yes-label
"Reboot"
--no-label
"Cancel"
--yesno
"
\n
Reboot to apply new settings?"
7 34
if
[[
$?
=
0
]]
;
then
reboot
;
fi
fi
fi
fi
}
#
#
...
@@ -343,8 +393,8 @@ function aval_kernel ()
...
@@ -343,8 +393,8 @@ function aval_kernel ()
IFS
=
$'
\r\n
'
IFS
=
$'
\r\n
'
GLOBIGNORE
=
'*'
GLOBIGNORE
=
'*'
AVAL_KERNEL
=(
$(
apt-cache search
--names-only
'^linux-'
$(
lsb_release
-cs
)
'-root.*.'
$BOARD
'*'
\
AVAL_KERNEL
=(
$(
apt-cache search
--names-only
'^linux-'
$(
lsb_release
-cs
)
'-root.*.'
$BOARD
'*'
\
|
grep
-w
"
$BOARD
"
|
sed
's/.*(\(.*\))/\1/'
|
awk
'{print $1}'
|
grep
-v
"
$BRANCH
"
)
)
|
grep
-w
"
$BOARD
"
|
sed
's/.*(\(.*\))/\1/'
|
awk
'{print $1}'
|
grep
-v
"
$BRANCH
"
)
)
local
LIST
=()
local
LIST
=()
for
i
in
"
${
AVAL_KERNEL
[@]
}
"
for
i
in
"
${
AVAL_KERNEL
[@]
}
"
do
do
...
...
debian-config-jobs
View file @
70f495c7
...
@@ -870,6 +870,15 @@ function jobs ()
...
@@ -870,6 +870,15 @@ function jobs ()
;;
;;
# Switch to other kernel versions
"Other"
)
if
!
is_package_manager_running
;
then
other_kernel_version
fi
;;
# Enable or disable desktop
# Enable or disable desktop
#
#
"Desktop"
)
"Desktop"
)
...
...
debian-config-submenu
View file @
70f495c7
...
@@ -67,8 +67,12 @@ while true; do
...
@@ -67,8 +67,12 @@ while true; do
testvercomp
"
$(
uname
-r
|
sed
's/-.*//'
)
"
"4.10.0"
">"
testvercomp
"
$(
uname
-r
|
sed
's/-.*//'
)
"
"4.10.0"
">"
[[
"
$LINUXFAMILY
"
=
odroidxu4
&&
$?
==
0
]]
&&
LIST+
=(
"DTB"
"Select optimised board configuration"
)
[[
"
$LINUXFAMILY
"
=
odroidxu4
&&
$?
==
0
]]
&&
LIST+
=(
"DTB"
"Select optimised board configuration"
)
[[
-f
/usr/bin/bin2fex
&&
"
$LINUXFAMILY
"
=
sun
*
i
&&
"
$BRANCH
"
=
"default"
]]
&&
LIST+
=(
"Fexedit"
"Board (fex) settings editor"
)
[[
-f
/usr/bin/bin2fex
&&
"
$LINUXFAMILY
"
=
sun
*
i
&&
"
$BRANCH
"
=
"default"
]]
&&
LIST+
=(
"Fexedit"
"Board (fex) settings editor"
)
[[
-z
${
mark
}
]]
&&
[[
-f
/etc/apt/sources.list.d/armbian.list
]]
&&
[[
-n
$(
grep
-w
apt /etc/apt/sources.list.d/armbian.list
)
]]
\
&&
LIST+
=(
"Other"
"Switch to other kernel versions"
)
[[
$(
apt-cache search
--names-only
'^linux-'
$(
lsb_release
-cs
)
'-root.*.'
$BOARD
''
|
sed
's/.*(\(.*\))/\1/'
|
awk
'{print $1}'
\
[[
$(
apt-cache search
--names-only
'^linux-'
$(
lsb_release
-cs
)
'-root.*.'
$BOARD
''
|
sed
's/.*(\(.*\))/\1/'
|
awk
'{print $1}'
\
|
wc
-l
)
-gt
1
&&
-z
"
${
mark
}
"
]]
&&
LIST+
=(
"Switch"
"Switch to alternative kernels"
)
|
wc
-l
)
-gt
1
&&
-z
"
${
mark
}
"
]]
&&
LIST+
=(
"Switch"
"Switch to alternative kernel
branche
s"
)
LIST+
=(
"SSH"
"Reconfigure SSH daemon"
)
LIST+
=(
"SSH"
"Reconfigure SSH daemon"
)
LIST+
=(
"Firmware"
"Run apt update & apt upgrade"
)
LIST+
=(
"Firmware"
"Run apt update & apt upgrade"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment