summaryrefslogtreecommitdiffstats
path: root/command-stubs
diff options
context:
space:
mode:
Diffstat (limited to 'command-stubs')
-rw-r--r--command-stubs/Makefile2
-rwxr-xr-xcommand-stubs/dhcpclient-stub116
2 files changed, 1 insertions, 117 deletions
diff --git a/command-stubs/Makefile b/command-stubs/Makefile
index e9db03916..1a0b5dea5 100644
--- a/command-stubs/Makefile
+++ b/command-stubs/Makefile
@@ -20,7 +20,7 @@
include ../Makefile.inc
STUBS = raidstart-stub raidstop-stub list-harddrives-stub \
- loadkeys-stub losetup-stub dhcpclient-stub mknod-stub syslogd-stub
+ loadkeys-stub losetup-stub mknod-stub syslogd-stub
all:
@echo "Nothing to do"
diff --git a/command-stubs/dhcpclient-stub b/command-stubs/dhcpclient-stub
deleted file mode 100755
index b5ffdc78d..000000000
--- a/command-stubs/dhcpclient-stub
+++ /dev/null
@@ -1,116 +0,0 @@
-#!/usr/bin/python
-#
-# dhcpclient-stub
-#
-# Copyright (C) 2007 Red Hat, Inc. All rights reserved.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-
-import os
-import sys
-import getopt
-
-# for testing
-if (os.path.exists('isys')):
- sys.path.append('isys')
-
-sys.path.append('/usr/lib/anaconda')
-
-import isys
-from sys import argv
-
-import network
-from network import NetworkDevice
-
-def showusage():
- print "Usage: dhcpclient [-4] [-6] [-a] [-i device] [-c class]"
-
-def showhelp():
- showusage()
- print "Options:"
- print " -4 Configure IPv4 stack via DHCP"
- print " -6 Configure IPv6 stack (DHCPv6 unless -a given)"
- print " -a Use IPv6 auto neighbor discovery"
- print " -i device Device to configure (e.g., eth0)"
- print " -c class Optional DHCP class name"
- print "Defaults:"
- print " dhcpclient -4 -6 -a -i eth0"
-
-if __name__ == "__main__":
- dev = NetworkDevice('eth0')
- dev.set(('bootproto', 'dhcp'))
-
- auto = False
- stacks = 0
-
- help = False
- unknown = False
-
- try:
- opts, args = getopt.getopt(sys.argv[1:], '46ai:c:',
- ['ipv4', 'ipv6', 'auto', 'interface',
- 'class', 'help'])
- except getopt.GetoptError:
- help = True
-
- for o, a in opts:
- if o in ('-4', '--ipv4'):
- stacks += 4
- elif o in ('-6', '--ipv6'):
- stacks += 6
- elif o in ('-a', '--auto'):
- auto = True
- elif o in ('-i', '--interface'):
- dev.set(('device', a))
- elif o in ('-c', '--class'):
- dev.set(('dhcpclass', a))
- elif o in ('--help'):
- help = True
- else:
- unknown = True
-
- if help:
- showhelp()
- sys.exit(0)
-
- if unknown:
- showusage()
- sys.exit(1)
-
- if auto:
- dev.set(('ipv6_autoconf', 'yes'))
- else:
- dev.set(('ipv6_autoconf', 'no'))
-
- if stacks == 10:
- dev.set(('useipv4', True))
- dev.set(('useipv6', True))
- elif stacks == 6:
- dev.set(('useipv4', False))
- dev.set(('useipv6', True))
- elif stacks == 4:
- dev.set(('useipv4', True))
- dev.set(('useipv6', False))
-
- try:
- ns = isys.dhcpNetDevice(dev)
- if ns:
- f = open('/etc/resolv.conf', 'w')
- f.write("nameserver %s\n" % ns)
- f.close()
- except:
- print "Error configuring device %s." % (dev.get('device'),)
-
- sys.exit(0)