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
ec528c81
Commit
ec528c81
authored
Oct 16, 2017
by
Igor Pecovnik
Browse files
Add Armbian mirror changing to menu
parent
0ced67ed
Changes
2
Hide whitespace changes
Inline
Side-by-side
debian-config-jobs
View file @
ec528c81
...
...
@@ -803,6 +803,39 @@ function jobs ()
;;
# Change to other mirrors
#
"Mirror"
)
IFS
=
$'
\r\n
'
GLOBIGNORE
=
'*'
LIST_CONST
=
3
BEFORE
=
"
$(
cat
/etc/apt/sources.list.d/armbian.list |
sed
's/http/\nhttp/g'
|
grep
^http |
sed
's/\(^http[^ <]*\)\(.*\)/\1/g'
|
sed
's/https\?:\/\///'
)
"
PREFIX
=
"
$(
echo
$BEFORE
|
cut
-f1
-d
"."
)
"
AVAL_MIRROR
=(
"
${
PREFIX
}
.armbian.com"
"
${
PREFIX
}
.uk.armbian.com"
)
local
LIST
=()
for
i
in
"
${
AVAL_MIRROR
[@]
}
"
do
DESC
=
$(
description
"
${
i
[0]
}
"
)
[[
"
${
i
[0]
}
"
!=
"
$BEFORE
"
]]
&&
LIST+
=(
"
${
i
[0]//[[
:blank:]]/
}
"
"
$DESC
"
)
done
LIST_LENGHT
=
$((
$LIST_CONST
+
${#
LIST
[@]
}
/
2
))
;
if
[
"
$LIST_LENGHT
"
-eq
1
]
;
then
TARGET_MIRROR
=
${
AVAL_MIRROR
[0]
}
dialog
--backtitle
"
$BACKTITLE
"
--title
"Please wait"
--colors
--msgbox
"
\n
There are no mirrors available!"
7 35
else
exec
3>&1
TARGET_MIRROR
=
$(
dialog
--cancel-label
"Back"
--backtitle
"
$BACKTITLE
"
--no-collapse
\
--title
"Change repository location"
--colors
--clear
--menu
"
\n
from
\Z
1
$BEFORE
\Z
0 to:
\n
"
$((
6
+
${
LIST_LENGHT
}))
60 15
"
${
LIST
[@]
}
"
2>&1 1>&3
)
exitstatus
=
$?
;
exec
3>&-
fi
if
[[
$exitstatus
==
0
]]
;
then
sed
-i
"s/
$BEFORE
/
$TARGET_MIRROR
/"
/etc/apt/sources.list.d/armbian.list
dialog
--backtitle
"
$BACKTITLE
"
--title
"Info"
--colors
--msgbox
"
\n
Armbian package repository was switched to:
\n\n\Z
1
$TARGET_MIRROR
\Z
0"
9 47
fi
;;
# Toggle welcome screen items
#
...
...
debian-config-submenu
View file @
ec528c81
...
...
@@ -220,6 +220,12 @@ function description
*
autoreboot-warn
*
)
echo
"Show warning when reboot is needed"
;;
*
uk.armbian.com
*
)
echo
"United Kingdom"
;;
*
.armbian.com
*
)
echo
"Estonia"
;;
*
)
echo
""
;;
...
...
@@ -694,6 +700,7 @@ while true; do
[[
-n
$(
grep
-w
"#kernel.printk"
/etc/sysctl.conf
)
]]
&&
LIST+
=(
"Lowlevel"
"Stop low-level messages on console"
)
[[
-f
/boot/armbianEnv.txt
]]
&&
LIST+
=(
"Bootenv"
"Edit boot environment"
)
[[
-f
/boot/boot.ini
]]
&&
LIST+
=(
"Bootscript"
"Edit boot script"
)
[[
-f
/etc/apt/sources.list.d/armbian.list
]]
&&
LIST+
=(
"Mirror"
"Change repository server"
)
LIST+
=(
"Welcome"
"Toggle welcome screen items"
)
if
[[
-z
$(
apt-mark showhold |
grep
-w
"
$BOARD
"
)
]]
;
then
[[
-f
/etc/apt/sources.list.d/armbian.list
]]
&&
[[
-n
$(
grep
-w
apt /etc/apt/sources.list.d/armbian.list
)
]]
\
...
...
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