Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
alpine-conf
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
17
Issues
17
List
Boards
Labels
Service Desk
Milestones
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alpine
alpine-conf
Commits
39cf5d78
Commit
39cf5d78
authored
Aug 16, 2010
by
Natanael Copa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
setup-interfaces: fix for bb 1.17.1. accept /mask together with address
And print summary of the interface configuration
parent
326f0bac
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
10 deletions
+21
-10
libalpine.sh.in
libalpine.sh.in
+0
-6
setup-interfaces.in
setup-interfaces.in
+21
-4
No files found.
libalpine.sh.in
View file @
39cf5d78
...
...
@@ -67,12 +67,6 @@ default_read() {
}
invalid_ip() {
[ "
$1
" ] || return 0
! ipcalc -s -m
$1
/0 > /dev/null
}
cfg_add() {
[ -z "
$NOCOMMIT
" ] && lbu_add "
$@
"
}
...
...
setup-interfaces.in
View file @
39cf5d78
...
...
@@ -41,7 +41,11 @@ config_iface() {
local
address
local
netmask
local
gateway
while
invalid_ip
$address
;
do
# use ipcalc to validate the address. we do accept /mask
# we are no interested in the result, only error code, so
# we send result to /dev/null
while
!
ipcalc
-s
-m
$address
>
/dev/null 2>&1
;
do
address
=
`
get_default_addr
$iface
`
[
-z
"
$address
"
]
&&
address
=
"dhcp"
echon
"Ip address for
$iface
? (or 'dhcp') [
$address
] "
...
...
@@ -55,14 +59,23 @@ config_iface() {
fi
done
while
invalid_ip
$netmask
;
do
# extract netmask if entered together with address
if
[
"
$address
"
!=
"
${
address
%%/*
}
"
]
;
then
netmask
=
$(
ipcalc
-s
-m
$address
|
cut
-d
=
-f2
)
fi
# use ipcalc -m to validate netmask. we dont accept <addr>/mask suffix
# so we pass on a dummy mask to ipcalc.
while
!
ipcalc
-s
-m
$netmask
/0
>
/dev/null 2>&1
;
do
netmask
=
`
get_default_mask
$address
`
echon
"Netmask? [
$netmask
] "
default_read netmask
"
$netmask
"
[
"
$netmask
"
=
"abort"
]
&&
return
done
while
invalid_ip
$gateway
;
do
# use ipcalc -m to validate netmask. we dont accept <addr>/mask suffix
# so we pass on a dummy mask to ipcalc.
while
!
ipcalc
-s
-m
$gateway
/0
>
/dev/null 2>&1
;
do
gateway
=
`
get_default_gateway
$iface
`
[
-z
"
$gateway
"
]
&&
gateway
=
none
echon
"Gateway? (or 'none') [
$gateway
] "
...
...
@@ -73,9 +86,13 @@ config_iface() {
done
echo
"type=static"
>
$iface
.conf
echo
"address=
$
address
"
>>
$iface
.conf
echo
"address=
$
{
address
%%/*
}
"
>>
$iface
.conf
#strip off /mask if there
echo
"netmask=
$netmask
"
>>
$iface
.conf
echo
"gateway=
$gateway
"
>>
$iface
.conf
# print summary
echo
"Configuration for
$iface
:"
sed
's/^/ /'
$iface
.conf
rm
$iface
.noconf
}
...
...
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