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
79272d1a
Commit
79272d1a
authored
May 10, 2018
by
Igor Pecovnik
Browse files
Add functions for more precise, by number, kernel comparisson
parent
136a520b
Changes
2
Show whitespace changes
Inline
Side-by-side
debian-config-functions
View file @
79272d1a
...
...
@@ -52,6 +52,63 @@ function main(){
#
# compare two strings in dot separated version format
#
vercomp
()
{
if
[[
$1
==
$2
]]
then
return
0
fi
local
IFS
=
.
local
i
ver1
=(
$1
)
ver2
=(
$2
)
# fill empty fields in ver1 with zeros
for
((
i
=
${#
ver1
[@]
}
;
i<
${#
ver2
[@]
}
;
i++
))
do
ver1[i]
=
0
done
for
((
i
=
0
;
i<
${#
ver1
[@]
}
;
i++
))
do
if
[[
-z
${
ver2
[i]
}
]]
then
# fill empty fields in ver2 with zeros
ver2[i]
=
0
fi
if
((
10#
${
ver1
[i]
}
>
10#
${
ver2
[i]
}
))
then
return
1
fi
if
((
10#
${
ver1
[i]
}
< 10#
${
ver2
[i]
}
))
then
return
2
fi
done
return
0
}
#
# test compare two strings $1="3.4.12" $2="5.4.2" $3="<" returns 0 if relation is correct
#
testvercomp
()
{
vercomp
$1
$2
case
$?
in
0
)
op
=
'='
;;
1
)
op
=
'>'
;;
2
)
op
=
'<'
;;
esac
if
[[
$op
!=
$3
]]
then
return
1
else
return
0
fi
}
#
# read desktop parameters
...
...
debian-config-submenu
View file @
79272d1a
...
...
@@ -63,7 +63,9 @@ while true; do
[[
-d
${
OVERLAYDIR
}
]]
&&
\
LIST+
=(
"Hardware"
"Toggle hardware configuration: UART, I2C, etc."
)
[[
"
$LINUXFAMILY
"
=
cubox
&&
"
$BRANCH
"
=
"next"
]]
&&
LIST+
=(
"DTB"
"Switch board .dtb configuration"
)
[[
"
$LINUXFAMILY
"
=
odroidxu4
&&
"
$BRANCH
"
=
"next"
]]
&&
LIST+
=(
"DTB"
"Select optimised board configuration"
)
# this is avaliable only in kernel higher than 4.10
testvercomp
"
$(
uname
-r
|
sed
's/-.*//'
)
"
"4.10.0"
">"
[[
"
$LINUXFAMILY
"
=
odroidxu4
&&
$?
==
0
]]
&&
LIST+
=(
"DTB"
"Select optimised board configuration"
)
[[
-f
/usr/bin/bin2fex
&&
"
$LINUXFAMILY
"
=
sun
*
i
&&
"
$BRANCH
"
=
"default"
]]
&&
LIST+
=(
"Fexedit"
"Board (fex) settings editor"
)
[[
$(
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"
)
...
...
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