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
dbaf8ae9
Commit
dbaf8ae9
authored
Jan 08, 2018
by
Gauthier Provost
Browse files
Fix Static IP address editing
parent
f5fe2919
Changes
1
Hide whitespace changes
Inline
Side-by-side
debian-config-submenu
View file @
dbaf8ae9
...
@@ -90,11 +90,12 @@ fi
...
@@ -90,11 +90,12 @@ fi
#
#
function
create_if_config
()
{
function
create_if_config
()
{
address
=
$(
ip
-4
addr show dev
$1
|
awk
'/inet/ {print $2}'
|
cut
-d
'/'
-f1
)
address
=
$(
ip
-4
addr show dev
$1
|
awk
'/inet/ {print $2}'
|
cut
-d
'/'
-f1
)
netmask
=
$(
i
fconfig
$1
|
sed
-rn
'2s/ .*:(.*)$/\1/p'
)
netmask
=
$(
i
p
-4
addr show dev
$1
|
awk
'/inet/ {print $2}'
|
cut
-d
'/'
-f2
)
gateway
=
$(
route
-n
|
grep
'UG[ \t]'
|
awk
'{print $2}'
|
sed
-n
'1p'
)
gateway
=
$(
route
-n
|
grep
'UG[ \t]'
|
awk
'{print $2}'
|
sed
-n
'1p'
)
echo
-e
"# armbian-config created"
echo
-e
"# armbian-config created"
echo
-e
"source /etc/network/interfaces.d/*
\n
"
echo
-e
"source /etc/network/interfaces.d/*
\n
"
echo
-e
"allow-hotplug
$2
\n
no-auto-down
$2
"
echo
-e
"# Local loopback
\n
auto lo
\n
iface lo init loopback
\n
"
echo
-e
"# Interface
$2
\n
allow-hotplug
$2
\n
no-auto-down
$2
"
if
[[
"
$3
"
!=
"fixed"
]]
;
then
if
[[
"
$3
"
!=
"fixed"
]]
;
then
echo
-e
"iface
$2
inet dhcp"
echo
-e
"iface
$2
inet dhcp"
else
else
...
@@ -260,9 +261,10 @@ function ip_editor ()
...
@@ -260,9 +261,10 @@ function ip_editor ()
2>&1 1>&3 |
{
2>&1 1>&3 |
{
read
-r
address
;
read
-r
netmask
;
read
-r
gateway
read
-r
address
;
read
-r
netmask
;
read
-r
gateway
if
[[
$?
=
0
]]
;
then
if
[[
$?
=
0
]]
;
then
echo
-e
"# armbian-config created
\n
source /etc/network/interfaces.d/*
\n\n
allow-hotplug
$2
\
echo
-e
"# armbian-config created
\n
source /etc/network/interfaces.d/*
\n
"
>
$3
\n
no-auto-down
$2
\n
iface
$2
inet static
\
echo
-e
"# Local loopback
\n
auto lo
\n
iface lo inet loopback
\n
"
>>
$3
\n\t
address
$address
\n\t
netmask
$netmask
\n\t
gateway
$gateway
\n\t
dns-nameservers 8.8.8.8"
>
$3
echo
-e
"# Interface
$2
\n
allow-hotplug
$2
\n
no-auto-down
$2
\n
iface
$2
inet static
\
\n\t
address
$address
\n\t
netmask
$netmask
\n\t
gateway
$gateway
\n\t
dns-nameservers 8.8.8.8"
>>
$3
fi
fi
}
}
}
}
...
@@ -505,7 +507,7 @@ function select_default_interface ()
...
@@ -505,7 +507,7 @@ function select_default_interface ()
{
{
IFS
=
$'
\r\n
'
IFS
=
$'
\r\n
'
GLOBIGNORE
=
'*'
GLOBIGNORE
=
'*'
local
ADAPTER
=(
$(
ip
-4
route
ls
|
grep
default |
grep
-Po
'(?<=dev )(\S+)
'
)
)
local
ADAPTER
=(
$(
ls
/sys/class/net |
grep
-E
-v
'lo|tun
'
)
)
local
LIST
=()
local
LIST
=()
for
i
in
"
${
ADAPTER
[@]
}
"
for
i
in
"
${
ADAPTER
[@]
}
"
do
do
...
@@ -875,4 +877,4 @@ check_if_installed bluetooth lightdm && DESKTOP_INSTALLED="lightdm";
...
@@ -875,4 +877,4 @@ check_if_installed bluetooth lightdm && DESKTOP_INSTALLED="lightdm";
OVERLAYDIR
=
"/boot/dtb/overlay"
;
OVERLAYDIR
=
"/boot/dtb/overlay"
;
[[
"
$LINUXFAMILY
"
==
"sunxi64"
]]
&&
OVERLAYDIR
=
"/boot/dtb/allwinner/overlay"
;
[[
"
$LINUXFAMILY
"
==
"sunxi64"
]]
&&
OVERLAYDIR
=
"/boot/dtb/allwinner/overlay"
;
dialog
--backtitle
"
$BACKTITLE
"
--title
"Please wait"
--infobox
"
\n
Loading Armbian configuration utility ... "
5 45
dialog
--backtitle
"
$BACKTITLE
"
--title
"Please wait"
--infobox
"
\n
Loading Armbian configuration utility ... "
5 45
sleep
1
sleep
1
\ No newline at end of file
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