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
1b6c1a08
Commit
1b6c1a08
authored
Aug 07, 2011
by
Jeff Bilyk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
setup-dns: command line options for unattended mode
parent
0e82dc7c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
9 deletions
+41
-9
setup-dns.in
setup-dns.in
+41
-9
No files found.
setup-dns.in
View file @
1b6c1a08
...
...
@@ -3,20 +3,52 @@
PREFIX
=
.
"
$PREFIX
/lib/libalpine.sh"
conf
=
"
$ROOT
/etc/resolv.conf"
usage
()
{
cat
<<
__EOF__
usage: setup-dns [-h] [-d domain name] [-n name server(s)]
Setup /etc/resolv.conf DNS settings
options:
-h Show this help
-d specify search domain name
-n DNS server(s) to use. For multiple servers, surround in quotes and space-seperate the list
__EOF__
exit
1
}
while
getopts
"d:n:h"
opt
;
do
case
$opt
in
d
)
DOMAINNAME
=
"
$OPTARG
"
;;
h
)
usage
;;
n
)
NAMESERVERS
=
"
$OPTARG
"
;;
esac
done
conf
=
"/home/jbilyk/alpine-conf/resolv.conf"
if
[
-f
"
$conf
"
]
;
then
domain
=
`
awk
'/^domain/ {print $2}'
$conf
`
dns
=
`
awk
'/^nameserver/ {print $2}'
$conf
`
fi
echon
"DNS domain name? (e.g 'bar.com') [
$domain
] "
default_read domain
$domain
echon
"DNS nameserver(s)? ["
for
i
in
$dns
;
do
echon
"
$i
"
done
echon
"] "
default_read dns
"
$dns
"
if
[
-n
"
$DOMAINNAME
"
]
;
then
domain
=
"
$DOMAINNAME
"
else
echon
"DNS domain name? (e.g 'bar.com') [
$domain
] "
default_read domain
$domain
fi
if
[
-n
"
$NAMESERVERS
"
]
;
then
dns
=
"
$NAMESERVERS
"
else
echon
"DNS nameserver(s)? ["
for
i
in
$dns
;
do
echon
"
$i
"
done
echon
"] "
default_read dns
"
$dns
"
fi
if
[
"
$domain
"
!=
""
]
;
then
echo
"search
$domain
"
>
$conf
...
...
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