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
86eeec28
Commit
86eeec28
authored
Aug 06, 2018
by
Igor Pecovnik
Browse files
Code cleanup and some cosmetic fixes
parent
129a6887
Changes
2
Hide whitespace changes
Inline
Side-by-side
debian-config
View file @
86eeec28
#!/bin/bash
#
# Copyright (c)
2018 Igor Pecovnik, igor.pecovnik@gma**
.com
# Copyright (c)
Authors: http://www.armbian.com/authors, info@armbian
.com
#
# This file is licensed under the terms of the GNU General Public
# License version 2. This program is licensed "as is" without any
...
...
@@ -9,14 +9,8 @@
# define sane $PATH
export
PATH
=
/usr/sbin:/usr/bin:/sbin:/bin
#
# check for root
# check for root
priveleges
#
if
[[
$EUID
!=
0
]]
;
then
echo
"This tool requires root privileges. Try again with
\"
sudo
\"
please ..."
>
&2
...
...
@@ -28,7 +22,7 @@ fi
#
# check
if we have
internet connection to install dependencies
# check
for
internet connection to install dependencies
#
echo
-e
"GET http://github.com HTTP/1.0
\n\n
"
| nc github.com 80
>
/dev/null 2>&1
if
[[
$?
-ne
0
]]
;
then
...
...
@@ -87,8 +81,8 @@ do
# count number of menu items to adjust window size
LISTLENGHT
=
"
$((
11
+
${#
LIST
[@]
}
/
2
))
"
BOXLENGHT
=
${#
LIST
[@]
}
MENUTITLE
=
"Configure
$DISTRO
$DISTROID
based
\Z
1Armbian
\Z
0
"
[[
-n
"
${
BOARD_NAME
/ /
}
"
]]
&&
MENUTITLE
=
$MENUTITLE
"for the
\Z
1
${
BOARD_NAME
}
\Z
0 "
MENUTITLE
=
"Configure
$DISTRO
$DISTROID
"
[[
-n
"
${
BOARD_NAME
/ /
}
"
]]
&&
MENUTITLE
=
$MENUTITLE
"
based
\Z
1Armbian
\Z
0
for the
\Z
1
${
BOARD_NAME
}
\Z
0 "
# main dialog routine
DIALOG_CANCEL
=
1
...
...
@@ -99,14 +93,15 @@ do
exec
3>&1
selection
=
$(
dialog
--colors
--backtitle
"
$BACKTITLE
"
--title
" armbian-config "
--clear
\
--cancel-label
"Cancel"
--menu
"
\n
$MENUTITLE
\n
\n
Support:
\Z
1https://
www
.armbian.com
\Z
0
\n
"
\
--cancel-label
"Cancel"
--menu
"
\n
$MENUTITLE
\n
\n
Support:
\Z
1https://
forum
.armbian.com
\Z
0
\n
"
\
$LISTLENGHT
${
TITLELENGHT
}
$BOXLENGHT
"
${
LIST
[@]
}
"
2>&1 1>&3
)
exit_status
=
$?
exec
3>&-
[[
$exit_status
==
$DIALOG_CANCEL
||
$exit_status
==
$DIALOG_ESC
]]
&&
clear
&&
exit
dialog
--backtitle
"
$BACKTITLE
"
--title
"Please wait"
--infobox
"
\n
Loading
${
selection
,,
}
submodule ... "
5
$((
26
+
${#
selection
}))
dialog
--backtitle
"
$BACKTITLE
"
--title
"Please wait"
--infobox
\
"
\n
Loading
${
selection
,,
}
submodule ... "
5
$((
26
+
${#
selection
}))
case
$selection
in
...
...
@@ -127,10 +122,13 @@ do
;;
"Help"
)
show_box
"Info"
"This tool provides a straightforward way of configuring.
\
\n
\n
Although it can be run at any time, some of the options may have difficulties if you alter system settings manually.
\n\
\n\Z
1Documentation:
\Z
0 https://docs.armbian.com
\n\n\Z
1Support:
\Z
0 https://forum.armbian.com
\n
\n\Z
1Sources:
\Z
0 https://git.armbian.com"
"18"
t
=
"This tool provides a straightforward way of configuring."
t
=
$t
"
\n
\n
Although it can be run at any time, some of the"
t
=
$t
" options may have difficulties if you alter system settings manually.
\n
"
t
=
$t
"
\n\Z
1Documentation:
\Z
0 https://docs.armbian.com"
t
=
$t
"
\n\n\Z
1Support:
\Z
0 https://forum.armbian.com
\n
"
t
=
$t
"
\n\Z
1Sources:
\Z
0 https://github.com/armbian/config"
show_box
"Info"
"
$t
"
"18"
;;
esac
done
\ No newline at end of file
done
debian-config-functions
View file @
86eeec28
#!/bin/bash
#
# Copyright (c)
2017 Igor Pecovnik, igor.pecovnik@gma**
.com
# Copyright (c)
Authors: http://www.armbian.com/authors, info@armbian
.com
#
# This file is licensed under the terms of the GNU General Public
# License version 2. This program is licensed "as is" without any
...
...
@@ -38,7 +38,8 @@ function main(){
[[
-z
"
${
ARMBIAN
//
}
"
]]
&&
ARMBIAN
=
"
$DISTRO
$DISTROID
"
DEFAULT_ADAPTER
=
$(
ip
-4
route
ls
|
grep
default |
grep
-Po
'(?<=dev )(\S+)'
)
LOCALIPADD
=
$(
ip
-4
addr show dev
$DEFAULT_ADAPTER
|
awk
'/inet/ {print $2}'
|
cut
-d
'/'
-f1
)
BACKTITLE
=
"Configuration utility,
$ARMBIAN
,
$LOCALIPADD
"
BACKTITLE
=
"Configuration utility,
$ARMBIAN
"
[[
-n
"
$LOCALIPADD
"
]]
&&
BACKTITLE
=
$BACKTITLE
", "
$LOCALIPADD
TITLE
=
"
$BOARD_NAME
"
[[
-z
"
${
DEFAULT_ADAPTER
//
}
"
]]
&&
DEFAULT_ADAPTER
=
"lo"
OVERLAYDIR
=
"/boot/dtb/overlay"
;
...
...
@@ -118,11 +119,15 @@ function check_desktop()
DISPLAY_MANAGER
=
""
;
DESKTOP_INSTALLED
=
""
check_if_installed nodm
&&
DESKTOP_INSTALLED
=
"nodm"
;
check_if_installed lightdm
&&
DESKTOP_INSTALLED
=
"lightdm"
;
check_if_installed lightdm
&&
DESKTOP_INSTALLED
=
"gnome"
;
[[
-n
$(
service lightdm status 2> /dev/null |
grep
-w
active
)
]]
&&
DISPLAY_MANAGER
=
"lightdm"
[[
-n
$(
service nodm status 2> /dev/null |
grep
-w
active
)
]]
&&
DISPLAY_MANAGER
=
"nodm"
[[
-n
$(
service gdm status 2> /dev/null |
grep
-w
active
)
]]
&&
DISPLAY_MANAGER
=
"gdm"
}
#
# naming exceptions for packages
#
...
...
@@ -241,7 +246,6 @@ function show_box ()
#-----------------------------------------------------------------------------------------------------------------------------------------#
#
# show description for MOTD files
#
...
...
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