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
1e41cb3a
Unverified
Commit
1e41cb3a
authored
Jan 08, 2018
by
Igor Pečovnik
Committed by
GitHub
Jan 08, 2018
Browse files
Merge pull request #15 from g-provost/dev
Fix Static IP address editing
parents
f5fe2919
dbaf8ae9
Changes
1
Show whitespace changes
Inline
Side-by-side
debian-config-submenu
View file @
1e41cb3a
...
...
@@ -90,11 +90,12 @@ fi
#
function
create_if_config
()
{
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'
)
echo
-e
"# armbian-config created"
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
echo
-e
"iface
$2
inet dhcp"
else
...
...
@@ -260,9 +261,10 @@ function ip_editor ()
2>&1 1>&3 |
{
read
-r
address
;
read
-r
netmask
;
read
-r
gateway
if
[[
$?
=
0
]]
;
then
echo
-e
"# armbian-config created
\n
source /etc/network/interfaces.d/*
\n\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
echo
-e
"# armbian-config created
\n
source /etc/network/interfaces.d/*
\n
"
>
$3
echo
-e
"# Local loopback
\n
auto lo
\n
iface lo inet loopback
\n
"
>>
$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
}
}
...
...
@@ -505,7 +507,7 @@ function select_default_interface ()
{
IFS
=
$'
\r\n
'
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
=()
for
i
in
"
${
ADAPTER
[@]
}
"
do
...
...
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