]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/initscripts/helper/getdnsfromdhcpc.pl
Pakfire laedt die Listen jetzt besser und hat eine veraenderte Oberflaeche bekommen.
[people/pmueller/ipfire-2.x.git] / src / initscripts / helper / getdnsfromdhcpc.pl
CommitLineData
069680ac
MT
1#!/usr/bin/perl
2#
3# Helper program to get DNS info from dhcpc .info file.
4#
5# (c) Lawrence Manning, 2001
6
7use strict;
8require '/var/ipfire/general-functions.pl';
9
10my $count = $ARGV[0];
11my ($dhcp, $dns, @alldns, %dhcpc);
12
13if ($count eq "" || $count < 1) {
14 die "Bad DNS number given"; }
15
16if (open(FILE, "${General::swroot}/red/iface")) {
17 my $iface = <FILE>;
18 close FILE;
19 chomp ($iface);
20 if (!&General::readhash("${General::swroot}/dhcpc/dhcpcd-$iface.info", \%dhcpc)) {
21 die "Could not open dhcpc info file";
22 }
23} else {
24 die "Could not open interface file";
25}
26
27
28$dns = $dhcpc{'DNS'};
29
30@alldns = split(',', $dns);
31
32print "$alldns[$count - 1]\n";