Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(583)

Side by Side Diff: dhcpcd-hooks/29-lookup-hostname

Issue 2428004: Overhaul dhcpcd for chrome os use (Closed) Base URL: ssh://git@chromiumos-git//dhcpcd.git
Patch Set: purge hooks from configure to silence complaint Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « dhcpcd-hooks/20-resolv.conf ('k') | dhcpcd-hooks/30-hostname » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Lookup the hostname in DNS if not set
2
3 lookup_hostname()
4 {
5 [ -z "$new_ip_address" ] && return 1
6 local h=
7 # Silly ISC programs love to send error text to stdout
8 if type dig >/dev/null 2>&1; then
9 h=$(dig +short -x $new_ip_address)
10 if [ $? = 0 ]; then
11 echo "$h" | sed 's/\.$//'
12 return 0
13 fi
14 elif type host >/dev/null 2>&1; then
15 h=$(host $new_ip_address)
16 if [ $? = 0 ]; then
17 echo "$h" \
18 | sed 's/.* domain name pointer \(.*\)./\1/'
19 return 0
20 fi
21 fi
22 return 1
23 }
24
25 set_hostname()
26 {
27 if [ -z "$new_host_name" -a -z "$new_fqdn_name" ]; then
28 export new_host_name="$(lookup_hostname)"
29 fi
30 }
31
32 case "$reason" in
33 BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT|STATIC) set_hostname;;
34 esac
OLDNEW
« no previous file with comments | « dhcpcd-hooks/20-resolv.conf ('k') | dhcpcd-hooks/30-hostname » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698