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
18
Issues
18
List
Boards
Labels
Service Desk
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
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
278ddf1a
Commit
278ddf1a
authored
Mar 21, 2012
by
Natanael Copa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
setup-interfaces: use "ask" instead of "default_read"
parent
f920a213
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
17 deletions
+17
-17
setup-interfaces.in
setup-interfaces.in
+17
-17
No files found.
setup-interfaces.in
View file @
278ddf1a
...
...
@@ -80,8 +80,8 @@ config_iface() {
local
answer
=
while
[
-n
"
$ask_bridge
"
]
;
do
echon
"Do you want to bridge the interface
$iface
? [no] "
default_read answer no
ask
"Do you want to bridge the interface
$iface
?"
no
answer
=
$resp
case
"
$answer
"
in
yes
|
y
)
answer
=
yes
;
break
;;
no|n
)
break
;;
...
...
@@ -91,8 +91,8 @@ config_iface() {
if
[
"
$answer
"
=
"yes"
]
;
then
bridge
=
"br"
`
echo
$iface
|
sed
's/[^0-9]//g'
`
while
[
1
]
;
do
echon
"Name of the bridge you would like to create: [
$bridge
] "
default_read bridge
$bridge
ask
"Name of the bridge you would like to create:"
$bridge
bridge
=
$resp
`
echo
"
$bridges
"
|
grep
-q
"
$bridge
"
`
||
break
echo
"Name already in use, please choose another one"
done
...
...
@@ -106,8 +106,8 @@ config_iface() {
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
] "
default_read address
$address
ask
"Ip address for
$iface
? (or 'dhcp')"
$address
address
=
$resp
[
"
$address
"
=
"abort"
]
&&
return
if
[
"
$address
"
=
"dhcp"
]
;
then
HAS_DHCP
=
yes
...
...
@@ -126,8 +126,8 @@ config_iface() {
# 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
"
ask
"Netmask?"
$netmask
netmask
=
$resp
[
"
$netmask
"
=
"abort"
]
&&
return
done
...
...
@@ -136,8 +136,8 @@ config_iface() {
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
] "
default_read gateway
$gateway
ask
"Gateway? (or 'none')"
$gateway
gateway
=
$resp
[
"
$gateway
"
=
"abort"
]
&&
return
[
"
$gateway
"
=
"none"
]
&&
gateway
=
""
[
-z
"
$gateway
"
]
&&
break
...
...
@@ -157,7 +157,7 @@ config_iface() {
usage
()
{
cat
<<
__EOF__
usage: setup-interfaces [-bhi]
usage: setup-interfaces [-bhi]
[-p ROOT]
Setup network interfaces
...
...
@@ -165,6 +165,7 @@ options:
-b Ask for bridging of interfaces
-h Show this help
-i Read new contents of /etc/network/interfaces from stdin
-p Use ROOT as system prefix
__EOF__
exit
1
}
...
...
@@ -178,10 +179,9 @@ prompt_for_interfaces() {
index
=
1
while
!
unconfigured_all_done
;
do
echo
"Available interfaces are:
$(
unconfigured_list
)
."
firstif
=
`
unconfigured_get_first
`
echon
"Which one do you want to initialize? (or 'done') [
$firstif
] "
default_read iface
"
$firstif
"
ask
"Which one do you want to initialize? (or 'done')"
\
$(
unconfigured_get_first
)
iface
=
$resp
[
"
$iface
"
=
"done"
]
&&
break
unconfigured_isin
$iface
||
continue
...
...
@@ -232,8 +232,8 @@ prompt_for_interfaces() {
done
while
[
"
$answer
"
!=
"yes"
]
&&
[
"
$answer
"
!=
"no"
]
;
do
echon
"Do you want to do any manual network configuration? [no] "
default_read answer no
ask
"Do you want to do any manual network configuration?"
no
answer
=
$resp
done
if
[
"
$answer
"
=
"yes"
]
;
then
...
...
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