Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFS Gluon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
firmware
FFS Gluon
Commits
ea12cb77
Unverified
Commit
ea12cb77
authored
8 years ago
by
Matthias Schiffer
Browse files
Options
Downloads
Patches
Plain Diff
gluon-core: nicer indentation of /lib/gluon/upgrade/020-interfaces
parent
e5cb1257
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
package/gluon-core/luasrc/lib/gluon/upgrade/020-interfaces
+36
-21
36 additions, 21 deletions
package/gluon-core/luasrc/lib/gluon/upgrade/020-interfaces
with
36 additions
and
21 deletions
package/gluon-core/luasrc/lib/gluon/upgrade/020-interfaces
+
36
−
21
View file @
ea12cb77
#!/usr/bin/lua
local
sysconfig
=
require
'gluon.sysconfig'
local
gluon_util
=
require
'gluon.util'
-- Are we already set up?
if
sysconfig
.
lan_ifname
or
sysconfig
.
wan_ifname
then
os.exit
(
0
)
end
local
util
=
require
'gluon.util'
local
platform
=
require
'gluon.platform'
local
uci
=
require
(
'simple-uci'
).
cursor
()
if
not
(
sysconfig
.
lan_ifname
or
sysconfig
.
wan_ifname
)
then
local
function
iface_exists
(
name
)
return
(
gluon_util
.
exec
(
'ip'
,
'link'
,
'show'
,
'dev'
,
(
name
:
gsub
(
'%..*$'
,
''
)))
==
0
)
end
local
function
iface_exists
(
name
)
return
util
.
exec
(
'ip'
,
'link'
,
'show'
,
'dev'
,
(
name
:
gsub
(
'%..*$'
,
''
)))
==
0
end
local
lan_ifname
=
uci
:
get
(
'network'
,
'lan'
,
'ifname'
)
local
wan_ifname
=
uci
:
get
(
'network'
,
'wan'
,
'ifname'
)
if
platform
.
match
(
'ar71xx'
,
'generic'
,
{
'cpe210'
,
'cpe510'
,
'wbs210'
,
'wbs510'
,
'nanostation-m'
,
'nanostation-m-xw'
,
'unifi-outdoor-plus'
,
'uap-pro'
,
'unifiac-pro'
})
then
lan_ifname
,
wan_ifname
=
wan_ifname
,
lan_ifname
end
local
lan_ifname
=
uci
:
get
(
'network'
,
'lan'
,
'ifname'
)
local
wan_ifname
=
uci
:
get
(
'network'
,
'wan'
,
'ifname'
)
if
platform
.
match
(
'ar71xx'
,
'generic'
,
{
'cpe210'
,
'cpe510'
,
'wbs210'
,
'wbs510'
,
'nanostation-m'
,
'nanostation-m-xw'
,
'unifi-outdoor-plus'
,
'uap-pro'
,
'unifiac-pro'
,
})
then
lan_ifname
,
wan_ifname
=
wan_ifname
,
lan_ifname
end
if
wan_ifname
and
iface_exists
(
wan_ifname
)
then
sysconfig
.
wan_ifname
=
wan_ifname
sysconfig
.
lan_ifname
=
lan_ifname
else
sysconfig
.
wan_ifname
=
lan_ifname
end
if
wan_ifname
and
iface_exists
(
wan_ifname
)
then
sysconfig
.
wan_ifname
=
wan_ifname
sysconfig
.
lan_ifname
=
lan_ifname
else
sysconfig
.
wan_ifname
=
lan_ifname
end
uci
:
delete
(
'network'
,
'lan'
)
uci
:
delete
(
'network'
,
'wan'
)
uci
:
delete
(
'network'
,
'lan'
)
uci
:
delete
(
'network'
,
'wan'
)
uci
:
save
(
'network'
)
end
uci
:
save
(
'network'
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment