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
94f62976
Commit
94f62976
authored
May 03, 2018
by
Igor Pecovnik
Browse files
cosmetic fixes
parent
a60e8461
Changes
3
Show whitespace changes
Inline
Side-by-side
debian-config
View file @
94f62976
#!/bin/bash
#!/bin/bash
#
#
# Copyright (c) 201
7
Igor Pecovnik, igor.pecovnik@gma**.com
# Copyright (c) 201
8
Igor Pecovnik, igor.pecovnik@gma**.com
#
#
# This file is licensed under the terms of the GNU General Public
# This file is licensed under the terms of the GNU General Public
# License version 2. This program is licensed "as is" without any
# License version 2. This program is licensed "as is" without any
# warranty of any kind, whether express or implied.
# warranty of any kind, whether express or implied.
# define sane $PATH
# define sane $PATH
export
PATH
=
/usr/sbin:/usr/bin:/sbin:/bin
export
PATH
=
/usr/sbin:/usr/bin:/sbin:/bin
#-----------------------------------------------------------------------------------------------------------------------------------------#
#
# check for root
# check for root
#
#
if
[[
$EUID
!=
0
]]
;
then
if
[[
$EUID
!=
0
]]
;
then
...
@@ -19,7 +25,9 @@ if [[ $EUID != 0 ]]; then
...
@@ -19,7 +25,9 @@ if [[ $EUID != 0 ]]; then
fi
fi
#-----------------------------------------------------------------------------------------------------------------------------------------#
#
# check if we have internet connection to install dependencies
# check if we have internet connection to install dependencies
#
#
echo
-e
"GET http://github.com HTTP/1.0
\n\n
"
| nc github.com 80
>
/dev/null 2>&1
echo
-e
"GET http://github.com HTTP/1.0
\n\n
"
| nc github.com 80
>
/dev/null 2>&1
...
@@ -29,9 +37,11 @@ if [[ $? -ne 0 ]]; then
...
@@ -29,9 +37,11 @@ if [[ $? -ne 0 ]]; then
fi
fi
#-----------------------------------------------------------------------------------------------------------------------------------------#
# load functions, local first
#
# load functions, local first
#
if
[[
-f
${
BASH_SOURCE
}
-jobs
]]
;
then
source
${
BASH_SOURCE
}
-jobs
;
if
[[
-f
${
BASH_SOURCE
}
-jobs
]]
;
then
source
${
BASH_SOURCE
}
-jobs
;
elif
[[
-f
/usr/lib/armbian-config/jobs.sh
]]
;
then
source
/usr/lib/armbian-config/jobs.sh
;
elif
[[
-f
/usr/lib/armbian-config/jobs.sh
]]
;
then
source
/usr/lib/armbian-config/jobs.sh
;
else
exit
1
;
else
exit
1
;
...
@@ -52,11 +62,16 @@ if [[ -f ${BASH_SOURCE}-functions-network ]]; then source ${BASH_SOURCE}-functi
...
@@ -52,11 +62,16 @@ if [[ -f ${BASH_SOURCE}-functions-network ]]; then source ${BASH_SOURCE}-functi
else
exit
1
;
else
exit
1
;
fi
fi
# collect info
# collect info
main
"
$@
"
main
"
$@
"
#-----------------------------------------------------------------------------------------------------------------------------------------#
#
# Main menu
# Main menu
#
#
while
true
while
true
...
@@ -112,11 +127,10 @@ do
...
@@ -112,11 +127,10 @@ do
;;
;;
"Help"
)
"Help"
)
show_box
"Info"
"This tool provides a straightforward way of configuring
the
\Z
4
${
BOARD_NAME
}
\Z
0
.
\
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
\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
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"
\n\Z
1Sources:
\Z
0 https://git.armbian.com"
"18"
;;
;;
esac
esac
done
done
\ No newline at end of file
#-----------------------------------------------------------------------------------------------------------------------------------------#
debian-config-functions
View file @
94f62976
...
@@ -35,9 +35,10 @@ function main(){
...
@@ -35,9 +35,10 @@ function main(){
DISTROID
=
$(
lsb_release
-sc
)
DISTROID
=
$(
lsb_release
-sc
)
KERNELID
=
$(
uname
-r
)
KERNELID
=
$(
uname
-r
)
[[
-z
"
${
ARMBIAN
//
}
"
]]
&&
ARMBIAN
=
"
$DISTRO
$DISTROID
"
[[
-z
"
${
ARMBIAN
//
}
"
]]
&&
ARMBIAN
=
"
$DISTRO
$DISTROID
"
BACKTITLE
=
"Configuration utility,
$ARMBIAN
, https://www.armbian.com"
TITLE
=
"
$BOARD_NAME
"
DEFAULT_ADAPTER
=
$(
ip
-4
route
ls
|
grep
default |
grep
-Po
'(?<=dev )(\S+)'
)
DEFAULT_ADAPTER
=
$(
ip
-4
route
ls
|
grep
default |
grep
-Po
'(?<=dev )(\S+)'
)
local
ipadd
=
$(
ip
-4
addr show dev
$DEFAULT_ADAPTER
|
awk
'/inet/ {print $2}'
|
cut
-d
'/'
-f1
)
BACKTITLE
=
"Configuration utility,
$ARMBIAN
,
$ipadd
"
TITLE
=
"
$BOARD_NAME
"
[[
-z
"
${
DEFAULT_ADAPTER
//
}
"
]]
&&
DEFAULT_ADAPTER
=
"lo"
[[
-z
"
${
DEFAULT_ADAPTER
//
}
"
]]
&&
DEFAULT_ADAPTER
=
"lo"
OVERLAYDIR
=
"/boot/dtb/overlay"
;
OVERLAYDIR
=
"/boot/dtb/overlay"
;
[[
"
$LINUXFAMILY
"
==
"sunxi64"
]]
&&
OVERLAYDIR
=
"/boot/dtb/allwinner/overlay"
;
[[
"
$LINUXFAMILY
"
==
"sunxi64"
]]
&&
OVERLAYDIR
=
"/boot/dtb/allwinner/overlay"
;
...
...
debian-config-submenu
View file @
94f62976
#!/bin/bash
#!/bin/bash
#
#
# Copyright (c) 201
7
Igor Pecovnik, igor.pecovnik@gma**.com
# Copyright (c) 201
8
Igor Pecovnik, igor.pecovnik@gma**.com
#
#
# This file is licensed under the terms of the GNU General Public
# This file is licensed under the terms of the GNU General Public
# License version 2. This program is licensed "as is" without any
# License version 2. This program is licensed "as is" without any
...
@@ -12,19 +12,30 @@
...
@@ -12,19 +12,30 @@
# submenu_personal
# submenu_personal
# submenu_software
# submenu_software
#-----------------------------------------------------------------------------------------------------------------------------------------#
# system
#
# system settings
#
#
function
submenu_settings
()
function
submenu_settings
()
{
{
while
true
;
do
while
true
;
do
LIST
=()
LIST
=()
DIALOG_CANCEL
=
1
DIALOG_ESC
=
255
# check update status of BSP packages
local
mark
=
$(
apt-mark showhold |
grep
-w
"
$BOARD
"
)
local
mark
=
$(
apt-mark showhold |
grep
-w
"
$BOARD
"
)
[[
$(
sed
-n
's/^DEVNAME=//p'
/sys/dev/block/
$(
mountpoint
-d
/
)
/uevent 2> /dev/null
)
==
mmcblk
*
&&
-f
/usr/sbin/nand-sata-install
]]
\
# check if install targets are avaliable
&&
LIST+
=(
"Install"
"Install to SATA, eMMC, NAND or USB"
)
if
[[
$(
sed
-n
's/^DEVNAME=//p'
/sys/dev/block/
$(
mountpoint
-d
/
)
/uevent 2> /dev/null
)
==
mmcblk
*
\
&&
-f
/usr/sbin/nand-sata-install
]]
;
then
LIST+
=(
"Install"
"Install to SATA, eMMC, NAND or USB"
)
fi
# armbian specific function
if
[[
-f
/etc/armbian-release
]]
;
then
if
[[
-f
/etc/armbian-release
]]
;
then
if
[[
-n
"
${
mark
}
"
]]
;
then
if
[[
-n
"
${
mark
}
"
]]
;
then
LIST+
=(
"Defreeze"
"Enable kernel upgrades"
)
LIST+
=(
"Defreeze"
"Enable kernel upgrades"
)
...
@@ -32,13 +43,17 @@ while true; do
...
@@ -32,13 +43,17 @@ while true; do
LIST+
=(
"Freeze"
"Disable kernel upgrades"
)
LIST+
=(
"Freeze"
"Disable kernel upgrades"
)
fi
fi
fi
fi
if
[[
-z
$(
apt-mark showhold |
grep
-w
"
$BOARD
"
)
]]
;
then
# armbian specific function, when upgrades are enabled
if
[[
-z
${
mark
}
]]
;
then
[[
-f
/etc/apt/sources.list.d/armbian.list
]]
&&
[[
-n
$(
grep
-w
apt /etc/apt/sources.list.d/armbian.list
)
]]
\
[[
-f
/etc/apt/sources.list.d/armbian.list
]]
&&
[[
-n
$(
grep
-w
apt /etc/apt/sources.list.d/armbian.list
)
]]
\
&&
LIST+
=(
"Nightly"
"Switch to nightly automated builds"
)
&&
LIST+
=(
"Nightly"
"Switch to nightly automated builds"
)
[[
-f
/etc/apt/sources.list.d/armbian.list
]]
&&
[[
-n
$(
grep
-w
beta /etc/apt/sources.list.d/armbian.list
)
]]
\
[[
-f
/etc/apt/sources.list.d/armbian.list
]]
&&
[[
-n
$(
grep
-w
beta /etc/apt/sources.list.d/armbian.list
)
]]
\
&&
LIST+
=(
"Stable"
"Switch to stable builds"
)
&&
LIST+
=(
"Stable"
"Switch to stable builds"
)
fi
fi
[[
-n
$(
grep
-w
"#kernel.printk"
/etc/sysctl.conf
)
]]
&&
LIST+
=(
"Lowlevel"
"Stop low-level messages on console"
)
[[
-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/armbianEnv.txt
]]
&&
LIST+
=(
"Bootenv"
"Edit boot environment"
)
[[
-f
/boot/boot.ini
]]
&&
LIST+
=(
"Bootscript"
"Edit boot script"
)
[[
-f
/boot/boot.ini
]]
&&
LIST+
=(
"Bootscript"
"Edit boot script"
)
...
@@ -50,13 +65,12 @@ while true; do
...
@@ -50,13 +65,12 @@ while true; do
[[
$(
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 kernels"
)
LIST+
=(
"SSH"
"Reconfigure SSH daemon"
)
LIST+
=(
"SSH"
"Reconfigure SSH daemon"
)
LIST+
=(
"Firmware"
"Run apt update & apt upgrade"
)
LIST+
=(
"Firmware"
"Run apt update & apt upgrade"
)
[[
"
$LINUXFAMILY
"
=
sun
*
i
&&
"
$BRANCH
"
=
"default"
&&
\
[[
"
$LINUXFAMILY
"
=
sun
*
i
&&
"
$BRANCH
"
=
"default"
&&
\
-n
$(
bin2fex </boot/script.bin 2>/dev/null |
grep
-w
"hdmi_used = 1"
)
]]
&&
LIST+
=(
"Display"
"set the display resolution"
)
-n
$(
bin2fex </boot/script.bin 2>/dev/null |
grep
-w
"hdmi_used = 1"
)
]]
&&
LIST+
=(
"Display"
"set the display resolution"
)
# desktop
if
[[
-n
$DISPLAY_MANAGER
]]
;
then
if
[[
-n
$DISPLAY_MANAGER
]]
;
then
LIST+
=(
"Desktop"
"Disable desktop"
)
LIST+
=(
"Desktop"
"Disable desktop"
)
[[
$DISPLAY_MANAGER
==
'nodm'
]]
&&
LIST+
=(
"Lightdm"
"Switch to standard login manager"
)
[[
$DISPLAY_MANAGER
==
'nodm'
]]
&&
LIST+
=(
"Lightdm"
"Switch to standard login manager"
)
...
@@ -69,6 +83,7 @@ while true; do
...
@@ -69,6 +83,7 @@ while true; do
fi
fi
fi
fi
# overlayroot
if
[[
"
$DISTRO
"
==
"Ubuntu"
&&
"
$(
modinfo overlay
>
/dev/null 2>&1
;
echo
$?
)
"
==
"0"
]]
;
then
if
[[
"
$DISTRO
"
==
"Ubuntu"
&&
"
$(
modinfo overlay
>
/dev/null 2>&1
;
echo
$?
)
"
==
"0"
]]
;
then
if
[
-n
"
$(
mount |
grep
-w
tmpfs-root
)
"
]
;
then
if
[
-n
"
$(
mount |
grep
-w
tmpfs-root
)
"
]
;
then
LIST+
=(
"Overlayroot"
"Disable virtual read-only root filesystem"
)
LIST+
=(
"Overlayroot"
"Disable virtual read-only root filesystem"
)
...
@@ -95,7 +110,9 @@ done
...
@@ -95,7 +110,9 @@ done
}
}
#-----------------------------------------------------------------------------------------------------------------------------------------#
#
# menu for networking
# menu for networking
#
#
function
submenu_networking
()
function
submenu_networking
()
...
@@ -107,10 +124,12 @@ select_default_interface
...
@@ -107,10 +124,12 @@ select_default_interface
while
true
;
do
while
true
;
do
LIST
=()
LIST
=()
DIALOG_CANCEL
=
1
DIALOG_ESC
=
255
LIST+
=(
"IP"
"Select dynamic or edit static IP address"
)
LIST+
=(
"IP"
"Select dynamic or edit static IP address"
)
HOSTAPDBRIDGE
=
$(
cat
/etc/hostapd.conf 2> /dev/null |
grep
-w
"^bridge=br0"
)
HOSTAPDBRIDGE
=
$(
cat
/etc/hostapd.conf 2> /dev/null |
grep
-w
"^bridge=br0"
)
HOSTAPDSTATUS
=
$(
service hostapd status |
grep
-w
active |
grep
-w
running
)
HOSTAPDSTATUS
=
$(
service hostapd status
2> /dev/null
|
grep
-w
active |
grep
-w
running
)
if
[[
-n
"
$HOSTAPDSTATUS
"
]]
;
then
if
[[
-n
"
$HOSTAPDSTATUS
"
]]
;
then
HOSTAPDINFO
=
$(
hostapd_cli get_config 2> /dev/null |
grep
^ssid |
sed
's/ssid=//g'
)
HOSTAPDINFO
=
$(
hostapd_cli get_config 2> /dev/null |
grep
^ssid |
sed
's/ssid=//g'
)
HOSTAPDCLIENTS
=
$(
hostapd_cli all_sta 2> /dev/null |
grep
connected_time |
wc
-l
)
HOSTAPDCLIENTS
=
$(
hostapd_cli all_sta 2> /dev/null |
grep
connected_time |
wc
-l
)
...
...
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