summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2007-05-14 19:00:04 +0000
committerDavid Cantrell <dcantrell@redhat.com>2007-05-14 19:00:04 +0000
commitb7ecd1e6f929f76db9687bec66d310b01427565b (patch)
treed765600b3024f2ba3e3d303df1904e575be56b1d
parent5c62514a0abdc043155bcdf9d4432262284072e8 (diff)
downloadanaconda-b7ecd1e6f929f76db9687bec66d310b01427565b.tar.gz
anaconda-b7ecd1e6f929f76db9687bec66d310b01427565b.tar.xz
anaconda-b7ecd1e6f929f76db9687bec66d310b01427565b.zip
* command-stubs/pump-stub: Removed (#239427).
* command-stubs/dhcpclient-stub: Wrote new command to provide an IPv4 and IPv6 dhcp/auto client at the command line in rescue mode (#239427). * scripts/upd-instroot: Install dhcpclient-stub, symlink /usr/bin/pump to /usr/bin/dhcpclient (#239427).
-rw-r--r--ChangeLog8
-rwxr-xr-xcommand-stubs/dhcpclient-stub98
-rwxr-xr-xcommand-stubs/pump-stub36
-rwxr-xr-xscripts/upd-instroot3
4 files changed, 108 insertions, 37 deletions
diff --git a/ChangeLog b/ChangeLog
index b775166a9..483a6a8a6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2007-05-14 David Cantrell <dcantrell@redhat.com>
+
+ * command-stubs/pump-stub: Removed (#239427).
+ * command-stubs/dhcpclient-stub: Wrote new command to provide an IPv4
+ and IPv6 dhcp/auto client at the command line in rescue mode (#239427).
+ * scripts/upd-instroot: Install dhcpclient-stub, symlink /usr/bin/pump
+ to /usr/bin/dhcpclient (#239427).
+
2007-05-14 Paul Nasrat <pnasrat@redhat.com>
* iutil.py (writeRpmPlatform): Set preferred color on upgrades (#235757)
diff --git a/command-stubs/dhcpclient-stub b/command-stubs/dhcpclient-stub
new file mode 100755
index 000000000..ac8fbc999
--- /dev/null
+++ b/command-stubs/dhcpclient-stub
@@ -0,0 +1,98 @@
+#!/usr/bin/python
+
+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)
diff --git a/command-stubs/pump-stub b/command-stubs/pump-stub
deleted file mode 100755
index 63f093be6..000000000
--- a/command-stubs/pump-stub
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/python
-
-import os
-import sys
-
-# for testing
-if (os.path.exists('isys')):
- sys.path.append('isys')
-
-sys.path.append('/usr/lib/anaconda')
-
-import isys
-from sys import argv
-
-def usage():
- print "usage: pump [-i device]"
- sys.exit(1)
-
-iface = "eth0"
-
-argv = argv[1:]
-while (argv):
- if argv[0] == "-i":
- if len(argv) < 2: usage()
- iface = argv[1]
- argv = argv[2:]
- else:
- usage()
-
-ns = isys.pumpNetDevice(iface, None)
-if ns:
- f = open("/etc/resolv.conf", "w")
- f.write("nameserver %s\n" % ns)
- f.close()
-
-sys.exit(0)
diff --git a/scripts/upd-instroot b/scripts/upd-instroot
index ed493941b..b9ff74fc3 100755
--- a/scripts/upd-instroot
+++ b/scripts/upd-instroot
@@ -1153,7 +1153,8 @@ for p in $DEST $DESTGR; do
cp $p/usr/lib/anaconda/raidstart-stub $p/usr/bin/raidstart
cp $p/usr/lib/anaconda/raidstop-stub $p/usr/bin/raidstop
cp $p/usr/lib/anaconda/losetup-stub $p/usr/bin/losetup
- cp $p/usr/lib/anaconda/pump-stub $p/usr/bin/pump
+ cp $p/usr/lib/anaconda/dhcpclient-stub $p/usr/bin/dhcpclient
+ ( cd $p/usr/bin && rm -f pump && ln -sf dhcpclient pump )
cp $p/usr/lib/anaconda/list-harddrives-stub $p/usr/bin/list-harddrives
cp $p/usr/lib/anaconda/kudzu-probe-stub $p/usr/bin/kudzu-probe
cp $p/usr/lib/anaconda/loadkeys-stub $p/usr/bin/loadkeys