summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenedikt Boehm <hollow@gentoo.org>2005-09-03 16:10:27 +0000
committerBenedikt Boehm <hollow@gentoo.org>2005-09-03 16:10:27 +0000
commit15d9155808de928fa26bfeaaecfee7210afde0d3 (patch)
treef113365bda736d949d39dd94bd99346056030e30
downloadbaselayout-vserver-15d9155808de928fa26bfeaaecfee7210afde0d3.tar.gz
baselayout-vserver-15d9155808de928fa26bfeaaecfee7210afde0d3.tar.bz2
baselayout-vserver-15d9155808de928fa26bfeaaecfee7210afde0d3.zip
import initial baselayout sources (1.12.0_pre8)
svn path=/baselayout-vserver/trunk/; revision=3
-rw-r--r--ChangeLog4442
-rwxr-xr-xbin/rc-status217
-rw-r--r--etc/conf.d/bootmisc12
-rw-r--r--etc/conf.d/clock26
-rw-r--r--etc/conf.d/consolefont16
-rw-r--r--etc/conf.d/domainname17
-rw-r--r--etc/conf.d/env_whitelist10
-rw-r--r--etc/conf.d/hostname4
-rw-r--r--etc/conf.d/keymaps26
-rw-r--r--etc/conf.d/local.start5
-rw-r--r--etc/conf.d/local.stop8
-rw-r--r--etc/conf.d/net4
-rw-r--r--etc/conf.d/net.example570
-rw-r--r--etc/conf.d/rc180
-rw-r--r--etc/conf.d/wireless.example283
-rw-r--r--etc/env.d/00basic10
-rw-r--r--etc/filesystems14
-rw-r--r--etc/fstab30
-rw-r--r--etc/group43
-rw-r--r--etc/hosts31
-rw-r--r--etc/inittab45
-rw-r--r--etc/inputrc56
-rw-r--r--etc/issue3
-rw-r--r--etc/issue.devfix21
-rw-r--r--etc/issue.logo13
-rw-r--r--etc/modules.autoload.d/kernel-2.411
-rw-r--r--etc/modules.autoload.d/kernel-2.610
-rw-r--r--etc/modules.d/aliases46
-rw-r--r--etc/modules.d/i3864
-rw-r--r--etc/networks8
-rw-r--r--etc/passwd28
-rw-r--r--etc/profile58
-rw-r--r--etc/protocols42
-rw-r--r--etc/rc.conf39
-rw-r--r--etc/services969
-rw-r--r--etc/shadow18
-rw-r--r--etc/shells9
-rw-r--r--etc/sysctl.conf48
-rwxr-xr-xinit.d/bootmisc141
-rwxr-xr-xinit.d/checkfs54
-rwxr-xr-xinit.d/checkroot124
-rwxr-xr-xinit.d/clock144
-rwxr-xr-xinit.d/consolefont68
-rwxr-xr-xinit.d/domainname60
-rwxr-xr-xinit.d/halt.sh242
-rwxr-xr-xinit.d/hostname39
-rwxr-xr-xinit.d/keymaps79
-rwxr-xr-xinit.d/local34
-rwxr-xr-xinit.d/localmount47
-rwxr-xr-xinit.d/modules122
l---------init.d/net.eth01
-rwxr-xr-xinit.d/netmount93
-rwxr-xr-xinit.d/numlock34
-rwxr-xr-xinit.d/reboot.sh8
-rwxr-xr-xinit.d/rmnologin16
-rwxr-xr-xinit.d/shutdown.sh8
-rwxr-xr-xinit.d/urandom37
-rw-r--r--lib/rcscripts/net.modules.d/adsl101
-rw-r--r--lib/rcscripts/net.modules.d/apipa105
-rw-r--r--lib/rcscripts/net.modules.d/bonding125
-rw-r--r--lib/rcscripts/net.modules.d/bridge227
-rw-r--r--lib/rcscripts/net.modules.d/dhclient196
-rw-r--r--lib/rcscripts/net.modules.d/dhcpcd166
-rw-r--r--lib/rcscripts/net.modules.d/essidnet79
-rwxr-xr-xlib/rcscripts/net.modules.d/helpers.d/dhclient-wrapper45
-rwxr-xr-xlib/rcscripts/net.modules.d/helpers.d/dhcp130
-rw-r--r--lib/rcscripts/net.modules.d/helpers.d/dhcp-state31
-rwxr-xr-xlib/rcscripts/net.modules.d/helpers.d/dhcpcd-wrapper48
-rw-r--r--lib/rcscripts/net.modules.d/helpers.d/functions526
-rw-r--r--lib/rcscripts/net.modules.d/helpers.d/module-loader47
-rwxr-xr-xlib/rcscripts/net.modules.d/helpers.d/pump-wrapper14
-rwxr-xr-xlib/rcscripts/net.modules.d/helpers.d/udhcpc-wrapper20
-rw-r--r--lib/rcscripts/net.modules.d/ifconfig435
-rw-r--r--lib/rcscripts/net.modules.d/ipppd103
-rw-r--r--lib/rcscripts/net.modules.d/iproute2376
-rw-r--r--lib/rcscripts/net.modules.d/iptunnel84
-rw-r--r--lib/rcscripts/net.modules.d/iwconfig923
-rw-r--r--lib/rcscripts/net.modules.d/macchanger126
-rw-r--r--lib/rcscripts/net.modules.d/macnet72
-rw-r--r--lib/rcscripts/net.modules.d/netplug123
-rw-r--r--lib/rcscripts/net.modules.d/pump136
-rw-r--r--lib/rcscripts/net.modules.d/rename86
-rw-r--r--lib/rcscripts/net.modules.d/system134
-rw-r--r--lib/rcscripts/net.modules.d/tuntap116
-rw-r--r--lib/rcscripts/net.modules.d/udhcpc153
-rw-r--r--lib/rcscripts/net.modules.d/vlan167
-rw-r--r--lib/rcscripts/net.modules.d/wpa_supplicant350
-rw-r--r--man/MAKEDEV.8392
-rw-r--r--man/consoletype.128
-rw-r--r--man/modules-update.851
-rw-r--r--man/modules.autoload.519
-rw-r--r--man/rc-status.839
-rw-r--r--man/rc-update.846
-rw-r--r--man/start-stop-daemon.8233
-rw-r--r--rc-lists/boot14
-rw-r--r--rc-lists/default3
-rw-r--r--rc-lists/nonetwork1
-rw-r--r--rc-lists/single0
-rwxr-xr-xsbin/MAKEDEV1894
-rwxr-xr-xsbin/MAKEDEV-gentoo.patch210
-rwxr-xr-xsbin/depscan.sh93
-rwxr-xr-xsbin/env-update.sh42
-rwxr-xr-xsbin/functions.sh868
-rwxr-xr-xsbin/modules-update240
-rwxr-xr-xsbin/rc975
-rwxr-xr-xsbin/rc-daemon.sh382
-rwxr-xr-xsbin/rc-help.sh186
-rwxr-xr-xsbin/rc-services.sh883
-rwxr-xr-xsbin/rc-update162
-rwxr-xr-xsbin/runscript.sh581
-rw-r--r--src/.cvsignore5
-rw-r--r--src/Makefile49
-rw-r--r--src/awk/cachedepends.awk210
-rw-r--r--src/awk/functions.awk156
-rw-r--r--src/awk/gendepends.awk562
-rw-r--r--src/awk/genenviron.awk179
-rw-r--r--src/consoletype.c38
-rw-r--r--src/core/.cvsignore3
-rw-r--r--src/core/ChangeLog163
-rw-r--r--src/core/Makefile81
-rw-r--r--src/core/README15
-rw-r--r--src/core/debug.h85
-rw-r--r--src/core/depend.c532
-rw-r--r--src/core/depend.h75
-rw-r--r--src/core/depscan.c297
-rw-r--r--src/core/list.h446
-rw-r--r--src/core/misc.c649
-rw-r--r--src/core/misc.h288
-rw-r--r--src/core/parse.c1033
-rw-r--r--src/core/parse.h110
-rw-r--r--src/core/simple-regex.c854
-rw-r--r--src/core/simple-regex.h86
-rw-r--r--src/core/test-regex.c80
-rw-r--r--src/env_whitelist26
-rw-r--r--src/filefuncs/Makefile17
-rw-r--r--src/filefuncs/filefuncs.c486
-rw-r--r--src/headers.h26
-rw-r--r--src/runscript.c250
-rw-r--r--src/start-stop-daemon.c1375
139 files changed, 29489 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000..849dc2a
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,4442 @@
+# ChangeLog for Gentoo System Intialization ("rc") scripts
+# Copyright 1999-2005 Gentoo Foundation; Distributed under the GPLv2
+
+* baselayout-1.12.0_pre8 (02 Sep 2005)
+
+ 02 Sep 2005; Martin Schlemmer <azarah@gentoo.org>:
+
+ Split the enviroment whitelist for runscript into a system and user part.
+ Update it to use LIBDIR so that we can set 'lib' or 'lib64'.
+
+ 02 Sep 2005; Roy Marples <uberlord@gentoo.org>:
+
+ netplug module added + documentation for it.
+
+ We also set MTU in the pre_start of ifconfig/iproute2 incase a DHCP
+ client or similar needs it.
+
+ 01 Sep 2005; Roy Marples <uberlord@gentoo.org>:
+
+ Altered iproute2 to use the same lo logic as ifconfig below
+
+ Fixed ifconfig bringing lo up and then working out aliases, bug #104415
+
+ 31 Aug 2005; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add the initial stuff for filtering of env variables for the rc-system.
+
+ Use /sbin/functions.sh instead of /etc/init.d/functions.sh.
+
+ Fix for the 'local starts and stops unneeded' issue when calling /sbin/rc
+ in some cases.
+
+* baselayout-1.12.0_pre7 (31 Aug 2005)
+
+ 31 Aug 2005; Roy Marples <uberlord@gentoo.org>:
+
+ service status requests (either by /etc/init.d/foo status or rc-status)
+ now update the service status by checking daemons and/or pidfiles to check
+ if they are still running or not. To update the status in your own code,
+ source "${svclib}/sh/rc-daemon.sh" and call
+ update_service_status "${service}"
+
+ Trimmed $Header$ from a few files
+
+ 30 Aug 2005; Roy Marples <uberlord@gentoo.org>:
+
+ iwconfig fixed for scanned ad-hoc networks
+ we now prefer managed over ad-hoc when processing scan results
+
+ iwconfig associate_test_quality now works. Fixes #103579 thanks to
+ Harald Schioeberg
+
+ iproute2 now understands ifconfig style netmask routes
+
+ fixed IPv6 address problems in ifconfig and iproute2 modules
+
+ 24 Aug 2005; Roy Marples <uberlord@gentoo.org>:
+
+ rc-daemon now handles --signal correct - fixes #103182
+
+ 19 Aug 2005; Roy Marples <uberlord@gentoo.org>:
+
+ dhcpcd now reports the correct needed version
+
+ iwconfig and wpa_supplicant have better tests for wireless interface
+ which fixes the "lan wlan" problem
+
+* baselayout-1.12.0_pre6 (18 Aug 2005)
+
+ 18 Aug 2005; Roy Marples <uberlord@gentoo.org>:
+
+ RC_AUTO_INTERFACE defaults to NO - but we still default to DHCP
+
+ consoletype is now cached. This has the benefit of being very slightly
+ faster and you now get coloured text for parallel startup
+
+ Parallel startup also does parallel shutdown as well
+
+ You're now warned if you're using a deprecated conf.d/net syntax
+
+ 15 Aug 2005; Roy Marples <uberlord@gentoo.org>:
+
+ iproute2 now understands the old iface_xxx syntax, but this only works
+ if ifconfig (from net-tools) is installed
+
+ 14 Aug 2005; Roy Marples <uberlord@gentoo.org>:
+
+ fallback_route_eth0 now works again
+
+ Implemented interactive startup - fixes #5353
+ Thanks to Paul Pacheco for the patch
+
+ 13 Aug 2005; Roy Marples <uberlord@gentoo.org>:
+
+ Parallel startup races should now be fixed
+
+ iwconfig now scans for mode so you can prefer ad-hoc networks
+
+ 12 Aug 2005; Roy Marples <uberlord@gentoo.org>:
+
+ RC_AUTO_INTERFACE now defaults to no - we no longer mess with /etc unless
+ told too
+
+ tuntap no longer complains about ${devnull}
+
+ We now merge resolv.conf and ntp.conf from active interfaces
+
+ 11 Aug 2005; Roy Marples <uberlord@gentoo.org>:
+
+ Add support for --pid ${pidfile} and --pidfile=${pidfile} in rc-daemon.sh
+
+ Remove tail from depdir() in /sbin/modules-update
+
+* baselayout-1.12.0_pre5 (11 Aug 2005)
+
+ 08 Aug 2005; Roy Marples <uberlord@gentoo.org>:
+
+ Add failup/faildown user functions when an interface fails to come up/go
+ down. Fixes bug #101087.
+
+ 06 Aug 2005; Martin Schlemmer <azarah@gentoo.org>:
+
+ Revert 'mtime' changes to depscan.sh, and just make it warn if it detects
+ that there are files with mtime in the future.
+
+ 06 Aug 2005; Martin Schlemmer <azarah@gentoo.org>:
+
+ Enhance gendepends.awk to check more than one level of dependencies. Also
+ break checking of NEED/USE/BEFORE/AFTER into more stages, so that we can
+ but sure that all NEED's will override the rest, that USE will override
+ BEFORE/AFTER, and also check both the resolved and unresolved trees.
+
+ Also test if RUNLEVEL is '1' besides 'S', fixing 'init 1'.
+
+ Hack init.d/clock to wait for /dev/rtc if compiled as a module ... hopefully
+ udev will get sorted soon.
+
+ Try a workaround for the "mtime in future" issues we have with depscan.sh.
+
+* baselayout-1.12.0_pre4 (05 Aug 2005)
+
+ 05 Aug 2005; Roy Marples <uberlord@gentoo.org>:
+
+ Rationalise if/then/else login in runscript.sh svc_start() and svc_stop()
+
+ Fixed a few quoting issues in iwconfig
+ Use return values instead of capturing stderr output for iwconfig commands
+
+ Added # vim:ts=4 to all net-script files and re-indented
+
+ ${svcdir}/dep{cache,tree} are now chmodded 0644 so users can read them
+
+ 04 Aug 2005; Martin Schlemmer <azarah@gentoo.org>:
+
+ Update /sbin/rc to actually use init's single level, and also to launch
+ sulogin, bug #66834.
+
+ Fix a typo and some logic issues in new trace_dependencies().
+
+ Whitespace cleanups in new trace_dependencies().
+
+ Fix my own logic issue in new trace_dependencies().
+
+ 04 Aug 2005; Roy Marples <uberlord@gentoo.org>:
+
+ interface state directories are now created with -m 0755 to ensure that
+ everyone can read them
+
+ rc-daemon.sh now supports multiple cmds - partial fix for #98745
+
+ trace_dependencies gets a re-write (again) to try and solve the hanging
+ issues that many people are reporting
+
+ More anal about RHS quoting
+
+ 02 Aug 2005; Roy Marples <uberlord@gentoo.org>:
+
+ 0 timeout now means infinite for wpa_supplicant and iwconfig wrt #90443
+
+ iwconfig no longer downs and ups the interface after a scan - instead we
+ set essid any just before doing it
+
+ 01 Aug 2005; Roy Marples <uberlord@gentoo.org>:
+
+ dhclient now has to be told it can edit dhclient.conf instead of assuming
+ it. Final fix to #100745.
+
+ Tweaked module depends to fix order when no dhcp client is found.
+
+ rc-daemon now works with mysql - fixes #100982, thanks to bju from the
+ forums.
+
+ We now only link /etc/{resolv,ntp,yp}.conf when the file exists.
+ We now link back everything in the state dir except for .sv files.
+
+ 30 Jul 2005; Roy Marples <uberlord@gentoo.org>:
+
+ Fixed associate_order "forcepreferred" #100799, thanks to Benoit Boissinot.
+
+ 29 Jul 2005; Roy Marples <uberlord@gentoo.org>:
+
+ Fixed dhclient sending hostname #100745, thanks to Benoit Boissinot.
+
+* baselayout-1.12.0_pre3 (29 Jul 2005)
+
+ 26 Jul 2005; Martin Schlemmer <azarah@gentoo.org>:
+
+ Remove the "parallel" depend stuff from the awk backend.
+
+ Remove the "parallel" depend stuff from the help.
+
+ 26 Jul 2005; Roy Marples <uberlord@gentoo.org>:
+
+ Removed the "parallel" depend for init scripts and related functions.
+ The RC_PARALLEL_STARTUP works well for all - no need for init scripts to
+ state if they parallel or not.
+
+ Removed loops from trace_dependencies for a nice speed boost.
+
+ Fixed failure in runscript.sh to proceed when a non needed dependency
+ (ie use, after, before) failed to start.
+
+ 25 Jul 2005; Martin Schlemmer <azarah@gentoo.org>:
+
+ If we do not have net services, check both boot and current runlevel for
+ net services in trace_dependencies(). Sort services and make sure they
+ are unique.
+
+ Fix the adding of dependencies to properly add netservices as 'net'.
+
+ 25 Jul 2005; Roy Marples <uberlord@gentoo.org>:
+
+ trace_dependencies no longer clobbers the net service.
+
+ RC_AUTO_INTERFACE no longer symlinks /etc/{resolv,ntp,yp}.conf when no.
+
+ 25 Jul 2005; Martin Schlemmer <azarah@gentoo.org>:
+
+ Do not restart dependencies on runlevel change if the service that needs
+ them are in the next runlevel.
+
+* baselayout-1.12.0_pre2 (22 Jul 2005)
+
+ 22 Jul 2005; Roy Marples <uberlord@gentoo.org>:
+
+ When a service is stopped, the IN_BACKGROUND variable is cleared
+ before any dependencies are stopped so they are not marked inactive.
+ The IN_BACKGROUND variable is then restored so the parent script can be
+ marked inactive.
+
+ 21 Jul 2005; Mike Frysinger <vapier@gentoo.org>:
+
+ Change the -l option to tar to --one-file-system #99775.
+
+ Add a --debug option to depscan.sh.
+
+ 21 Jul 2005; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix hangs in bootup, bug #99663.
+
+ 21 Jul 2005; Roy Marples <uberlord@gentoo.org>:
+
+ dhclient now sets the hostname correctly.
+
+ Fixed some start/stop/restart logic for #99663.
+
+ Stopped rc-status from checking failed and broken which no longer apply.
+
+ 20 Jul 2005; Mike Frysinger <vapier@gentoo.org>:
+
+ Make sure the X11 dirs are always created in /tmp #99679 by Marc Ballarin.
+
+ 20 Jul 2005; Roy Marples <uberlord@gentoo.org>:
+
+ Fixed <wpa_supplicant-0.4 support
+
+ Removed trailing tab from local.start - fixes #99624
+
+ Moved RC_AUTO_INTERFACE definition to /etc/conf.d/rc
+
+ 19 Jul 2005; Mike Frysinger <vapier@gentoo.org>:
+
+ Punt the cyrus/mysql/slocate/vpopmail users/groups to the
+ respective ebuilds.
+
+ Removed trailing tab from local.start - fixes #99624
+
+ 19 Jul 2005; Roy Marples <uberlord@gentoo.org>:
+
+ ${ESSID} and ${ESSIDVAR} are now available in predown() - fixes #99106
+
+ 18 Jul 2005; Roy Marples <uberlord@gentoo.org>:
+
+ Changed wpa-supplicant to wpa_supplicant when reporting that it is not
+ installed. Fixes #99381
+
+ Fixed some startup problems caused by a mixture of inactive +
+ begin_service/end_service functions.
+
+ 16 Jul 2005; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add Darwin support for start-stop-daemon, bug #82421.
+
+ 15 Jul 2005; Martin Schlemmer <azarah@gentoo.org>:
+
+ Do not run depmod in modules-update if System.map is missing, bug #59188.
+
+* baselayout-1.12.0_pre1 (14 Jul 2005)
+
+ 13 Jul 2005; Roy Marples <uberlord@gentoo.org>:
+
+ pump-0.8.21-r4 now creates ntp.conf by itself so the ntp.conf creation
+ code has been removed from the pump module and helper.
+
+ Moved wpa_supplicant and iwconfig et all from /usr/sbin to /sbin
+
+ 12 Jul 2005; Roy Marples <uberlord@gentoo.org>:
+
+ Added dhcp_eth0="nogateway" option, generic to all dhcp clients.
+ Fixes #98466
+
+ 11 Jul 2005; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add fix -r to unmount to be -n .. bug #98667, thanks to Patrick McLean.
+
+ 11 Jul 2005; Roy Marples <uberlord@gentoo.org>:
+
+ udhcpc/dhclient helpers no longer flush IPv6 addresses - fixes #98539
+
+ wpa_supplicant now marks service as stopped when using wpa_supplicant-0.4.x
+ and we have associated but failed to configure in the background.
+
+ 09 Jul 2005; Mike Frysinger <vapier@gentoo.org>:
+
+ Only remount the / filesystem readonly if it isn't already and don't
+ screw around with net filesystems #98405 in init.d/checkroot.
+
+ Add support for completely wiping out /tmp and in general clean up
+ the bootmisc file #56592.
+
+ Add back in support for mounting usbfs under usbgid #35860.
+
+ 09 Jul 2005; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add workaround for evms device names and 'RC_DEVICE_TARBALL="yes"'. Patch
+ by Olaf Niermann, bug #95799.
+
+ 07 Jul 2005; Roy Marples <uberlord@gentoo.org>:
+
+ Added "nosendhost" dhcp option so users can request not to send their
+ machines hostname by default. Fixes #98132 - Patch by Eli.
+
+ 04 Jul 2005; Roy Marples <uberlord@gentoo.org>:
+
+ Added a rename module to rename interfaces based on MAC address
+ (preferred) or current name. Fixes #76328
+
+ 03 Jul 2005; Roy Marples <uberlord@gentoo.org>:
+
+ Fixed module depends in net.lo
+
+ Remove the "no net scripts in boot runlevel" restriction as we now
+ have a hotplug policy setup instead
+
+ 02 Jul 2005; Roy Marples <uberlord@gentoo.org>:
+
+ net.lo no longer needs find or diff
+
+ 01 Jul 2005; Roy Marples <uberlord@gentoo.org>:
+
+ Minor tweaks to all dhcp modules - basically better quoting so that
+ the eval ${dhcpclient} calls work better
+
+ pump can now be backgrounded
+
+ Tweaked the dhcp helpers so that more code is shared
+
+ A few tweaks to runscript.sh and rc-services.sh to avoid races
+
+ bootmisc now cleans /var/lib/net-scripts/state/*
+
+ 30 Jun 2005; Roy Marples <uberlord@gentoo.org>:
+
+ pump can now use route metrics and store it's configs in
+ /var/lib/net-scripts/state/${iface}
+
+ 29 Jun 2005; Roy Marples <uberlord@gentoo.org>:
+
+ dhclient now parses dhclient_eth0 for -cf parameter to set ${cffile}
+ dhclient now strips lines starting with script and send host-name
+ from ${cffile} and adds send host-name "${HOSTNAME}"; at the top
+ To stop this behaviour, add dhclient_edit_config="no" to /etc/conf.d/net
+ Fixes #96322
+
+ Removed killing udhcpc hard as it now dies nicely
+
+ wireless.runlevel now works
+
+ 28 Jun 2005; Mike Frysinger <vapier@gentoo.org>:
+
+ Add davfs to the net list #97283 by Erik Grinaker.
+
+ 28 Jun 2005; Roy Marples <uberlord@gentoo.org>:
+
+ wpa_supplicant now respects the background=no option if
+ wpa_suppliant>=0.4.0 is installed
+
+ fixed network dependencies some more
+
+ You can now restart a script marked starting/inactive
+
+ Documented the use of the RC_USE_CONFIG_PROFILE variable in conf.d/rc
+
+ udhcpc now removes stale pidfiles and parses for -(h|H) instead of
+ just --hostname
+
+ 24 Jun 2005; Roy Marples <uberlord@gentoo.org>:
+
+ udhcpc now doesn't send hostname if it's set at the default of localhost
+
+ net.lo will not take down the interface if it does not exist and starting
+ failed to work
+
+ 21 Jun 2005; Roy Marples <uberlord@gentoo.org>:
+
+ interfaces can now dynamically add themselves to a bridge using
+ bridge_add_eth0="br0" - they are dynamically removed as well. Fixes #93321
+
+ 20 Jun 2005; Roy Marples <uberlord@gentoo.org>:
+
+ ifconfig now reports correct MAC address
+
+ ifconfig and iproute2 now support mtu_eth0 option
+
+ net.lo attemts to arping the requested address when RC_AUTO_INTERFACE==yes
+
+ iwconfig and wpa_supplicant now check rk_kill if available and produce a
+ suitable error if rf is killed #56430
+
+ added hotplug policy check for interface name #78495
+
+ 19 Jun 2005; Mike Frysinger <vapier@gentoo.org>:
+
+ Make sure /proc/cmdline is readable before using it in get_bootconfig()
+ in /sbin/functions.sh.
+
+ 17 Jun 2005; Roy Marples <uberlord@gentoo.org>:
+
+ Fixed VLAN documentation for working with eth0.1 style names #95121
+
+ tarball.sh now works with svn
+
+ dhclient and udhcpc now report any errors to stdout
+
+ RC_DEVICE_TARBALL now defaults to "no"
+
+ STYLE updates to all modules
+
+ 16 Jun 2005; Mike Frysinger <vapier@gentoo.org>:
+
+ Add lmtp as an alias to the 2003 tcp port #96190.
+
+ Add support for Xen to clock init.d #96240 by Christopher G. Stach II.
+
+ When we mount readonly, make sure we don't attempt the same mountpoint
+ twice #96259 by Toralf Förster.
+
+ 14 Jun 2005; Roy Marples <uberlord@gentoo.org>:
+
+ dhclient now calls /etc/dhcp/dhclient-exit-hooks when it exits
+ fixes #96000
+
+ 13 Jun 2005; Roy Marples <uberlord@gentoo.org>:
+
+ /etc/{resolv,ntp,yp}.conf now link to /var/lib/net-scripts
+
+ 13 Jun 2005; Mike Frysinger <vapier@gentoo.org>:
+
+ Remove etc/ppp since the ppp package provides this stuff.
+
+ 05 Jun 2005; Mike Frysinger <vapier@gentoo.org>:
+
+ Run sysctl in quiet mode so we don't force errors to /dev/null.
+
+ 02 Jun 2005; Roy Marples <uberlord@gentoo.org>:
+
+ dhcp helper module fixes
+
+ dhcpcd-backgrounder renamed to dhcpcd-wrapper
+
+ dhcpcd-wrapper applies dns_search_domains_* to /etc/resolv.conf
+ fixes #94027 when used with dhcpcd-1.3.22_p4-r10
+
+ dhcpcd module now applies route metric if possible
+
+ 01 Jun 2005; Roy Marples <uberlord@gentoo.org>:
+
+ removed cruft from net-scripts functions helper as rc-services.sh can
+ now be sourced by our dhcp helpers without causing errors.
+
+ system module now creates it's temporary files in /tmp instead of /etc
+
+ 31 May 2005; Mike Frysinger <vapier@gentoo.org>:
+
+ Add support for bootlogging (via blogd in showconsole package).
+
+ Rewrite the modules.autoload code in init.d/modules to work off the
+ current arbitrary kernel version #35872.
+
+ 29 May 2005; Mike Frysinger <vapier@gentoo.org>:
+
+ Make sure we quote EDITOR in /etc/profile #94412 by Stanislav Brabec.
+
+ 27 May 2005; Roy Marples <uberlord@gentoo.org>:
+
+ Added macnet module (like essidnet but for mac addresses)
+ Regresses macchanger one version
+ Tweaked module depends for macnet
+ dhcp helper now uses macnet
+
+ is_net_fs now works with what $1 was mounted as, not would it would
+ be remounted as - fixes #53104
+
+ 26 May 2005; Roy Marples <uberlord@gentoo.org>:
+
+ report ${myservice} instead of $0 when disallowing net scripts to work in
+ the boot runlevel - fixes #91534
+
+ You can now configure all options via the MAC address of your network card
+ and the MAC address of AP you connect to like so
+ config_001122334455=( "192.168.0.2/24 brd +")
+ Fixes the last part of #52975
+
+ The old way of configuring for the MAC address of the AP is no longer
+ supported
+
+ 25 May 2005; Mike Frysinger <vapier@gentoo.org>:
+
+ Add gfs to the NET_FS_LIST #93911 by Thomas Rasch.
+
+ 25 May 2005; Roy Marples <uberlord@gentoo.org>:
+
+ networking now expands configuration parameters - fixes #91564
+ so config_eth0=( "192.168.{1..3}.{1..3}/24 brd +" ) expands into
+ config_eth0=(
+ "192.168.1.1/24 brd +"
+ "192.168.1.2/24 brd +"
+ "192.168.1.3/24 brd +"
+ "192.168.2.1/24 brd +"
+ "192.168.2.2/24 brd +"
+ "192.168.2.3/24 brd +"
+ "192.168.3.1/24 brd +"
+ "192.168.3.2/24 brd +"
+ "192.168.3.3/24 brd +"
+ )
+
+ updated ESSID variables example in wireless.example - fixes #92469
+
+ 21 May 2005; Martin Schlemmer <azarah@gentoo.org>:
+
+ Quiet down valid_i() if ${svcdir}/softlevel do not yet exist, try #2.
+
+ 20 May 2005; Roy Marples <uberlord@gentoo.org>:
+
+ fix ifconfig to understand CIDR addresses - bug #93237
+ iproute2 now works out broadcast addresses
+
+ added #!/bin/bash or #!/bin/sh to modules and helpers so they now get
+ nice syntax highlighting and indenting
+
+ 20 May 2005; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fixup sbin/{depscan.sh,modules-update} to use is_older_than() for mtime
+ logic. Some small tweaks regarding 2.6 systems and modules-update.
+
+ 19 May 2005; Roy Marples <uberlord@gentoo.org>:
+
+ Merged Paul Pacheco's parallel startup #69854 and modules update
+ #55329 patches
+
+ If RC_PARALLEL_STARTUP==yes then we no longer output einfo/ebegin
+ messages as they don't line up on screen correctly - instead we output
+ service ${myservice} starting/started/stopping/stopped/failed
+
+ 17 May 2005; Mike Frysinger <vapier@gentoo.org>:
+
+ Make sure /dev is mounted with exec since many video drivers need to
+ mmap() device nodes in there with exec access #92921 by Lachlan Pease.
+
+ 16 May 2005; Mike Frysinger <vapier@gentoo.org>:
+
+ If halt/reboot failed, try to force it as a fallback.
+
+ Add RC_FORCE_AUTO setting so people can try to minimize amount of
+ user interaction required for booting.
+
+ Move nsswitch.conf to glibc.
+
+ 15 May 2005; Roy Marples <uberlord@gentoo.org>:
+
+ udhcpc and dhclient now select the best interface when one goes down
+
+ 14 May 2005; Mike Frysinger <vapier@gentoo.org>:
+
+ Make sure /dev is mounted with sane permissions #87745 by Jordan.
+
+ When we search /etc/fstab for /, make sure we handle mounts that have
+ UUID/LABEL info in them #90603 by Alessandro Sappia.
+
+ Simplify rc-script error checking so we don't need a tempfile and so
+ non-root users can run /etc/init.d/status #85892 by Stuart Shelton.
+
+ Add a sanity check for devs who write bad scripts and call exit #85298.
+
+ Run irqbalance after /var is rw #85304 by Miroslaw Mieszczak.
+
+ Redo the addon code to prepare for profiling support #74425.
+
+ 12 May 2005; Mike Frysinger <vapier@gentoo.org>:
+
+ Move pam files out of baselayout and into packages #92387.
+
+ 10 May 2005; Martin Schlemmer <azarah@gentoo.org>:
+
+ Really fix trace_dependencies() to handle net.* services properly.
+
+ Quiet down valid_i() if ${svcdir}/softlevel do not yet exist.
+
+ 10 May 2005; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix get_service_index() being off by one. Fix trace_dependencies() to also
+ take "net" into regard if its a net_service. This fixes two problems, first
+ shutdown should bring services down that uses net before the net.* services,
+ and secondly '/etc/init.d/net.eth0 needsme', etc should now work properly.
+ All changes to sbin/rc-services.sh.
+
+ 03 May 2005; Roy Marples <uberlord@gentoo.org>:
+
+ changed default indentation to 2 spaces to match rcscripts in functions.sh
+
+ wpa_supplicant now stops wpa_cli before wpa_supplicant to fix a potential
+ future error
+
+ 02 May 2005; Roy Marples <uberlord@gentoo.org>:
+
+ Fix user function hooks for echoing to stdout and protecting our vars
+
+ 30 Apr 2005; Martin Schlemmer <azarah@gentoo.org>:
+
+ Do not create the udev devices.tar.bz2 if we do not have write permissions
+ for /. Request by Donnie (spyderous) for boxes with / on NFS.
+
+ 30 Apr 2005; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fixor column/color logic for when used in portage.
+
+ 29 Apr 2005; Mike Frysinger <vapier@gentoo.org>:
+
+ Move crypto-loop to util-linux and skel bash files to bash.
+
+ 28 Apr 2005; Mike Frysinger <vapier@gentoo.org>:
+
+ Export the 'service name' for init scripts #86348.
+
+ 28 Apr 2005; Martin Schlemmer <azarah@gentoo.org>:
+
+ If no /etc/modules.conf exist, do not 'touch' it, but create a new
+ file with the 'modules-update header' in it to get modules-update
+ to do the right thing (regen), and not just quit (init.d/modules).
+
+ 27 Apr 2005; Mike Frysinger <vapier@gentoo.org>:
+
+ Ignore trailing comments in module files #88553.
+
+ 26 Apr 2005; Mike Frysinger <vapier@gentoo.org>:
+
+ Sync special var's with portage's env-update.sh and ours #88819.
+
+ 26 Apr 2005; Roy Marples <uberlord@gentoo.org>:
+
+ wpa_supplicant now supports wpa_supplicant-0.4.0
+
+ iwconfig downs and ups the interface after a scan
+
+ 25 Apr 2005; Roy Marples <uberlord@gentoo.org>:
+
+ iproute2 now handles mtu the same way as ifconfig - fixes #90242
+
+ net.lo no longer errors when using postdown and postup functions
+
+ 22 Apr 2005; Roy Marples <uberlord@gentoo.org>:
+
+ Address network routes now get metrics applied as well
+ (ie a route automatically added when an address is added)
+
+ net.lo no longer errors when exlcuding modules who are installed
+
+* rc-scripts 1.7.1 (19 Apr 2005)
+
+ 18 Apr 2005; Roy Marples <uberlord@gentoo.org>:
+
+ Changed "sed -ne" to "sed -n -e" for portability.
+
+ Added auto_interface (default yes).
+ if auto_interface is yes then we
+ *) default to dhcp
+ *) automatically calculate a metric (this may need work)
+ *) select the best interface based on metric
+ (restore resolv.conf, ntp.conf and yp.conf we have saved)
+ otherwise we
+ *) default to null
+
+ wpa_supplicant no longer kills itself when we're not stopping the interface
+ it's running on.
+
+ wpa_supplicant now uses wpa_monitor (yet to be released) if available.
+
+ Added a new module called system which enables the definition of domain
+ name, dns servers, ntp servers, nis domain and nis servers per interface.
+ essidnet and dhcp helpers have been re-coded around this module.
+
+ 15 Apr 2005; Chris Gianelloni <wolf31o2@gentoo.org> -bin/bashlogin,
+ -sbin/livecd-functions.sh:
+ Removed sbin/livecd-functions.sh and bin/bashlogin as they are only used in
+ release building, and they have been moved to livecd-tools.
+
+ 14 Apr 2005; Martin Schlemmer <azarah@gentoo.org>:
+
+ Do not kill udevd in /sbin/rc, as it is apparently evil.
+
+ 14 Apr 2005; Roy Marples <uberlord@gentoo.org>:
+
+ Fixed ifconfig and iproute2 erroring from new lo code - fixes #88006
+
+ If /proc/net/netlink does not exist then iproute2 will fail the
+ check_installed function with an appropriate error - Thanks to
+ Jeremy Huddleston for the patch.
+
+ If /proc/net/packet does not exist then wpa_supplicant will fail
+ check_installed function with an appropriate error
+
+ Background fixes for net.lo, udhcpc and wpa_supplicant
+
+ 11 Apr 2005; Roy Marples <uberlord@gentoo.org>:
+
+ removed ${devnull} from net.lo and net-script modules
+ updated all modules not to re-direct stderr where appropriate
+
+ iwconfig and wpa_supplicant now save their current ESSID via save_options
+ and reload it in their pre_stops so that ${ESSID} and ${ESSIDVAR} can be
+ used in users custom postdown functions
+
+ wpa_supplicant now calls iwconfig_defaults and iwconfig_user_config
+ if available - fixes #88703
+
+ 09 Apr 2005; Mike Frysinger <vapier@gentoo.org>:
+
+ Have the 'status' function return 0/1 based upon the status of the
+ init script #88319 by Josh Nichols.
+
+ 08 Apr 2005; Roy Marples <uberlord@gentoo.org>:
+
+ added a bash_variable to functions.sh which converts the given string
+ into a variable that bash can use - fixes #88175
+
+ net scripts can only launch if we're not in ${BOOTLEVEL} - fixes #78495
+
+ 01 Apr 2005; Roy Marples <uberlord@gentoo.org>:
+
+ RC_DAEMON_syslog_ng allows syslog-ng to be started with the specified
+ launcher - like valgrind or strace. Handy for debugging/auditing.
+ Thanks to Rob Holland for the idea.
+
+ Stopped setting ESSID in predown functions in iwconfig and wpa_supplicant
+ as there is no guarantee that the current ESSID is the one we started with
+ Also, we may not have an ESSID at all...
+
+ 23 Mar 2005; Roy Marples <uberlord@gentoo.ord>:
+
+ bridge stops removing IP addresses from bridge ports.
+ iwconfig no longer tries to get an ESSID from non-wireless interfaces.
+ ifconfig no longer errors when deleting addresses on a non-existant
+ interface.
+
+ 23 Mar 2005; Martin Schlemmer <azarah@gentoo.org>:
+
+ Get modules-update to clean up after itself if we on a 2.6 kernel without
+ modules.conf.
+
+ 22 Mar 2005; Roy Marples <uberlord@gentoo.org>:
+
+ revamped rc-services.sh for STYLE updates and code rationalisation.
+
+ 21 Mar 2005; Roy Marples <uberlord@gentoo.org>:
+
+ udhcpc now checks for custom hostname correctly
+
+ 21 Mar 2005; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix tracing for current service as list_depend_trace() was removed.
+ Fix mylevel not being set if valid_iuse(), etc is called from /sbin/rc.
+
+ 20 Mar 2005; Martin Schlemmer <azarah@gentoo.org>:
+
+ Take sort_services function from bug #70009, and fix the removing of a
+ service from a array properly by using unset. Use this instead of the
+ trace_* stuff, and fixup shutdown order.
+
+ 19 Mar 2005; Mike Frysinger <vapier@gentoo.org>:
+
+ Make sure we mount svcdir with 0755 and not 0644 #85888.
+
+ 15 Mar 2005; Martin Schlemmer <azarah@gentoo.org>:
+
+ Export myservice when starting critical services, as its needed by
+ some of the addons (dmcrypt for example).
+
+ 12 Mar 2005; Mike Frysinger <vapier@gentoo.org>:
+
+ When shutting down, pass -h to halt too #84654 by Dmitry Karasik.
+
+ 11 Mar 2005; Roy Marples <uberlord@gentoo.org>:
+
+ Prepend rc-daemon.sh functions with rc_ to avoid name conflicts
+
+ 11 Mar 2005; Martin Schlemmer <azarah@gentoo.org>:
+
+ Make sure the last test in init.d/modules do not bork the return
+ value of the script if not true.
+
+ 10 Mar 2005; Mike Frysinger <vapier@gentoo.org>:
+
+ Add udev/selinux support by Chris PeBenito #84337.
+
+ 10 Mar 2005; Martin Schlemmer <azarah@gentoo.org>:
+
+ The system() stuff in *depends.awk should be dosystem().
+
+* rc-scripts 1.7.0 (10 Mar 2005)
+
+ 09 Mar 2005; Roy Marples <uberlord@gentoo.org>:
+
+ changed from $( cat ${file} ) to $( < ${file ) in net-scripts
+
+ fixed ChangeLog corruption
+
+ rc-daemon.sh now works with the env program
+
+ 08 Mar 2005; Roy Marples <uberlord@gentoo.org>:
+
+ rc-services.sh now does a /sbin/depscan.sh -u if we have not got
+ our deptree loaded
+
+ removed net_start/stop function from net.lo, bridge and bonding
+
+ net.lo now supports depend() per interface like so
+ depend_br0() { need net.eth0 net.eth1 }
+
+ 04 Mar 2005; Roy Marples <uberlord@gentoo.org>:
+
+ applied STYLE updates to rc-status
+
+ rc-status now uses find correctly for -maxdepth which fixes #84055
+
+ 03 Mar 2005; Roy Marples <uberlord@gentoo.org>:
+
+ iwconfig now defaults the transmit key to 1
+ bridging and bonding modules now start an interface if it's not
+ marked as started
+
+ 02 Mar 2005; Roy Marples <uberlord@gentoo.org>:
+
+ net_service() now returns 1 for non net-services
+ fixes bug #83352
+
+ 02 Mar 2005; Aron Griffis <agriffis@gentoo.org>:
+
+ Add requote() to functions.sh to help rc-daemon.sh
+
+ 01 Mar 2005; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix braindead logic in init.d/checkfs ([[ -z $CDBOOT ]] &&, not -n).
+
+ 01 Mar 2005; Roy Marples <uberlord@gentoo.org>
+
+ rc-daemon.sh now provides a working wrapper for start-stop-daemon
+ fixes bug #7198
+
+ removed ps calls from net scripts
+
+ 25 Feb 2005; Chris Gianelloni <wolf31o2@gentoo.org>
+
+ Updated livecd-functions.sh to match what we are using on the LiveCD.
+
+ 25 Feb 2005; Martin Schlemmer <azarah@gentoo.org>:
+
+ Style updates for init.d/halt.sh.
+
+ Only run pam_console_apply if we are actually using pam_console.
+
+ Fix init.d/checkfs, init.d/localmount and init.d/halt.sh to call
+ start_addon, stop_addon, start_volumes and stop_volumes.
+
+ 24 Feb 2005; Martin Schlemmer <azarah@gentoo.org>:
+
+ Update /sbin/modules-update to work without modprobe.old (modutils) for
+ 2.6 kernels.
+
+ Update /etc/init.d/modules so that it will only touch modules.conf if we
+ have a <= 2.4 kernel, or have /sbin/modprobe.old.
+
+ 23 Feb 2005; Martin Schlemmer <azarah@gentoo.org>:
+
+ Remove RAID/LVM/EVMS2/dm-crypt from checkfs and localmount, and
+ add needed {start,stop}-volumes() and {start,stop}-addons().
+
+ Add use tempory file for deptree, bug #48303, thanks to patch from
+ Stefan Hoefer <stefan@hoefer.ch>.
+
+ Add {start,stop}-volumes() to /sbin/functions.sh, as well as
+ RC_VOLUME_ORDER to /etc/conf.d/rc.
+
+ 21 Feb 2005; Mike Frysinger <vapier@gentoo.org>:
+
+ Move the serial init.d to the setserial package.
+
+ Create a rc-status.8 manpage #81917.
+
+ 11 Feb 2005; Mike Frysinger <vapier@gentoo.org>:
+
+ Add UPS kill fixes for halt.sh by Lee Weisz / Remy Blank #46440.
+
+ Define a few more {for,back}ward-word bindings in inputrc to fix up
+ the different GUI terminals #53770 by Arturo Alberto Busleiman.
+
+ 10 Feb 2005; Roy Marples <uberlord@gentoo.org>:
+
+ net.lo now supports fallback_route - fixes #75676
+ due to bash limitations, only one fallback route is supported
+
+ cleaned up dhcp helper
+
+ iproute now appends routes instead of adding them - this allows multiple
+ default routes
+
+ RC_STRICT_NET_CHECKING now supports the none "option" which means
+ that the net service is always up
+
+ 31 Jan 2005; Mike Frysinger <vapier@gentoo.org>:
+
+ Punt the PROTOCOL variable from rc.conf since nothing uses it.
+
+ Punt the consolefont related variables from rc.conf since they've
+ been moved to conf.d/consolefont.
+
+ Import some VServer support from #55973. For now, just add the
+ detection function to functions.sh and support in init.d/clock.
+
+ 07 Feb 2005; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix /sbin/functions.sh not to run stty during 'emerge depend'.
+
+ 07 Feb 2005; Roy Marples <uberlord@gentoo.org>:
+
+ netmask2cidr now works correctly - fixes #81119
+ Thanks to Benoit Boissinot for the patch
+
+ 06 Feb 2005; Mike Frysinger <vapier@gentoo.org>:
+
+ Remove the apache user and let apache ebuilds handle it #77738.
+
+ 04 Feb 2005; Roy Marples <uberlord@gentoo.org>:
+
+ It's now possible to configure addresses and routes for the loopback
+ interface if required - however you cannot override our defaults
+
+ wpa_supplicant and iwconfig now loop for 5 seconds if essid is
+ not returned straight away
+
+ 31 Jan 2005; Mike Frysinger <vapier@gentoo.org>:
+
+ Fix the test for device-mapper in checkfs #80206.
+
+ Change home of man to /usr/share/man.
+
+* rc-scripts 1.6.9 (30 Jan 2004)
+
+ 30 Jan 2005; Mike Frysinger <vapier@gentoo.org>:
+
+ Use clock, don't need it. Not everyone has a RTC #78997.
+
+ Rewrite the KV_* functions to use pure bash rather than awk #75836.
+
+ Don't use 'none' when mounting virtual filesystems since `umount` can
+ produce some pretty vague output #78684. Fixed sbin/rc and etc/fstab
+ and etc/halt.sh to handle the new format.
+
+ modules-update.8 touchups by Benno Schulenberg #77582.
+
+ Don't symlink /etc/filesystems since it is an user config file #74176.
+
+ Punt the 'guest' user #74737.
+
+ Add support for loopback dm-crypt by Dylan Carlson #73598 and for gpg
+ dm-crypt by Lars Strojny #75659.
+
+ Update crypto-loop to newer util-linux #40874 by jochen / Jürgen Hötzel
+
+ 27 Jan 2005; Roy Marples <uberlord@gentoo.org>:
+
+ removed udhcpc-* and dhclient-* helper modules and replaced them with a
+ generic dhcp module which caters for all interfaces and dhcp clients that
+ need it.
+ We now prefer iproute2 over ifconfig if both are installed.
+
+ 24 Jan 2005; Roy Marples <uberlord@gentoo.org>:
+
+ replaced awk commands with sed equivalents in net-scripts to make us
+ more portable
+ STYLE fixes to many net-scripts modules
+ Removed hardcoded Version and replaced with cvs $Header:
+
+ 17 Jan 2005; Roy Marples <uberlord@gentoo.org>:
+
+ net.lo changed logic to read "only fail if no configuration parameters
+ work, bring interface down and abort". Fixes #78092
+ all modules should now check interface existance correctly - fixes #76385
+ wpa_supplicant now works with EAP - fixes #78367
+
+ 13 Jan 2005; Roy Marples <uberlord@gentoo.org>:
+
+ wpa_supplicant forces ctrl_interface to /var/run/wpa_supplicant
+ and removes stale directories
+ clean_pidfile function no longer errors on empty pidfiles
+ net dependancies corrected in runscript.sh - fixes #77839
+ allow pure IPv6 addresses - fixes #73844
+
+ 12 Jan 2005; Roy Marples <uberlord@gentoo.org>:
+
+ net.lo now ignores dot files when loading modules
+ ipppd module now stops correctly - fixes #73067 again
+
+ 11 Jan 2005; Roy Marples <uberlord@gentoo.org>:
+
+ added "noop" config parameter which means take no action if the interface
+ is up and has an address configured, otherwise continue
+ addresses are now removed when starting an interface - fixes #77111
+
+ 06 Jan 2005; Roy Marples <uberlord@gentoo.org>:
+
+ ifconfig, udhcpc-ifconfig now deletes addresses using 0.0.0.0 for uclibc
+ - fixes #76846
+
+ 04 Jan 2005; Roy Marples <uberlord@gentoo.org>:
+
+ bridge now marks interfaces as UP - fixes #75354
+ bridge, net.lo, iwconfig touched up to match new STYLE
+ net.lo tests the return value of modprobe - fixes #76385
+ iwconfig now sets enc keys through an eval statement - fixes #76601
+ updated wireless.example for whitespace in keys
+ iwconfig now accepts mode "auto" and defaults to it
+
+ 30 Dec 2004; Mike Frysinger <vapier@gentoo.org>:
+
+ Touch up rc-update to match our new STYLE. Also tweak the help
+ to fit in the standard console.
+
+ 23 Dec 2004; Mike Frysinger <vapier@gentoo.org>:
+
+ Merge a bunch of BSD fixes into our .c files.
+
+ 18 Dec 2004; Roy Marples <uberlord@gentoo.org>:
+
+ iwconfig now sets ESSIDVAR for master/ad-hoc modes - fixes #74802
+
+ 17 Dec 2004; Roy Marples <uberlord@gentoo.org>:
+
+ wpa_supplicant - fixed file location for wpa_cli and association test
+ as it they changed in wpa_supplicant-0.3.x
+ wpa_supplicant now brings the interface up before launching - fixes #74637
+
+* rc-scripts 1.6.8 (15 Dec 2004)
+
+ 15 Dec 2004; Mike Frysinger <vapier@gentoo.org>:
+
+ start_critical_service in /sbin/rc should rely on $1 instead of
+ the external variable $x for the service name. #74425
+
+ 15 Dec 2004; Roy Marples <uberlord@gentoo.org>:
+
+ rc-status now reports stopping status
+ Updated documentation to point non-usb linux-wlan-ng users to use
+ hostap-driver instead
+
+ 13 Dec 2004; Martin Schlemmer <azarah@gentoo.org>:
+
+ Tweak init.d/halt.sh to support new text based udev_db ('udevinfo -d' do
+ not work anymore, and there is no space after '(S|N):'). Also check if
+ devices.tar.bz2 is empty before trying to create it, bug #71143.
+
+ 12 Dec 2004; Mike Frysinger <vapier@gentoo.org>:
+
+ Tweak get_mount_fstab to only print the first mount point found and then
+ spit warning messages for extra matches. Also add support for RC_USE_FSTAB
+ so normal users don't have to worry about a broken /etc/fstab.
+
+ Add an additional sanity check to the udev tarball usage. Don't try to
+ unpack an empty or non-existant tarball.
+
+ Tweak the 'static' description so users know they can use it to make
+ /sbin/rc ignore /dev completely.
+
+ 12 Dec 2004; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add suport for using /sbin/udevsend from new udev-048 as hotplug multiplexer.
+
+ 12 Dec 2004; Roy Marples <uberlord@gentoo.org>:
+
+ fixed installed typo in net.lo - fixes #74152. Thanks to Federico Galassi
+
+ dhcpcd and udhcpc now run via the eval statement so quotes can be used
+ in options. Fixes #74053 - thanks to Evan Buswell
+
+ 09 Dec 2004; Roy Marples <uberlord@gentoo.org>:
+
+ fixed net.lo getting vlan config
+ rc doesn't stop hotplugged devices when system is booting - fixes #61594
+ thanks to Andreas Sundebo for the fix
+ rc-status now reports stopping
+
+ 08 Dec 2004; Roy Marples <uberlord@gentoo.org>:
+
+ iwconfig now unsets wireless config and downs interface when backgrounding
+ fails
+ wpa_supplicant now supports backgrounding
+ removed is_in_fstab function and replaced with get_mount_fstab which
+ returns a mount command based on the contents of fstab. Resolves bugs
+ #70044 and #73762
+
+ 07 Dec 2004; Roy Marples <uberlord@gentoo.org>:
+
+ essidnet - fixed setting up search domains
+ ifconfig now reads the old gateway variable correctly - fixes #73641
+ iwconfig now supports backgrounding
+ ifconfig and iproute2 now support function interface_set_mac_address
+ macchanger no longer depends on macchanger if configuring a specific
+ mac address
+
+ fix depstop for net-services when system is booting - should fix #61594
+ added service_stopped function to make reading code easier and trying
+ to avoid race conditions
+
+ 06 Dec 2004; Roy Marples <uberlord@gentoo.org>:
+
+ macchanger defaults to setting the interface down, and then trying
+ with it up - fixes #71929
+ macchanger converts mac_${IFACE} to lowercase - fixes #73549
+ iproute2 now configures the interface up everytime we add an address
+ removed "need interface" from all modules depends as net.lo requires
+ interface anyway
+ removed hardcoded ath0 in wpa_supplicant
+
+ added rc-script statuses "starting", "stopping" and "inactive"
+ dhcpcd, udhcpc and dhclient now support backgrounding - fixes #52975
+
+ 05 Dec 2004; Roy Marples <uberlord@gentoo.org>:
+
+ dhclient now kill it's process if it failed to get a lease on startup
+ all dhclient responses are now handled correctly
+
+ 04 Dec 2004; Roy Marples <uberlord@gentoo.org>:
+
+ fixed dhclient-ifconfig to look for dhclient-udhcpc-wrapper in the correct
+ place and changed hardcoded eth1 to ${interface} in udhcpc-ifconfig.
+ Fixes #73327 - thanks to Benoit Boissinot
+
+ essidnet gets the essid itself instead of relying on ${ESSID}
+ wpa_supplicant module added
+ config-system now creates files as .tmp instead of .new and loads
+ the wpa_supplicant module if needed
+ ifconfig now addes aliases to devices other than eth0
+ dhcpcd, dhclient, pump and udhcpc now expose the dhcp_${IFACE} variable
+ instead of the old peer_dns_${IFACE}, peer_ntp_${IFACE}, peer_nis_${IFACE}
+ ones
+
+ removed modules use dependancy in net.lo and added installed
+ - this allows use to provide "virtual" modules which are only "installed"
+ when other depended modules are installed
+
+* rc-scripts 1.6.7 (03 Dec 2004)
+
+ 03 Dec 2004; Mike Frysinger <vapier@gentoo.org>:
+
+ Simply filesystem unmounting in halt.sh. Based upon work by Georg Sauthoff
+ #68697. Also clean up the filesystem remounting readonly. As a last
+ resort to filesystems which won't remount readonly, we try to unmount them
+ with the force/readonly options. Idea from #70349.
+
+ 03 Dec 2004; Roy Marples <uberlord@gentoo.org>:
+
+ Fixed config-system for only changing hostname when needed
+ udhcpc and dhclient now restore saved configs when stopping and work
+ with non-infinite leases
+ Moved generic dhcp options into a space seperated string
+ udhcpc now caches it's IP address and requests it the next time it starts
+ if the address is not released
+ udhcpc and dhclient no longer flush interfaces if we don't need too
+ ipppd module now looks for ipppd in /usr/sbin - fixes #73067
+
+ 02 Dec 2004; Mike Frysinger <vapier@gentoo.org>:
+
+ Merge time checking function (is_older_than) to help simplify config
+ file update checking. Used for now in env-update.sh #71285. Function
+ written by Paul Pacheco #55329.
+
+ 02 Dec 2004; Roy Marples <uberlord@gentoo.org>:
+
+ Added option dhcp_release to specify if we release the DHCP lease or not
+ defaults to no
+ Changed variables peer_* to dhcp_*
+ dhclient and udhcpc now specify a pidfile
+ Fixed iwconfig report if iwgetid does not support --channel
+
+ 01 Dec 2004; Mike Frysinger <vapier@gentoo.org>:
+
+ Refix and clean up the netmount script to kill processes #64034.
+
+ 01 Dec 2004; Roy Marples <uberlord@gentoo.org>:
+
+ Documentation fixes regarding iwconfig and linux-wlan-ng
+ Fixed bonding deps per bug #71419
+
+ 30 Nov 2004; Mike Frysinger <vapier@gentoo.org>:
+
+ Fix the UML/coLinux check in init.d/clock #72937.
+
+ Allow the user to override the default mount options via /etc/fstab
+ for all the mounts. Added a 'is_in_fstab' function to see if the
+ user has defined the mount, and if not, fall back to the hardcoded
+ stuff from before. This also lets us get rid of $RC_DEVICE_FS #70044.
+
+ 26 Nov 2004; Roy Marples <uberlord@gentoo.org>:
+
+ Fixed up address detection in apipa
+ net.lo now checks for duplicate static IPv4 addresses before assigning
+ iwconfig now supports preassociate and postassociate user hooks
+ net.example - changed $1 to ${IFACE} in examples
+ clarified lack of linux-wlan-ng support
+
+ 24 Nov 2004; Mike Frysinger <vapier@gentoo.org>:
+
+ Allow users to specify charset option to dumpkeys when using unicode
+ in conf.d/keymaps #72225. Also move all the init.d/keymap specific
+ options out of rc.conf and into conf.d/keymaps and add some config
+ checks to init.d/keymaps like the clock/hostname init.d scripts.
+
+ Make sure /etc/rc.conf overrides conf.d files when starting up
+ critical services. Should help out with transition from rc.conf.
+
+ 24 Nov 2004; Roy Marples <uberlord@gentoo.org>:
+
+ Ensure all net-scripts modules depend on interface_variable function
+ where applicable
+ Fixed adsl stopping - #68934. Thanks to Andreas Kauer
+
+ 23 Nov 2004; Roy Marples <uberlord@gentoo.org>:
+
+ iproute2 does not need to create dummy interfaces for aliases
+ unlike ifconfig so we no longer do this
+ We now bring down all aliases and addresses properly
+ Split off some functions from net.lo into helpers.d/functions
+ so that our DHCP helper scripts can use them too :)
+ Deprecated interface specific setup in favour of a generic config
+ macchanger brings interface up now - fixes #71929
+ DHCP over VLAN now works - fixes #71860
+ Disabled modified function checking as it's far too expensive on CPU
+ and still isn't 100% reliable
+ When specifing a module that isn't emerged, you now get an error
+ telling you what to emerge
+ Removed -p option from the diff call used for function removal
+ Removed rp_filter setting - fixes first part of bug #71971
+ Added sysctl.conf settings relating to rp_filter to sysctl.conf
+ - fixes last part of bug #71971
+ Fixed pump exporing ntp servers
+ implemented MODULES_DIR so we can change directory we load from on the fly
+ fixed variables for vlans in most modules
+
+ 19 Nov 2004; Aron Grffis <agriffis@gentoo.org>:
+
+ Remove crap "ll" and "d" aliases from skel .bashrc
+
+ 19 Nov 2004; Roy Marples <uberlord@gentoo.org>:
+
+ tests for hostname (none) when sending hostname via dhcpcd, udhpc or pump
+ udhcpc now does correct signal handling so we can release leases and
+ terminate cleanly
+ Improved pump process detection
+ Rewrote udhcpc helper scripts around udhcpc and wrapped dhclient to udhcpc
+ scripts. This makes things much saner as udhcpc is much saner - also fixed
+ essidnet and ipv6 local link for them.
+ removed iproute2 udhcpc reliance on the "bc" command
+
+ 17 Nov 2004; Roy Marples <uberlord@gentoo.org>:
+
+ Fixed invalid variable handling in bonding and vlan - bug #71419
+ apipa now brings the interface up before testing if address exists
+ Updated bonding documentation - bug #71419
+ Fixed iproute2 adding addresses for vlans - bug #71419
+ ifconfig handle inet6 routing automatically - bug #33310
+ ifconfig - fixed old gateway + gateway in routes conflict
+ iproute2 cleaned up some functions
+
+ 16 Nov 2004; Roy Marples <uberlord@gentoo.org>:
+
+ We no longer default a fallback to APIPA when no config is given
+ net.example fleshed out a bit more for dhcpcd - fixes #60845
+ Improved forced module handling a touch
+ modules_sort and modules_check_user in net.lo buffer _provides,
+ _before and _after in arrays to avoid shelling out
+
+ 15 Nov 2004; Mike Frysinger <vapier@gentoo.org>:
+
+ Add a check to clock init.d to make sure users dont try to set
+ config their clock in rc.conf anymore.
+
+ Redo hostname/domainname scripts to use files in /etc/conf.d/
+ instead of creating files in /etc/. Allows for controlling things
+ like the behavior of setting the 'domain' in resolv.conf since users
+ may not always understand exactly what's going on.
+
+ Stop referring to conf.d/basic as a global rc config option. That
+ file hasn't been used in a long time and has since been replaced
+ with env.d/00basic. Updated sbin/runscript.sh, etc/profile,
+ sbin/rc-help.sh, and src/awk/cachedepends.awk.
+
+ Run `find | xargs` instead of `find -exec`. Much better performance
+ this way, and busybox friendly #59732.
+
+ 15 Nov 2004; Roy Marples <uberlord@gentoo.org>:
+
+ Split modules_load into smaller more managable functions in net.lo
+ Added modules_force option to net.lo with a big phat warning in
+ net.example about it potentially breaking networking
+ Added searchdomains_ESSID option to essidnet
+ Stopped the domain setting from putting the same entry in search
+ in config-system and essidnet
+ Removed second warning in net.lo when configuration not set
+ Documented APIPA module in net.example
+ Added kernel checking for vlan - fixes #70829
+ Added kernel checking for bonding, bridging and tuntap
+ Added iproute2 support to the APIPA module
+
+ 13 Nov 2004; Mike Frysinger <vapier@gentoo.org>:
+
+ Update the svcdir mounting #69595. Instead of mounting in /mnt
+ and then bind mounting to $svcdir, we mount the ramdisk on $svcidr.
+
+ 12 Nov 2004; Roy Marples <uberlord@gentoo.org>:
+
+ Added arping duplicate address detection to net.lo
+ Created Automatic Private IP Addressing (APIPA) module
+
+ Added dependancy checking to ipppd
+ Bonding is now started pre instead of post
+ Fixed iface variable in dhcp modules for vlans
+ Changed get_device to interface_device
+ Changed get_type to interface_type
+ Added vlan configuration options and documented them in net.example
+ Fixed bridge configuration handling
+ Removed _get_vlans from iproute2 and ifconfig as vlan now does it itself
+
+ 11 Nov 2004; Roy Marples <uberlord@gentoo.org>:
+
+ Fixed category of rp-pppoe to net-dialup error when requesting ADSL
+ Improved inet6 address deletion and detection in iproute2
+ Improved gateway logic in ifconfig
+ Changed all wireless reporting functions to use iwgetid instead of
+ parsing iwconfig output except for essid
+
+* rc-scripts 1.6.6 (08 Nov 2004)
+
+ 08 Nov 2004; Roy Marples <uberlord@gentoo.org>:
+
+ Added options to configure bridge
+ Added bridge configuration example to net.example
+ Added missing required function interface_exists to iptunnel check_depends
+
+ 07 Nov 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ Fix shell scripting errors that would result in
+ /sbin/functions.sh: line 166: [: too many arguments.
+
+ 05 Nov 2004; Roy Marples <uberlord@gentoo.org>:
+
+ net-scripts/net.modules.d/bridge
+ - fixed destroying a bridge if no ports were added
+ - starts interfaces if they don't exist - fixed bug #65153
+
+ net-scrips/net.modules.d/bonding
+ - starts interfaces if they don't exist
+
+ net-scripts/init.d/net.lo
+ - added net_start() function to start depandant ifaces
+ so that bridge br0 can active tun0 which net.tun0 has to create
+ - added use dependany on wlan incase we're using linux-wlan-ng drivers
+ fixes bug #64978
+ - moved start() to run_start() and stop() to run_stop()
+ created run() and new start()/stop() functions
+ this is so that we have one single entry point to localise variables
+ and to remove any added functions loaded by our modules
+ - removed redundant interface_exists() as it's provided by
+ ifconfig and/or iproute2
+
+ net-scripts/net.modules.d/ifconfig and iproute2
+ - added ifconfig_tunnel and iproute2_tunnel functions
+
+ addred gre/ipip tunnel support via the the tunnel module
+ - fixes bug #50765
+
+ 04 Nov 2004; Roy Marples <uberlord@gentoo.org>:
+
+ net-scripts/net.modules.d/pump
+ - fixed setting ntp servers
+
+ net-scripts/net.modules.d/dhcpcd
+ - fixed stopping function
+
+ net-scripts/net.modules.d/bonding
+ - fixed module to actually work with the interface
+
+ net-scripts/init.d/net.lo
+ - we remove all added functions when restarting an interface
+ this relies on the diff command being available
+
+ added isdn support via the new ipppd module - fixes bug #69035
+
+ net-scripts/conf.d/net.example
+ - added sample isdn setup
+
+ net-scripts/conf.d/wireless.example
+ - added better descriptions to the _sleep variables
+
+ Fixed boolean logic error when testing is_net_up in /sbin/runscript.sh
+ - fixed bug #70022
+
+ net.lo - added get_type function to return the type of the interface
+ - eth, ippp, etc
+
+ ipppd, tuntap
+ - start() moved to pre_start() and we now test by type
+ this means you no longer need ifconfig_ippp0=( "isdn" "dhcp" )
+ as ippp0 is always an isdn device
+
+ bridge - fixed stop function and moved start() to pre_start()
+ and automatically start if the variable bridge_${iface} exists
+
+ net.example - fixed up documentation for changed behaviour above
+
+ 03 Nov 2004; Mike Frysinger <vapier@gentoo.org>:
+
+ When launching critical services in /sbin/rc, make sure we source
+ the conf.d file (if it exists). Resolves #69956.
+
+ 03 Nov 2004; Roy Marples <uberlord@gentoo.org>:
+
+ net-scripts/init.d/net.lo
+ - fixed !module when it's not installed
+ - we can now specify null inet addresses in the config
+ this allows a pure inet6 setup
+ - shutdown lo the same way we bring it up
+
+ net-scripts/net.modules.d/ifconfig
+ - changed IPv6 to inet6 in output of adding inet6 addresses
+ - just output inet6 address removed, not eth0 del foo
+
+ net-scripts/net.modules.d/iproute2
+ - fix deletion of non-link addresses - fixes bug #65417 (again)
+ - handle inet6 addresses like ifconfig - fixes more bug #65417
+
+ net-scripts/conf.d/net.example
+ - noted that inet6 addresses do not create aliases
+ - added examples of assigning inet6 addresses
+
+ net-scripts/net.modules.d/iwconfig
+ - improve error message when card does not support scanning
+
+ net-scripts/conf.d/wireless.example
+ - fixed comment regarding preferred_aps not working with cards that don't
+ support scanning
+
+ 02 Nov 2004; Roy Marples <uberlord@gentoo.org>:
+
+ net-scripts/conf.d/net.example
+ - added bridging and tuntap examples
+
+ net-scripts/init.d/net.lo
+ - modprobe ${IFACE} when ${IFACE} does not exist
+
+ net-scripts/net.modules.d/ifconfig
+ - fixed interface existance check
+
+ net-scripts/net.modules.d
+ ifconfig & iproute2
+ - added boolean to interface_exists to report if it exists or not
+ - added checks to see if the interface exists or not when starting
+
+ dhcpcd
+ - removed debug line
+
+ bonding, dhclient, dhcpcd, essidnet, macchanger, pump, udhcpc
+ - added checks to see if the interface exists or not when starting
+
+ tuntap
+ - added checks to see if the interface exists or not when stopping
+
+ 01 Nov 2004; Mike Frysinger <vapier@gentoo.org>:
+
+ Dump the error message that hwclock returns since it tends to be
+ quite useful. Modified init.d/clock.
+
+ Fix error in functions.sh [ -z "$@" ] -> [[ -z "$@" ]] #69789.
+
+ Don't create /dev/sndstat link anymore in populate_udev per #69635.
+
+ 01 Nov 2004; Roy Marples <uberlord@gentoo.org>:
+
+ net-scripts/init.d/net.lo:
+ - modules specified by interface config now error if they are not loaded
+ - moved interface check to after preup incase user preup loads drivers
+ - modules can be explicitly not used by prefixing them with a !
+ however, they are still available to other modules
+ fixes bugs #68908, #69027
+ - remove check to see if interface exists
+ - modules may setup new interfaces and still require config
+ so we have a new label counter in iface_start
+ - removed the check to see if a class wrapping already exists
+ this fixes the bug where ifconfig and iproute2 are installed, but
+ ifconfig is asked for and the interface is restarted.
+ - added check to see if the configured module is loaded
+ and installed or not in iface_start
+ - add dependancy on isdn4linux - fixes bug #69035
+ - interface_exists moved to iproute and ifconfig
+
+ net-scripts/net.modules.d
+ - Split wireless module into iwconfig and essidnet modules
+ - Added tuntap and bridge modules, fixes bug #55394, #30688
+
+ net-scripts/init.d/iwconfig:
+ - wep mode is now reported
+ - removed post_stop function so we keep existing config
+ - added pre_stop to set the ESSID variable
+ - changed to veinfo/vewarn where appropriate
+ - check if interface exists otherwise abort gracefully
+ - no longer deletes addresses as we now avoid
+ ipv6 local addresses in detecting if interface has an addresses or not
+
+ net-scripts/init.d/ifconfig:
+ - added flag enable/disable function
+ - scope:link inet6 addresses are ignored when testing is_up and
+ del_addresses - fixes bug #65417
+
+ net-scripts/init.d/iproute2:
+ - added flag enable/disable function
+ - scope:link inet6 addresses are ignored when testing is_up and
+ del_addresses - fixes bug #65417
+
+ net-scripts/init.d/macchanger:
+ - fixed detecting whether the change worked or not, fixes bug #68893
+
+ net-scripts/init.d/vlan:
+ - fixed old config problem
+
+ 31 Oct 2004; Martin Schlemmer <azarah@gentoo.org>:
+
+ Do not delete depscan and envupdate caches on reboot, as this should
+ improve bootup times - works nicely with the '-u' parameters of both.
+ Also move the '-u' parameter test of depscan.sh after the directory
+ exist test, else ${svcdir}/started/, etc do not exist. Modified both
+ /sbin/rc and /sbin/depscan.sh for this.
+
+ Move things around in /sbin/functions.sh to have all functions above.
+
+ Add the 'lo' option to RC_NET_STRICT_CHECKING to resolve bug #29225.
+
+ 28 Oct 2004; Martin Schlemmer <azarah@gentoo.org>:
+
+ Only add files not managed by udev to device tarball, bug #57110.
+
+ 28 Oct 2004; Mike Frysinger <vapier@gentoo.org>:
+
+ Revert pam_console_apply udev check in bootmisc/halt.sh since
+ the bug is with pam_console_apply and not udev/pam.
+
+ Use ${EUID} instead of $(id -u) to help out BSD in runscript.sh.
+
+ Allow users to select ramfs instead of default tmpfs for mounting
+ on /dev with udev #69091.
+
+ Add issue.devfix which would be auto copied to /etc/issue if
+ /sbin/rc detects the user is missing /dev/null or /dev/console.
+ Includes a simple explanation/fix for what's wrong.
+
+ Make sure the clock init script runs after checkroot/modules/localmount
+ so that timestamps are synchronized asap #68133 / #70008.
+
+ Accept '-nc' as a short option to '--nocolor' #64736.
+
+ 26 Oct 2004; Mike Frysinger <vapier@gentoo.org>:
+
+ Don't use -A with fsck to respect the fs_passno since it'll try
+ to fsck all filesystems, not just the ones specified. Instead,
+ awk /etc/fstab to review the passno field in checkroot #68822.
+
+ Add support for 'gentoo=forcefsck' boot option in checkroot.
+
+ Make sure we run devfsd in /sbin/rc even when /dev has been
+ automounted by the kernel #68795.
+
+ Don't generate the device tarball in halt.sh with livecds #68469.
+
+ 25 Oct 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ net-scripts/net.modules.d/ifconfig:
+ - Simplify ifconfig_is_up()
+ - Fix ifconfig_get_aliases_rev() to actually work... you can't
+ specify an interface name to ifconfig if you want to see the
+ aliases.
+ - Workaround a couple ifconfig bugs dealing with aliases
+ - Correct a return status in ifconfig_interface_del_addresses()
+ - ifconfig_iface_stop() is bool, not void; fix the comments
+
+ net-scripts/net.modules.d/iproute2:
+ - iproute2_iface_stop() is bool, not void. Fix the code so it
+ returns meaningful values
+
+ net-scripts/init.d/net.lo:
+ - Fix preferred (ifconfig/dhcpcd) module loading so it doesn't
+ barf when a preferred module is either (1) missing from
+ net.modules.d or (2) not available due to missing dependencies
+ - When loading all modules in order to stop an interface, only use
+ the first available to satisfy each class wrapper
+
+ 24 Oct 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ Include livecd patch that was applied to baselayout-1.9.4-r6
+ to use agetty instead of mingetty
+
+ 24 Oct 2004; Mike Frysinger <vapier@gentoo.org>:
+
+ Mount tmpfs instead of ramfs on /dev when using udev systems.
+ The problem with ramfs is that it has no size limitations so
+ one could easily take down their machine by accident #68653.
+
+* rc-scripts 1.6.3 (23 Oct 2004)
+
+ 22 Oct 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ Add support for user_eth0 in the adsl module and in net.example.
+ This means that most users won't need to edit pppoe.conf at all
+
+ 21 Oct 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ Remove old etc/conf.d/net and try to clarify instructions in
+ net-scripts/conf.d/net.example. Add example for ADSL
+
+ 21 Oct 2004; Mike Frysinger <vapier@gentoo.org>:
+
+ Merge all of the UML checks into one function, is_uml_sys(),
+ which is now in functions.sh.
+
+ 18 Oct 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ Add v-e-commands (veinfo, vbegin, etc) to sbin/functions.sh that
+ depend on RC_VERBOSE which defaults to no. Add --verbose to args
+ understood by runscript.sh.
+
+ In net.lo, use veinfo and friends when loading modules since this
+ information is confusing to users.
+
+ In net.lo, always load global "modules" setting in following
+ "modules_iface" since this is a little easier for users to
+ understand.
+
+ In net.lo, use eindent for output of pre/post scripts
+
+ 18 Oct 2004; Mike Frysinger <vapier@gentoo.org>:
+
+ Add shfs to our list of net filesystems #61452. Also add afs/nfs4.
+
+ Add a '-u' parameter to depscan.sh to allow for updates only when
+ the config files have changed. With /sbin/rc using this, we speed
+ up bootup by only regenerating the cache when need be #67976. Also
+ add a '-u' parameter to env-update.sh for same reasons.
+
+ Don't run depscan.sh in rc-update anymore since the cache files don't
+ depend on runlevels (which is all that rc-update modifies).
+
+ Add unicode support to keymaps/consolefont #32111 and UML support #29707.
+
+ Add checks to many filesystem operations in the eventuality that the
+ filesystems are mounted read only.
+
+ 16 Oct 2004; Mike Frysinger <vapier@gentoo.org>:
+
+ Update the default fstab /dev/shm mount to include the nodev, nosuid,
+ and noexec mount flags. No reason for the filesystem to have those.
+
+ Cleaned up the clock init script. Moved the clock options out of
+ rc.conf and into its own conf.d/clock file. Added support for the
+ weird Alpha consoles SRM/ARC since they need special config options.
+ Also made the syncing of system clock to hardware clock at shutdown
+ optional (with the default being off) #15834. Don't try to set the
+ clock if running inside a coLinux environment #52870.
+
+ Update default PATH ordering to try to follow default behavior in
+ other distro's and because it's logical that /usr/local should
+ override /usr which should override /. Fixes #12531.
+
+ Move devfs stuff out of baselayout and into the devfsd package.
+
+ Don't run /sbin/pam_console_apply -r if using udev on /dev #50315.
+
+ 14 Oct 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ Fix rc-status to work with new COLS code.
+
+ 14 Oct 2004; Mike Frysinger <vapier@gentoo.org>:
+
+ Allow users to mount ramfs/tmpfs/ramdisk as their svcdir and
+ stop assuming ramfs==ramdisk #64079.
+
+ 13 Oct 2004; Mike Frysinger <vapier@gentoo.org>:
+
+ Rework the code for managing /dev to make it more flexible for
+ users. Some don't want to use devfs/udev but rather just create
+ their own nodes. Handles some issues with #44906 / #67276.
+
+ Move the utmp clearing code out of bootmisc and into /sbin/rc.
+ The utmp log must be cleared while in the initial boot level
+ (meaning inside /sbin/rc) because as soon as rc exists, init
+ writes a 'boot' record (`who -b`) which would normally be lost
+ when the bootmisc init.d script is run #61727.
+
+ 13 Oct 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ Cosmetic fixes for starting loopback interface
+
+ SpanKY doesn't like the dots... disable them by default, but you
+ can set RC_DOT_PATTERN=' .' in /etc/conf.d/rc to get them back
+
+* rc-scripts 1.6.2 (13 Oct 2004)
+
+ 13 Oct 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ Install net.modules.d to /lib/rcscripts instead of /etc so we
+ don't have to deal with CONFIG_PROTECT
+
+ Fix diff code in modules_load so it can identify which functions
+ have been modified
+
+ Fix fallback mechanism in iface_start so that it works correctly
+ and doesn't report a bogus error message when trying the fallback
+
+ Get rid of need_begin trickery in iface_stop
+
+ Simplify eend processing in dhcp modules
+
+ Implement eindent, eoutdent, esetdent in functions.sh and adjust
+ net-scripts to use them.
+
+ Re-write einfo, ewarn, eerror, ebegin, eend, ewend to use
+ RC_INDENTATION and to work better on serial terminals
+
+ Remove conf.d/net.ppp0 since that is provided by net-dialup/ppp
+
+ 12 Oct 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ Fix ipaddr_fallback in net-scripts/conf.d/net.example
+
+ 09 Oct 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ Remove init.d/net.eth0 net.lo and net.ppp0. The first two are
+ provided now by net-scripts and net.ppp0 is shipped in
+ net-dialup/ppp
+
+ Create NET_FS_LIST and is_net_fs in functions.sh and use them in
+ checkroot, localmount, netmount, net.example, and net.lo
+
+ 09 Oct 2004; Mike Frysinger <vapier@gentoo.org>:
+
+ If the hostname has already been set via the kernel/dhcp, don't
+ force it to 'localhost'. Used in netboot/terminal setups #38172.
+
+ Add domainname to default boot runlevel list #47041.
+
+ 08 Oct 2004; Mike Frysinger <vapier@gentoo.org>:
+
+ Make sure that when we try to mount /sys, we do so with -n (tigger).
+
+ Add some examples for nfs to sysctl.conf #66575.
+
+ 06 Oct 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ Update to net-scripts 1.0.2 from Roy
+ ------------------------------------
+ - wireless module: replaced preferred_only var with
+ associate_order this makes more sense now as we have changed the
+ possible values
+ - wireless module: added patch from Daniel Zappala we should call
+ wireless_get_essid everywhere now
+ - wireless module: don't declare ESSID local in
+ wireless_configure(). This allows ESSID to be tested in the
+ user defined postup() function
+ - wireless module: test type != "NOT READY!" instead of testing =
+ IEEE. this resolves problems with intel and ra-tech drivers
+ - net.lo start() now errors when the interface does not exist
+ - dhcpcd, dhclient, udhcpc and pump now expose peer_* vars this
+ enables wireless to map them from peer_dns_ESSID
+ - config-system helper now loads wireless module to remap
+ variables from ESSID this allows udhcpc and dhclient to use
+ remapped wireless vars
+ - fixed dhcpcd and pump modules using peer_* vars
+ - wireless aborts after 5 seconds if it cannot report a valid
+ ESSID this fixes a potential infinite loop problem
+ - wireless_setup_iface() renamed to wireless_map_essid_vars() this
+ avoids confusion about what the function actually does
+
+ 06 Oct 2004; Mike Frysinger <vapier@gentoo.org>:
+
+ Change the default net.ipv4.conf.default.rp_filter setting to 1
+ in sysctl.conf since it shouldn't be harmful in anyway. Redhat
+ does the same.
+
+ 05 Oct 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ Get rid of getcols() in sbin/functions.sh. Use COLUMNS when
+ possible and otherwise clean up the COLS code. Fix the "emerge
+ depend" detection code to use RC_ENDCOL="no"
+
+ 05 Oct 2004; Mike Frysinger <vapier@gentoo.org>:
+
+ Changed behavior of the domainname init.d script. It will now
+ override any settings obtained via dhcp/whatever. See #48277.
+
+ Updated bootmisc to dump the output of `dmesg` to /var/log/dmesg.
+ This way users have an 'after-boot' log of their dmesg saved
+ somewhere useful #55421.
+
+ Added the 'eend' back to depscan.sh since the script starts with a
+ call to 'ebegin' #59694.
+
+ Add selinux update from Chris PeBenito for src/runscript.c #64019.
+
+ Add more quoting to rc-help.sh to fix some non-critical errors.
+ Make rc-help.sh respect the value of RC_NOCOLOR. Allow RC_NOCOLOR
+ in functions.sh to be set via the environment.
+
+ Flesh out the default sysctl.conf with comments and more examples
+ since our previous one was pretty sparse #59993.
+
+ Change calls to `uniq` to `sort -u` in checkroot/halt.sh. This way
+ we only require sort in / and not both #36453.
+
+ 04 Oct 2004; Mike Frysinger <vapier@gentoo.org>:
+
+ More (I mean a LOT more) services. This takes care of #44458,
+ #52881 #55939 #58997 #66166 #66297. Gleaned many from the IANA
+ list/Fedora/FreeBSD/Debian.
+
+ Change the test for /proc/cmdline from -e to -r. On grsecurity
+ based systems for example, the file may exist, but not be readable
+ by non-root users (patch by Ned Ludd).
+
+ 03 Oct 2004; Mike Frysinger <vapier@gentoo.org>:
+
+ Add support for NFSv4 from #25106 to the netmount script. Don't
+ try to fsck / if the root is a remote filesystem (like NFS) #36624.
+
+ Update the fs_passno values in the default fstab to match the
+ settings suggested by the manpage #37314. Make checkroot respect
+ a fs_passno setting of 0 when dealing with / #39212. Change
+ default / filesystem type to ext3 instead of xfs #42670.
+
+ Re-order the arguments to mount to match POSIX requirements #66225.
+
+ Don't pipe swapon in localmount to /dev/null and ignore return
+ codes anymore. A swapon that works shows no output #39834.
+
+ 02 Oct 2004; Mike Frysinger <vapier@gentoo.org>:
+
+ Break up the COL/COLOR code properly this time. Not all serial
+ consoles can handle adjusting to the end of the line, so let's not
+ bother running stty at all anymore. This should fix up #32453.
+
+ 30 Sep 2004; Mike Frysinger <vapier@gentoo.org>:
+
+ Disable cryptfs by default in the conf.d file. Also cleanup
+ the output generated in localmount/checkfs/halt.sh for dm-crypt.
+ Add an extra check so that cryptfs is only run when the conf.d
+ file exists as well as /bin/cryptsetup.
+
+ 29 Sep 2004; Mike Frysinger <vapier@gentoo.org>:
+
+ Let glibc install nscd since different versions of glibc will
+ need to be handled differently. See #43076 by Rui Malheiro.
+
+ 29 Sep 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ Prefer ~/.dir_colors over /etc/DIR_COLORS when it exists #64489
+
+ 27 Sep 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ Clear the screen in .bash_logout #32330
+
+* rc-scripts 1.6.1 (27 Sep 2004)
+
+ 27 Sep 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ Update dm-crypt to work with multi-line configuration files.
+ Also don't set status in a subshell; it was being lost before.
+
+ 23 Sep 2004; Mike Frysinger <vapier@gentoo.org>:
+
+ Rework the logic behind the $COLS code. It should not depend
+ on whether color is enabled. Also add a check for negative
+ values (like when using a serial console).
+
+* rc-scripts 1.6.0 (15 Sep 2004)
+
+ 15 Sep 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ Fix bug 64034: simplify netmount script's stop function so that
+ mountpoints containing spaces work correctly
+
+ Update tarball.sh to use net-scripts
+
+ 14 Sep 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ Commit dm-crypt enablement patch from Tigger (Rob Holland) in
+ bug 43146
+
+* rc-scripts 1.5.3 (18 Aug 2004)
+
+ 18 Aug 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ Fix bug 60719 (request for better error messages from runscript)
+ by allowing errors to show on the screen when they're encountered
+ in wrap_rcscript
+
+ Apply Spock's bootsplash patch from bug 45784. This moves most of
+ the splash functionality out of baselayout.
+
+ 13 Aug 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ Don't export PS1. Continuation of bug 26951, comments 60-62.
+
+* rc-scripts 1.5.2 (02 Aug 2004)
+
+ 02 Aug 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ Related to bug 38955, don't set INPUTRC. Instead patch bash so
+ that it looks for /etc/inputrc automatically if ~/.inputrc is
+ missing. This is better than using INPUTRC since that will
+ override even after the user creates ~/.inputrc.
+
+ Fix bug 54275: Don't set INFODIR. The correct variable used by
+ texinfo is INFOPATH, which is already set in 00basic. Setting
+ INFODIR is useless, and breaks a NetBSD cross compile from Gentoo
+
+ 01 Aug 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ Fix bug 58805: net.eth0 should use bridge so that bridge
+ interfaces are configured prior to net.br0 running
+
+ Fix bug 56856: Get rid of net.rej and integrate missing stuff to
+ conf.d/net
+
+ Apply half of spock's patch in bug 45784: Check for
+ conf.d/bootsplash instead of conf.d/bootsplash.conf
+
+ Fix bug 51351: Quote parsed output of /proc/filesystems to handle
+ octal sequences in mountpoint such as encoded spaces (\040)
+
+ Fix bug 46680: Add cifs support to localmount and netmount.
+ Thanks to Ronald Moesbergen for the patches
+
+ 21 Jul 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ Fix bug 26952: Use /etc/bash/bashrc to setup PS1, testing $- to
+ determine if shell is interactive. The new system-wide bashrc is
+ installed by bash-2.05b-r10
+
+ 19 Jul 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ Fix bug 38743: strip leading and trailing spaces from variable
+ values in genenviron.awk. Thanks to Marius Mauch for the patch.
+
+ 09 Jul 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ Fix bug 55576: swap words "start" and "stop" in runscript.sh error
+ message
+
+* rc-scripts 1.5.1 (28 Jun 2004)
+
+ 28 Jun 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ Fix dhcp in iface_start_ifconfig: It was re-using the variable
+ ${i} which would result in the following error:
+ /sbin/runscript.sh: line 441: ((: 16.141.88.153: syntax error
+ in expression (error token is ".141.88.153")
+
+ Use vlan_IFACE instead of iface_IFACE_vlans in net.eth0 for more
+ consistent vlan configuration. Thanks to robbat2 in bug 55394
+ (not fully resolved)
+
+ Add example for checking if root filesystem is NFS-mounted via
+ predown function in conf.d/net for bug 53104. This might be
+ better integrated at some point into net.eth0
+
+* rc-scripts 1.5.0 (26 Jun 2004)
+
+ 26 Jun 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ Fix bug 47659: support iproute2-style configuration. Thanks to
+ Dean Bailey for some fantastic patches, including documentation
+ for conf.d/net. This is a pretty huge re-write of net.eth0
+
+ Fix bug 34607: provide examples for in conf.d/net for preup,
+ postup, predown, postdown functions. Also pay attention to return
+ value from predown function (previously ignored)
+
+ 15 Jun 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ Fix bug 25975: support adsl in net.eth0. Thanks to Patrick McLean
+ for the initial pass at the code.
+
+ Fix bug 34140: add --servicelist option to rc-status. Thanks to
+ Eldad Zack for the patch.
+
+ Fix bug 37418: fix order of LVM and RAID in checkfs. Thanks to
+ Raimondo Giammanco for the patch.
+
+* rc-scripts 1.4.16 (06 Jun 2004)
+
+ 06 Jun 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ Only call generate-modprobe.conf with --assume-kernel if
+ modules-update was called with --assume-kernel. This means that
+ only catalyst has the dependency on module-init-tools, not
+ everybody with the newer baselayout
+
+* rc-scripts 1.4.15 (21 May 2004)
+
+ 21 May 2004; Aron Grifis <agriffis@gentoo.org>:
+
+ Fix bug 51570: typo on line 161 of /sbin/livecd-functions.sh
+
+ Fix bug 51626: wrong variable declaration at top of
+ get_bootparam() in /sbin/functions.sh
+
+* rc-scripts 1.4.14 (17 May 2004)
+
+ 17 May 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ Bump version to 1.4.14 to push out gmsoft's fix for hppa console
+ on ttyB0
+
+* rc-scripts 1.4.13 (15 May 2004)
+
+ 15 May 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ Bump version to 1.4.13 to push out Gustavo's livecd serial console
+ fixes for sparc and hppa.
+
+* rc-scripts 1.4.12 (07 May 2004)
+
+ 10 May 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ Bump version to 1.4.12 to release these critical bug fixes
+
+ Fix bug 50434: The new version of start-stop-daemon changes
+ directory to / by default unless --chdir is specified. Revert
+ this behavior to maintain working directory. This fixes openvpn
+ startup (probably among other things). Thanks to Sven Wegener for
+ the patch.
+
+ Fix bug 50448: Four days ago I changed bash loops to use the wrong
+ conditional syntax in net.eth0. Thanks to Sven Wegener for
+ pointing out the problem and providing a patch.
+
+* rc-scripts 1.4.11 (07 May 2004)
+
+ 07 May 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ Fix bug 20597: Skip RCS files when updating modules
+
+ Fix bug 49926: Add a --assume-kernel flag to modules-update. This
+ requires a companion patch in module-init-tools-3.0-r2 to handle
+ the same flag in generate-modprobe.conf; this dependency won't be
+ handled in the baselayout ebuild since it only affects livecd
+ building.
+
+ 06 May 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ In net.eth0, fix many instances of loops like "for ((i = 0; i <
+ 100; i = i + 1))". The problem here is that the middle comparison
+ is being interpreted as a bash conditional, which means that it's
+ doing string comparison by default. It needs to be "i -lt 100"
+
+ Fix bug 34827: net.eth0 breaks when localized because the ifconfig
+ output changes. Wrap ifconfig in a function that overrides
+ LC_ALL=C
+
+ Fix bug 48305: Provide a new network configuration variable
+ ifconfig_fallback_eth0 which allows one to specify a fallback
+ configuration in case DHCP fails.
+
+ Fix bug 50246: Give root an invalid password ("*" in /etc/shadow)
+ in the default baselayout. This prevents the first reboot after
+ installation from having a blank password.
+
+ 05 May 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ Fix bug 48595: Make sure $(id -u) is zero (root user) when running
+ init scripts to avoid a lot of error messages.
+
+ Replace many lines of awk with two lines of grep in
+ init.d/localmount
+
+ Fix bug 44316: Use 0644 instead of 0640 for resolv.conf in net.ppp0
+
+ 03 May 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ Update to version 1.10.20 of Debian's start-stop-daemon (contained
+ in dpkg at http://packages.debian.org/testing/base/dpkg). This
+ fixes bug 22686 (start-stop-daemon in baselayout doesn't allow
+ altered nicelevel).
+
+* rc-scripts 1.4.10 (25 Apr 2004)
+
+ 25 Apr 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ Fix typos in sbin/rc: "try try mount" and "mount ... & >/dev/null"
+ Also removed the errstr double-checking since the need for that is
+ alleviated by these typo fixes.
+
+ 23 Apr 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ Fix bug 48629 (/sbin/rc fixups for udev) with patch from GregKH
+
+ Fix bug 40987 (gentoo should be able to boot with an empty /dev)
+ with patch from Spanky. The patch avoids redirection to /dev/null
+ when it doesn't exist; this was breaking /sbin/rc.
+
+* rc-scripts 1.4.9 (15 Apr 2004)
+
+ 15 Apr 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ Fix bug 47111 (severe depcache problems) with tons of help from
+ dswhite42 and the rest of the crew in that bug. Thanks guys!
+
+* rc-scripts 1.4.8 (14 Apr 2004)
+
+ 14 Apr 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ Fix bug 47623 (error removing inet6 addresses) with patch provided
+ by Vlad Yasevich.
+
+* rc-scripts 1.4.7 (12 Apr 2004)
+
+ 12 Apr 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ Fix bug 47218 (net.eth0 broken for vlans) with patch provided by
+ Andy Dustman. Fix bug 47250 (depscan.sh fails to create
+ /var/lib/init.d/* directories) with patch from Terje Bergström
+
+* rc-scripts 1.4.6 (08 Apr 2004)
+
+ 08 Apr 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ Update patch from Gustavoz; -ln /bin/bash should have been -nl /bin/bash
+
+* rc-scripts 1.4.5 (08 Apr 2004)
+
+ 08 Apr 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ Patch init.d/checkroot to list / (root) only once in mtab; see bug 38360.
+ Patch from Gustavoz to livecd-functions.sh to run bash instead of login on
+ serial consoles, necessary due to scrambled root passwords.
+
+* rc-scripts 1.4.4 (07 Apr 2004)
+
+ 07 Apr 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ Patch from Gustavoz for Sparc console: Fetch LIVECD_CONSOLE from dmesg
+ output. Also support 4800 baud correctly.
+
+ 16 Mar 2004; Aron Griffis <agriffis@gentoo.org>:
+
+ The changes in this commit pertain primarily to
+ http://bugs.gentoo.org/show_bug.cgi?id=19695
+ http://bugs.gentoo.org/show_bug.cgi?id=35736
+
+ Specify routes as an array per interface, for example:
+ routes_eth0=(
+ "-net 10.1.0.0 netmask 255.255.0.0 gw 10.0.0.5"
+ "-net 10.2.0.0 netmask 255.255.0.0 gw 10.0.0.6"
+ "-host 10.3.0.1 dev eth0"
+ )
+
+ You can optionally use the gateway variable or just put the default route
+ in the routes variable. The following two are REDUNDANT:
+
+ routes_eth0=( "default gw 10.0.0.5" )
+ gateway="eth0/10.0.0.5"
+
+ Old configuration variables in /etc/conf.d/net are fully supported and
+ used transparently if ifconfig_eth0 is missing. In other words, this new
+ script is fully backward-compatible. However you can get rid of
+ iface_eth0, alias_eth0, broadcast_eth0 and netmask_eth0 if you want by
+ using the new syntax:
+
+ ifconfig_eth0=(
+ "10.0.0.6 broadcast 10.0.255.255 netmask 255.255.0.0"
+ "192.168.1.1 netmask 255.255.255.0"
+ "123.456.789.1"
+ )
+
+ Full backward compatibility so no danger to screwing up users relying on
+ existing /etc/conf.d/net setup
+
+ NET_DEBUG can be set in the environment for copious debugging output
+
+ Deprecate [ ] in favor of [[ ]] which has fewer quoting issues and
+ better functionality (and is even slightly faster)
+
+ Properly localize all variables, including variables returned by
+ setup_vars
+
+ Allow full options for every ifconfig command, both base address and
+ aliases via ifconfig_eth0, replacing the convoluted and less-functional
+ iface_eth0, alias_eth0, broadcast_eth0, netmask_eth0
+
+ Provide full support for static routes via routes_eth0
+
+ Fix potential quoting problems in setup_vars by using better eval syntax
+ instead of eval echo
+
+ Display IP addresses while configuring, both DHCP-retrieved and
+ statically set addresses
+
+ Collapse redundant caching of $? since eend returns $? again
+
+ Report when keeping kernel configuration for an interface along with IP
+ address gleaned
+
+ Don't reset the default gateway if it is already set correctly
+
+ Don't bind default gateway to particular interface when /sbin/route is
+ called so that it can survive if there is more than one interface on the
+ required subnet. (Old behavior can be obtained by setting
+ routes_eth0="default gw 1.2.3.4 dev eth0" if you really want it)
+
+ Don't bomb if default gateway can't be set since that doesn't
+ necessarily mean that the interface configuration is invalid.
+ (Old behavior was completely broken, but commented section
+ demonstrates how to do it right if necessary)
+
+ iface_stop no longer relies on configuration in /etc/conf.d/net AT ALL.
+ This is very good because it means you can put new configuration in
+ /etc/conf.d/net, then restart the interface and the old configuration will
+ be properly shut down.
+
+ iface_stop reports when it is releasing the DHCP lease
+
+* rc-scripts 1.4.3.13p1 (26 Feb 2004)
+
+ 26 Feb 2004; Martin Schlemmer <azarah@gentoo.org>:
+
+ Remove /etc/DIR_COLORS, as coreutils provides it now.
+
+ Add RC_DEVICE_TARBALL to /etc/conf.d/rc to control use of device tarball.
+ Also modified /sbin/rc and /etc/init.d/halt.sh for this.
+
+ Start udevd if present.
+
+ Small fix to sbin/rc-services.sh related to mtime checking and 'net'
+ virtual service - it had no mtime generated, so check_mtime() failed
+ for it ...
+
+ 25 Feb 2004; Martin Schlemmer <azarah@gentoo.org>:
+
+ Update to enable checking of mtimes on rc-scripts, and auto running
+ depscan.sh if needed. Also try to run depscan.sh when RC_GOT_DEPTREE_INFO
+ is not set instead of just erroring.
+
+ 19 Feb 2004; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix irda type-o in /sbin/MAKEDEV, thanks to Tobias Sager <moixa@gmx.ch>.
+
+ Fix type-o in /etc/initrc, bug #41666 (Tom Vergote <bugzilla@tomvergote.be>).
+
+ 15 Feb 2004; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add RC_TTY_NUMBER to /etc/conf.d/rc to configure how many tty devices
+ are used in scripts such as consolefonts, numlock, etc. This should
+ close bug #39863.
+
+ Fix type-o in /etc/init.d/consolefont, bug #40938, thanks to patch from
+ Cory Tusar <ctusar@adelphia.net>.
+
+ 09 Feb 2004; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add SELinux modifications to /sbin/runscript. This allows runscript to
+ make sure it is running in the right domain. Patch done by
+ Chris PeBenito <pebenito@gentoo.org>.
+
+* rc-scripts 1.4.3.13 (08 Feb 2004)
+
+ 08 Feb 2004; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix wrong logic in /etc/init.d/halt.sh which did not umount all mounts
+ _but_ /mnt/cdrom and /mnt/livecd.
+
+ Update /etc/init.d/consolefont to use newer kbd. Should also close
+ bug #39864.
+
+ Fix /sbin/depscan.sh, /sbin/functions.sh and /sbin/rc to use mkdir rather
+ than install, as newer versions of install is located in /usr/bin. This
+ closes bug #39648.
+
+ 06 Feb 2004; Martin Schlemmer <azarah@gentoo.org>:
+
+ Tweak livecd support changes and add some more to hopefully sort out
+ last issues, with help from Brad House <brad_mssw@gentoo.org>.
+
+ Add code to generate /dev/fd, /dev/std* and /dev/core to /sbin/rc,
+ bug #37349.
+
+* rc-scripts 1.4.3.12p3 (21 Jan 2004)
+
+ 19 Jan 2004; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add /sbin/livecd-functions.sh from Brad House <brad_mssw@gentoo.org>
+ for livecd support. Add bits to /sbin/rc to support it.
+
+ 06 Jan 2004; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix type-o in /etc/init.d/checkfs, bug #37113.
+
+ 29 Dec 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Update /sbin/depscan.sh, /sbin/env-update.sh, src/awk/cachedepends.awk,
+ src/awk/gendepends.awk and src/awk/genenviron.awk to use ENVIRON rather
+ then gawk -v. Also add some tests to see if we got the environment
+ variables.
+
+ 28 Dec 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix /sbin/rc to mount /dev/pts with gid=5 and mode=0620, bug #36088.
+
+* rc-scripts 1.4.3.12p2 (27 Dec 2003)
+
+ 26 Dec 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Update code to generate /dev from /sys. Add UDEV_NO_SLEEP=1 for
+ hack to not make udev sleep - its not needed as these entries
+ are already present, and not a hotplug event.
+
+ Update /etc/init.d/{consolefont,numlock} to work with udev managed
+ /dev that have devfs layout.
+
+ 14 Dec 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix type-o in /sbin/rc, bug #34837.
+
+* rc-scripts 1.4.3.12p1 (26 Nov 2003)
+
+ 26 Nov 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix /etc/init.d/halt.sh to reset pam_console permissions, else
+ the next bootup might be done with some non-root nodes which cause
+ some odd issues.
+
+ Add code to generate /dev from sysfs entries - not much it currently
+ support but block/tty devices, but it is a start for when we have
+ full sysfs support in all drivers.
+
+ Revert carrier detection check, as there is currently too many
+ issues with it, bug #33272.
+
+ Make sure we mount already mounted mount (done in /sbin/rc) with
+ correct permissions, etc, bug #33764. Modified /etc/init.d/checkroot
+ for this.
+
+ 16 Nov 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix carrier detection - we need to do a 'ifconfig $IFACE up' else
+ some drivers do not set the IFF_RUNNING bit, bug #33272, thanks to
+ Jason Rhinelander <jason-gentoo@gossamer-threads.com> for the fix.
+
+ 15 Nov 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add a warning to cachedepends.awk if a rc-script's name ends in
+ '.sh', bug #33134. Add better error checking to /sbin/depscan.sh.
+
+ Fix /etc/init.d/halt.sh to not try and remount virtual devices,
+ also do a few cleanups. Closes bug #33271.
+
+* rc-scripts 1.4.3.12 (11 Nov 2003)
+
+ 11 Nov 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add carrier detection to /etc/init.d/net.eth0 closing bug #25480;
+ patch by Jordan Ritter <jpr5+gentoo@darkridge.com>.
+
+ Add extra checks for critical directories to /sbin/rc.
+
+ 04 Nov 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Update /bin/rc-status giving a working '-u' parameter, bug #32417.
+ Fix by Michael Frysinger <vapier@gentoo.org>.
+
+ 31 Oct 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add support for --tty switch added to setfont and remove consolechars
+ support; modified /etc/init.d/consolefont for this. Also remove
+ consoletools support from /etc/init.d/keymaps.
+
+ 29 Oct 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ We should still use /sbin/udev as hotplug agent if /sbin/hotplug do
+ not exist. Updated /sbin/rc for this.
+
+ Add a fix to /etc/init.d/keymaps for bug #32111 (we should not have
+ '-u' in the call to loadkeys when using unicode).
+
+ We should not use '-' in variable names for bash, bug #31184, thanks
+ to Andreas Simon <yuipx@gmx.net>. Updated /sbin/MAKEDEV.
+
+ 27 Oct 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix return code checking of fsck in /etc/init.d/checkfs, bug #31349.
+
+ 26 Oct 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ The unmount stuff in /etc/init.d/halt.sh was flawed, in the fact that
+ it called 'umount -t no<insert_fs_here>', which resulted in /proc, etc
+ unmounted anyhow. Change it to remount the last filesystems readonly
+ without trying to unmount any. This fixes a few cases where reboot
+ would halt due to unmounted /proc, etc.
+
+ This change set fixes two things:
+ 1) In exporting all functions/variables in functions.sh, rc-services.sh
+ and rc-daemon.sh, we created an overly large environment, and also
+ broke stuff like glftpd. Do not do this, and hope whatever caused
+ the issues previously is fixed in the meantime. This should close
+ bugs #25754 and #31794.
+ 2) gendepend.awk used to generate deptree with functions called
+ depinfo_<scriptname> which set appropriate variables when called.
+ This broke if the scriptname contained characters that is not valid
+ for bash variable names. Changed things to use an array fixing this.
+ This closes bug #24092.
+
+ Change /sbin/rc again to not set the hotplug agent to /sbin/udev, as
+ /sbin/hotplug will call udev as well.
+
+ Fix a logic error in /lib/rcscripts/sh/rc-services.sh that cause the
+ get_dep_info() function to skip the last entry in the RC_DEPEND_TREE
+ array (in my case 'net').
+
+ We did not handle the 'net' dependency properly in valid_iuse() and
+ valid_iafter(). Fix this in /lib/rcscripts/sh/rc-services.sh, closing
+ bugs #30327 and #31950.
+
+ Change an occurance of /etc/modutils in modules-update.8 to
+ /etc/modules.d/ closing bug #31171.
+
+ 19 Oct 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ More bootsplash fixes, bug #21019 (comment #21).
+
+ Remove the killall5 stuff from /etc/init.d/halt.sh, as it messes with
+ bootsplash. Add support to kill processes still using non-critical
+ mounts with fuser though.
+
+ 17 Oct 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Bootsplash fixes from Michael Aichler <micha@aichler.net>, (comment #15
+ and #16 from bug #21019).
+
+ Bootsplash coded did not play nice with boot profiles, so I fixed that
+ as well. Some other style tweaks.
+
+ Fix /sbin/MAKEDEV to use 'user:group' form, and not depriciated '.'.
+ Also changed the permissions on tty's, ibcs and scanner devices
+ to 0660.
+
+* rc-scripts 1.4.3.11p2 (14 Sep 2003)
+
+ 14 Oct 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Revert previous changes, and substitute it for the bootsplash patches
+ from Michael Aichler <micha@aichler.net>, bug #21019. His www pages
+ can be reached at:
+
+ http://www.aichler.net/gentoo/bootsplash/
+
+ I should note that the bootsplash stuff is not 100% tested.
+
+
+* rc-scripts 1.4.3.11p1 (14 Sep 2003)
+
+ 14 Oct 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Initial bootsplash patch as from LiveCD's.
+
+ Add more tty's to /etc/init.d/numlock, bug #28252.
+
+* rc-scripts 1.4.3.11 (14 Sep 2003)
+
+ 14 Oct 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add initial udev support. Modified /sbin/rc and /etc/init.d/halt.sh.
+ Resolves bug #27527.
+
+ Add squid to /etc/services, bug #30995. Other cleanups from rac.
+
+ Add patch from Kumba <kumba@gentoo.org> to MAKEDEV to not allow
+ running while pwd is root (/).
+
+ Add 'after hotplug' to /etc/init.d/consolefont, bug #30856.
+
+ Add entry for floppy in /etc/fstab, bug #30574.
+
+ Remove changing group of /tmp/.{X,ICE}-unix, as it it not needed,
+ bug #28861.
+
+ Apply a patch from Mike Frysinger <vapier@gentoo.org> for rc-status.
+ It now will work with runlevels named with any characters (other than
+ ones found in default bash IFS). It also adds a few sanity/error
+ checks, bug #26432.
+
+ Change /etc/inputrc to have PageUp/PageDown search through bash
+ history again, bug #26036.
+
+ 14 Sep 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Change update-modules to modules-update in manpage, bug #28101.
+
+* rc-scripts 1.4.3.10p1 (08 Sep 2003)
+
+ 08 Sep 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Change the '-k' switch to dhcpcd to '-z' in /etc/init.d/net.eth0.
+
+ 12 Aug 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add missing 'local x' to filter_environ() (bug #26429), thanks to
+ Mark Wagner <mark@lanfear.net>. Modified rc-services.sh for this.
+
+ 11 Aug 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Modify /etc/init.d/modules not to print the autoloading stuff if
+ no modules should be loaded (resolving bug #26288), per request from
+ Michael Frysinger <vapier@gentoo.org>.
+
+ Fix get_bootparam() in /sbin/functions.sh to check for existance of
+ the /proc/cmdline proc entry.
+
+ 10 Aug 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Modify /etc/init.d/halt.sh to first kill, and then deactivate swap on
+ request of Luke-Jr <luke-jr@gentoo.org>. It should be ok now, as the
+ whole way of devfs handling changed long ago already.
+
+ Fix /etc/init.d/halt.sh to unmount the mount point and not the device.
+ Also change it to 'mount -d' to detach the loop device. Patch by
+ Kalin KOZHUHAROV <kalin@ThinRope.net>, bug #26256.
+
+ Fix /etc/init.d/consolefont to not error out if CONSOLEFONT in rc.conf
+ is not set, bug #26278 (noted by Michael Frysinger <vapier@gentoo.org>).
+
+* rc-scripts 1.4.3.10 (04 Aug 2003)
+
+ 04 Aug 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add /bin/rc-status and 'show' support to /sbin/rc-update (long overdue),
+ bug #4222, thanks to Sean E Russell <ser@germane-software.com>,
+ Michael Frysinger <vapier@gentoo.org> (/bin/rc-status) and for the 'show'
+ stuff to /sbin/rc-update, Max Kalika <max@gentoo.org>.
+
+ Fixed modules-update to only do the /etc/modprobe.conf generation if we
+ are actually running a 2.5+ kernel.
+
+ Add pop3 entries to /etc/services, bug #25501.
+
+ Add a switch for devfsd startup to /etc/conf.d/rc, fix /sbin/rc to check
+ RC_DEVFSD_STARTUP. Closes bug #24361, thanks to patches from
+ Kurt V. Hindenburg <khindenburg@cherrynebula.net>.
+
+ Add LVM2 support thanks to Max Kalika <max@gentoo.org> (bug #21908).
+
+ Add IPV6 versions of localhost and co in /etc/hosts, bug #25859.
+
+ Fix type-o in /sbin/rc-update, bug #25854.
+
+ 29 Jul 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Tweak /etc/init.d/check{root,fs} to set retval after each fsck call,
+ and not the whole block. Tweak check checkroot to reboot if need be
+ (This is with sufficient warning and message). Tweak checkfs to not
+ drop to a sulogin if return code 2 or 3 is given - as we did not
+ mount the filesystems yet, we should not need to reboot ... bug #25398.
+
+ Add '-T' option to fsck (/etc/init.d/check{root,fs} - requested by
+ Michael Frysinger <vapier@gentoo.org>.
+
+ 28 Jul 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Rework changes for the Adelie project to support boot config profiles
+ better. Added support for /etc/runlevels/LEVEL/.fake to specify which
+ runlevels should be marked started or stopped without executing the
+ script. Renamed the /etc/runlevels/LEVEL/critical to ".critical" for
+ more uniformity. Modified /sbin/rc, /sbin/functions.sh, /sbin/runscript.sh
+ for this.
+
+ Add better support for services that provide the "logger" virtual. We
+ should really start the logger earlier, and stop it as late as possible.
+ Modified /sbin/rc, /lib/rcscripts/sh/rc-services.sh and gendepends.awk
+ for this.
+
+ Fix .../boot/... paths hardcoded in /lib/rcscripts/sh/rc-services.sh,
+ thanks to Jean-Francois Richard <jean-francois@richard.name>.
+
+ Replace the Suse /etc/inputrc with a non copyrighted one, bug #24918.
+
+ 23 Jul 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ From Jean-Francois Richard <jean-francois@richard.name> and
+ Olivier Crete <tester@gentoo.org> from the Adelie project:
+
+ The last four patches are the "adaptation" of our previous patches to
+ the new "no-tmpfs" init system in Gentoo. Since we were using quite
+ different scripts for the boot runlevel (no "checkroot" for example) and
+ that the new system hardcodes some of the boot services, we had to find
+ a simple yet elegant solution.
+
+ We chose to make init scripts read "/etc/runlevels/LEVEL/critical" to
+ know what are the boot runlevel services. If this file is not present,
+ it uses the Gentoo hardcoded defaults.
+
+ This touches /sbin/rc, /sbin/functions.sh, /sbin/runscript.sh and
+ /etc/init.d/halt.sh.
+
+ I just changed the behaviour of 'softlevel' kernel command line argument
+ to not only add a suffix and some other cleanups.
+
+ Add support for irqbalance.
+
+ 22 Jul 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix the /dev/root entry in /etc/mtab, bug #24916.
+
+ Add EVMS2 support, thanks to Mike Javorski <mike_javorski@bigfoot.com>,
+ bug #24064.
+
+* rc-scripts 1.4.3.9 (17 Jul 2003)
+
+ 17 Jul 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add vlan support to /etc/init.d/net.eth0, bug #15588, thanks to
+ Andy Dustman <andy-gentoo.54e552@dustman.net>.
+
+ Add 'TERM=Eterm' to /etc/DIR_COLORS, bug #23423.
+
+ Add mdadm support to /etc/init.d/checkfs, bug #23437, many thanks
+ to Wes Kurdziolek <wkurdzio@vtluug.org>.
+
+ Rather use 'uname -r' to get kernel version, as else we need sysctl.
+ This closes bug #23923, modified /etc/init.d/modules.
+
+ Fix a type-o in /etc/fstab, bug #23308.
+
+ Add support for the new 'O' agetty option to display the DNS domainname
+ in the issue file thanks to Marius Mauch <genone@genone.de>, bug #22275.
+ Updated /etc/issue and /etc/issue.logo for this.
+
+ 16 Jul 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add aliases for add/del to /sbin/rc-update closing bug #24317, thanks
+ to Antonio Dolcetta <zagarna@yahoo.com>.
+
+ Fix /etc/init.d/net.eth0 to not set rp_filter if already set via
+ /etc/sysctl.conf, bug #24235 - thanks jochen <jochen.eisinger@gmx.de>.
+
+ Fix /sbin/runscript.sh and /lib/rcscripts/awk/cachedepend.awk to work
+ with symlinks in /etc/init.d/, closing bug #24228.
+
+ Fix /etc/init.d/clock to work with UML, closing bug #24225 thanks to
+ John Mylchreest <johnm@gentoo.org>.
+
+ Fix hardcoded color escape sequence in /sbin/rc, closing bug #24109,
+ thanks to splite <splite-gentoo@sigint.cs.purdue.edu>.
+
+ Fix /sbin/functions.sh to disable color printing if NOCOLOR is set to
+ "true" in /etc/make.conf, closing bug #24107.
+
+ Fix /etc/init.d/keymaps to be more non-x86 friendly, and also allow
+ more keymaps to be specified in /etc/rc.conf, bug #24084.
+
+ 15 Jul 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add /bin/csh to /etc/shells.
+
+ Add new protocols to /etc/services, thanks Rajiv Aaron Manglani
+ <rajiv@gentoo.org>.
+
+ 23 Jun 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Cleanups for bug #21438 from bug #22637, thanks to
+ Christian Strauf <christian.strauf@gmx.de> and Ian Abbott <ian@abbott.org>.
+
+ 22 Jun 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Really commit fix for bug #21438 to CVS.
+
+ 21 May 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Call /proc mount with explicit options to fix issues where user
+ have 'bind' mounts for /proc in fstab as well, bug #21068.
+
+ Fix /etc/init.d/bootmisc to check for /sbin/env-update.sh, bug #21384,
+ reported by Gunnlaugur Thor Briem <gthb@hi.is>.
+
+ Add 'before bootmisc' to /etc/init.d/domainname, as we need to start
+ it before 'env-update.sh' gets run by /etc/init.d/bootmisc.
+
+* rc-scripts 1.4.3.8p1 (21 May 2003)
+
+ 21 May 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Last fix I did not use the modified 'myservice', but used $1 again,
+ causing the network dependencies to bork. I did not notice this
+ as I have net.eth0 in default runlevel.
+
+* rc-scripts 1.4.3.8 (20 May 2003)
+
+ 20 May 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ A '-' in a bash variable is not valid as well. Fix gendepend.awk and
+ rc-service.sh to handle this, thanks to YAMAKURA Makoto
+ <makoto@dsb.club.ne.jp>.
+
+ Move /etc/issue to /etc/issue.logo, and have /etc/issue only print info
+ about the host it is running on.
+
+ 18 May 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Do not let devfsd handle /dev/log's permission management, as it breaks
+ selinux. Modified /etc/devfsd.conf, changes submited by Chris PeBenito
+ <pebenito@gentoo.org>.
+
+ Fix type-o in /etc/init.d/net.ppp0, and add local ip-up/ip-down support.
+
+ 14 May 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ We should not export the RC_GOT_* variables, as it breaks on some systems,
+ thanks to J?rg Gollnick <gentoo-bugs@wurzelbenutzer.de>, bug #20851.
+
+ From C. Brewer <killian@gentoo.org>:
+ - Add hide-password to the connect cmd-line of /etc/init.d/net.ppp0, which is
+ suppose to be default, but why take chances?
+ - Also, echoing chmod 640 in the resolv.conf two-step at the end to solve the
+ kppp complaint.
+
+ 13 May 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ For the network functions, the dependency code tried to create a funcion
+ with a '.' in the name, causing the network rc-scripts to not have any
+ dependencies. This should fix bug #20849 's order issue, thanks to
+ YAMAKURA Makoto <makoto@dsb.club.ne.jp> for noticing.
+
+ Fix query_{before,after} to also check 'net' if 'service2' is a network
+ service.
+
+ 12 May 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ More cleanups:
+ - Move the broken stuff from symlinks to a DB entry in ${svcdir}/deptree.
+ Updated /sbin/runscript.sh, /sbin/rc-services.sh and gendepend.awk for
+ this.
+ - Add functions for more common tasks in /sbin/runscript.sh to
+ /sbin/rc-services.sh.
+ - Move 'consoletype' to /sbin.
+ - Rename /sbin/rc-envupdate.sh to /sbin/env-update.sh; updated
+ /etc/init.d/bootmisc for this.
+ - Move rc-services.sh, rc-daemon.sh and rc-help.sh to /lib/rcscripts/sh.
+ - Improve detection of circular depends ... modified gendepend.awk for this.
+
+* rc-scripts 1.4.3.7 (11 May 2003)
+
+ 11 May 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Too many things to remember, so here is changes of note:
+ - More changes to gendepend.awk. This basically modifies it to not use
+ symlinks in $svcdir/{need,use,before,after,provide} anymore, but rather
+ create a file that can be sourced. Seems to speedup things nicely.
+ - Add /sbin/rc-services.sh. This is basically a module to get dependency
+ info from the new $svcdir/deptree, and some other new service functions.
+ - Modify the whole works to *only* source all needed files once. This
+ includes /sbin/{functions.sh,rc-services.sh,rc-daemon.sh}. Also
+ rc-services.sh will only source $svcdir/deptree once. /sbin/runscript.sh
+ is sourced more than once (actually each time a service is started or
+ stopped, but is is cut down much). Also seems to speed things up again.
+ - Fix a long outstanding bug in gendepend.awk that caused the 'net'
+ dependency to not be actually used in shutdown, causing the services
+ needing it to be stoped before net.* services.
+ - Add the RC_PARALLEL_STARTUP variable, with schedule_service_startup() to
+ /sbin/rc-services.sh and /etc/conf.d/rc. This is experimental parallel
+ startup of services, and seems to work nicely. Only issues to date is
+ that printing of messages is not synced, and a race very intermittantly
+ that causes a service to be started when it was already scheduled.
+ - Add a new dependency type 'parallel' that can be used to control if a
+ service can be started in paralled or not. Possible arguments is "yes"
+ or "no"; if it is not present, it is considered as "yes":
+
+ depend() {
+ parallel yes|no
+ }
+
+ Modified cachedepend.awk, gendepend.awk and /sbin/rc-services.sh.
+ - Fix the 'single' runlevel to actually work properly, and without a
+ /etc/runlevels/single directory.
+ - Remove the BOOT variable, and update /sbin/rc to set SOFTLEVEL properly.
+ Fix /etc/init.d/{checkroot,bootmisc} to use SOFTLEVEL instead of BOOT.
+
+ 08 May 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Major rework of /lib/rcscript/awk/gendepend.awk, cleaning it up nicely,
+ and adding more sanity checks.
+
+ 04 May 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Revert /etc/init.d/hostname the way it was, as it should be the user's
+ choice if he want to have a FQDN in there or not, bug #14946.
+
+ Add /etc/init.d/domainname for those that want to use it.
+
+ 29 Apr 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Change the root check back the way it was, else it breaks with non bash
+ shells; modified /etc/profile.
+
+ 29 Apr 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Change test in /etc/profile for root to '[ "$EUID" -eq 0 ]', bug #20140.
+
+ 27 Apr 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add various patches from Rachel Holmes <rach@gmx.net>:
+
+ Dropped use of 'cat' in bash scripts, '$(<$file)' is there for that
+ purpose. Modified:
+
+ /etc/init.d/net.ppp0
+ /etc/init.d/nscd
+ /sbin/functions.sh
+ /sbin/rc
+ /sbin/rc-daemon.sh
+ /sbin/rc-envupdate.sh.bash
+ /sbin/runscript.sh
+
+ Exchanged some gratuitous use of awk for grep. Awk is a little resource
+ hungry just for a simple test. (I [azarah] did not apply the changes to
+ tests for 'devfs', as having 'usbdevfs' in the equation will break
+ things). Modified /sbin/rc for this.
+
+ Gentoo enforces having /proc, so uname -r is a little redundant when the
+ information is available without an external command. Modified:
+
+ /etc/init.d/modules
+ /etc/init.d/serial
+ /sbin/functions.sh
+ /sbin/modules-update
+
+ Changed 'id -u' commands to use $EUID in bash executed scripts, same
+ result no extra command. Modified:
+
+ /sbin/rc-envupdate.sh
+ /sbin/rc-envupdate.sh.bash
+ /sbin/rc-update
+
+ Removed all the cat sections, and the separate echo sections. The output
+ is _exactly_ the same, minus some spare spaces that have been removed.
+ Fourfold speed increase in the (granted flimsy) tests I have done.
+ Modified /sbin/rc-help.sh for this.
+
+ Final remaining 'cat' commands removed, in favour of using bash's internal
+ '$(< )' or 'echo'. Use of echo leads the way to future support for bash's
+ i18n anyway. Modified:
+
+ /sbin/rc
+ /sbin/rc-envupdate.sh
+ /sbin/rc-envupdate.sh.bash
+
+
+
+* rc-scripts 1.4.3.6 (27 Apr 2003)
+
+ 27 Apr 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add a 'save' function /etc/init.d/clock, bug #19685.
+
+ Add a slocate group to /etc/group, bug #19604.
+
+ Do not stop a network service if we do not reboot on runlevel change,
+ as it could have been started by the user or hotplug. This should
+ address bug #12763; modified /sbin/rc for this.
+
+ Fix /etc/init.d/hostname to set only the hostname, and not the NIS
+ domainname.
+
+ Fix /etc/init.d/keymaps to be able to set the extended keymap in rc.conf.
+ This should close bug #16884.
+
+ Fix /etc/profile to be /bin/sh compadible, bug #18918.
+
+ Change the swap comments in /sbin/rc to "Activating (possible) swap" to
+ be more 'generic' ? Only try to disable swap if any devices/files was
+ activated. This should close bug #19089.
+
+ Fix /etc/init.d/checkroot to only remount / rw if not set explicitly to
+ rw in /etc/fstab, bug #19158.
+
+ 24 Apr 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix /etc/init.d/net.ppp0 to do the right thing if stopped was called,
+ but the ppp link was already down, bug #15333.
+
+ 12 Apr 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix type-o in /etc/init.d/consolefont (line 38 should be 'retval=$?').
+ Thanks to Matt Taylor <liverbugg@juno.com> (comment #6, bug #18344).
+
+ From linux-2.5.68, we need to mount devpts on /dev/pts again ...
+ updated /sbin/rc for this.
+
+ 11 Apr 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix errors on sourcing /etc/profile if EDITOR is not set, bug #18995.
+
+ 10 Apr 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Make checking in unmount more strict, fixing bug #19007.
+
+ 09 Apr 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add one more check to genenviron.awk, to spot cases where there is a
+ space between the variable and the '='.
+
+ 08 Apr 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix interactive shell not to have coloured prompt when used as a
+ dumb client, bug #18886. Fix was inspired by patch from
+ Matthew Kennedy <mkennedy@gentoo.org>.
+
+* rc-scripts 1.4.3.5 (06 Apr 2003)
+
+ 06 Apr 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Hopefully get the serial support sane again. Added /bin/consoletype
+ from Redhat to check for serial console. This should resolve bug
+ #18329 partly.
+
+ Add the --nocolor option to suppress the use of colors.
+
+ Change the 'status' option to return true if the service is running,
+ and false if stopped. This is only if the '--quiet' flag was also
+ given.
+
+ Change the start and stop options not to output or return false if
+ the '--quiet' flag was given.
+
+ Redirect stderr for consolechars in /etc/init.d/consolefont to /dev/null
+ as well, fixing bug #18344.
+
+ Optimize $EDITOR extraction in /etc/profile closing bug #18614, thanks to
+ Aron Griffis <agriffis@gentoo.org>.
+
+ Set HALT to 'shutdown' or 'reboot' depending on if we are shutting down
+ or rebooting.
+
+ 30 Mar 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix bug #18329 ... $COLS was not setup properly for serial console.
+
+ 24 Mar 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Optimize USB fs stuff in /etc/init.d/localmount to use less cats etc.
+ Fix a problem where it might not have mounted the USB fs when usbcore
+ was compiled as module, and the kernel did not mount it by the time
+ the script was started. Get it to rather check what filesystems is
+ supported when deciding if it should use 'usbdevfs' or 'usbfs', as
+ later 2.4 kernels now also support the newer 'usbfs'.
+
+ Optimize RAID stuff in /etc/init.d/checkfs a bit.
+
+ 16 Mar 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Update sbin/rc-envupdate.sh.bash for bug #17549.
+
+* rc-scripts 1.4.3.4 (16 Mar 2003)
+
+ 16 Mar 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add /etc/issue done by a Polish ascii-artists, v|rus with some slight
+ modifications (purple and display hostname, etc). Closes bug #16806.
+
+ Add 'use hotplug' to /etc/init.d/net.eth0, to get cardbus hardware to
+ work properly. Closes bug #17348.
+
+ Add update from Wout Mertens <wmertens@gentoo.org> to speedup shutdown
+ of dhcp interfaces, closing bug #17378. This modified /etc/init.d/net.eth0.
+
+ 11 Mar 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix usage of /usr/bin/cut in /sbin/functions.sh, thanks Brandon Low
+ <lostlogic@gentoo.org>!
+
+ 10 Mar 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add sysfs support for 2.5 kernels (mounted to /sys). Updated /sbin/rc
+ and /etc/init.d/halt.sh for this.
+
+ Update /etc/fstab to correctly mount /proc with:
+
+ mount -t proc none /proc
+
+ Do the same for /dev/shm:
+
+ mount -t tmpfs none /dev/shm
+
+ Fix a typeo in /etc/init.d/checkroot that caused 'umount -a' to output
+ noise if we exited a recovery console.
+
+ Fix /etc/init.d/hostname using /usr/bin/cut, closing bug #17175, thanks
+ to Bobby Bingham <uhmmmm@columbus.rr.com> for noticing this.
+
+ Bring down default gateway before adding new one .. this fixes issues
+ where eth0/whatever was brought up by kernel. Changed /etc/init.d/net.eth0
+ for this, closing bug #17164. Thanks to nth <y.lesaint@free.fr> for the
+ fix.
+
+ Fix /etc/init.d/modules to call modprobe with -q .. this fix issues where
+ it fails for module-init-tools if the module is already loaded. This
+ closes bug #17163, thanks to nth <y.lesaint@free.fr>.
+
+* rc-scripts 1.4.3.3 (09 Mar 2003)
+
+ 09 Mar 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix /etc/init.d/netmount not to unmount / on nfs/whatever, bug #16274.
+
+ Fix net.eth0 not to try and start an interface if already up.
+
+ Update MAKEDEV from Debian to support more archs. This adds support
+ for 'arm', 'hppa' among others. URL:
+
+ http://packages.debian.org/stable/base/makedev.html
+
+ Add support to /etc/init.d/modules to use /etc/modules.autoload/kernel-2.4
+ if we are using a 2.4 kernel, and /etc/modules.autoload/kernel-2.5 if we
+ are using a 2.5 kernel ... bug #17109.
+
+ 02 Mar 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Update /etc/init.d/hostname to only set the hostname to whatever is before
+ the first '.', and then set the domainname to the rest, closing bug #14946.
+
+ 28 Feb 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Merge some of the optimizations from Graham Forest <vladimir@gentoo.org>.
+
+ Fix spelling of dependency and some other spelling/grammer issues.
+ Thanks goes to Kerin Millar <kerin@recruit2recruit.net> and
+ Mike Frysinger <vapier@gentoo.org>, bug #15498.
+
+ Change $svcdir to '/var/lib/init.d' to be more FHS compliant, bug #15192.
+
+ Add 'Eterm' to /etc/skel/.bashrc, closing bug #14662.
+
+ Adjust comments about PROTOCOLS in /etc/rc.conf to try and prevent
+ bug #14556.
+
+ 27 Feb 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Finally fix /etc/init.d/halt.sh to unmount non critical mounts properly.
+
+ 20 Feb 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Kill /dev/ttyp0 error at boot by changing test in /etc/init.d/modules
+ to 'test -c /dev/ttyp0 &> /dev/null'.
+
+ 18 Feb 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Update /sbin/modules-update to generate /etc/modprobe.devfs from
+ /etc/modules.devfs. This along with the devfs-hack.patch in the latest
+ module-init-tools-0.9.9 should get rid of many of the warnings/errors
+ with devfs, and makes it work a bit better.
+
+ 17 Feb 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix /etc/inputrc for dvorak keyboard layout, bug #2599 again.
+
+ 16 Feb 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix the 'source /etc/profile.env' to be '. /etc/profile' to have ksh
+ support. This resolves bug #14994.
+
+ Move EDITOR to /etc/rc.conf. Also update /etc/profile to set EDITOR
+ according to /etc/rc.conf.
+
+ Update /etc/init.d/checkfs to fix bug #14282. It did not exclude comments,
+ and used 'basename' which is located in /usr/bin.
+
+ 13 Feb 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Merge changes from Nick Jones <carpaski@gentoo.org> to not run stty if
+ used in portage. Fix the NOCOLOR stuff. Updated /sbin/functions.sh for
+ this.
+
+ 06 Feb 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Update src/awk/genenviron.awk to properly set the environment for each
+ rc-script's depend() function by sourcing required config files.
+
+ 05 Feb 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix /sbin/rc-envupdate.sh to use $svcdir to set SVCDIR. This is thanks
+ to Max Kalika <alkern23@yahoo.com>, bug #15050.
+
+ 03 Feb 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix /sbin/modules-update to work with module-init-tools-0.9.9.
+
+ 30 Jan 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add 'use isapnp' to /etc/init.d/modules, closing bug #14677, thanks to
+ Hubert Hanghofer <hubert.hanghofer@netbeer.co.at>.
+
+ 27 Jan 2003; Donny Davies <woodchip@gentoo.org>:
+
+ Fix halt.sh by moving the nut UPS kill power stuff back into a function!
+ Add fix from the wonderful analysis of Toby Dickenson
+ <tdickenson@geminidataloggers.com> in #12947.
+
+ 26 Jan 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix start-stop-daemon to check the call to nice() correctly for failure,
+ closing bug #14359, thanks to YAMAKURA Makoto <makoto@dsb.club.ne.jp>.
+
+ Fix globbing $? when checking return value of fsck in /etc/init.d/checkroot
+ and /etc/init.d/checkfs. This closes bug #13320, thanks to good work from
+ Malcolm Scott <m@lcolm.org.uk>.
+
+ 21 Jan 2003; Mike Frysinger <vapier@gentoo.org>:
+
+ Updated /etc/rc.conf to add elogin/entrance support #13790.
+
+ 21 Jan 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Update /etc/init.d/keymaps to enable unicode if required. This closes
+ bug #14306 thanks to Danny Milosavljevic <danny_milo@yahoo.com>.
+
+ 19 Jan 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix deadlock durning shutdown if tmpfs filesystems larger than free
+ memory, and swap gets deactivated, bug #13599. Updated /etc/init.d/halt.sh
+ for this.
+
+ Merge in some fixes from Vapier <vapier@gentoo.org> to /sbin/functions.sh.
+ This closes bug #13868.
+
+ Always add "/bin:/sbin:/usr/bin:/usr/sbin" to PATH, as it fixes both
+ 'su -c foo' not finding start-stop-daemon (etc), and bug #14127.
+
+ Add route for lo interface to /etc/init.d/net.lo, closing bug #14055.
+
+ 15 Jan 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Clear $svcdir in /sbin/rc before we run depscan to make sure we do
+ not have stale entries left from hard reboot, thanks to pac1085 on
+ irc.
+
+* rc-scripts 1.4.3.2 (15 Jan 2003)
+
+ 15 Jan 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Truely fix bootup on seperate /var.
+
+ Add some fixes and optimizations to /sbin/rc-update, thanks to
+ Daniel Robbins <drobbins@gentoo.org>.
+
+* rc-scripts 1.4.3.1 (15 Jan 2003)
+
+ 15 Jan 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix bootup on seperate /var.
+
+ 14 Jan 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix /etc/init.d/hostname and /etc/init.d/serial to close bug #13636.
+
+ 07 Jan 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix /etc/init.d/keymaps to force linux keycodes for PPC, thanks
+ to Olaf Hering <gentoo@aepfle.de>, bug #13193.
+
+ Turn on -C option to fsck on for all calls to fsck. Updated scripts
+ /etc/init.d/checkroot and /etc/init.d/checkfs, closing bug #13321.
+
+* rc-scripts 1.4.3.0 (07 Jan 2003)
+
+ 07 Jan 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Too much to mention, but here are a few:
+ - Major rewrite of software RAID startup, based on Mandrake's, as
+ ours was pretty broken :(
+ - Redone /sbin/rc to work without the tmpfs/ramfs stat directory.
+ Much of /sbin/functions.sh and other scripts have been changed
+ to support this.
+ - Reworked /etc/inittab to support this. Also moved critical
+ mounting of local filesystems to 'sysinit' function of /sbin/rc.
+ - Move state directory to /var/state/init.d/ ($svcdir).
+ - Move Adelie node init to /sbin/functions.sh to try and simplify
+ /sbin/rc a bit.
+ - Updated Copyright dates to 2003.
+
+* rc-scripts 1.4.2.8 (06 Jan 2003)
+
+ 02 Jan 2003; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix src/awk/genenviron.awk to work with multiple 'need', 'use', etc
+ lines, as it seems users do not note the need to have them all on
+ one line ....
+
+ Fix /sbin/runscript.sh to detect 'net.adsl', or any other net.*
+ script not ending on a digit. This closes bug #12887.
+
+ Fix get_KV to also check micro version of kernel; add KV_to_int()
+ helper function for get_KV. Update /etc/init.d/localmount to work
+ with new get_KV ...
+
+ 28 Dec 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add support for generate-modprobe.conf or generating /etc/modprobe.conf
+ in the new sys-apps/module-init-tools. Note that you need version
+ 0.9.7 or later of sys-apps/module-init-tools. Updated
+ /sbin/modules-update for this.
+
+ Change /etc/init.d/localmount to use 'usbfs' and not 'usbdevfs' if
+ we are running kernel 2.5 or later ...
+
+ 26 Dec 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add /etc/init.d/crypto-loop and /etc/conf.d/crypto-loop, a cool
+ rc-script to setup encrypted loopback devices. This was kindly
+ donated by Matthew Kennedy <mkennedy@gentoo.org> (bug #11471).
+
+ 25 Dec 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix src/awk/genenviron.awk stripping *all* '=', closing
+ bug #8901.
+
+ Fix src/awk/genenviron.awk not seperating CONFIG_PROTECT with
+ spaces ...
+
+* rc-scripts 1.4.2.7 (24 Dec 2002)
+
+ 24 Dec 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add a fix to /sbin/functions.sh for bug #12601.
+
+ 22 Dec 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add INFOPATH to /etc/env.d/00basic.
+
+ Fix src/awk/genenviron.awk to get the order of the env.d files
+ correct. Also fix it to handle *all* the SPECIALS correctly.
+ This closes bug #12411.
+
+* rc-scripts 1.4.2.6 (18 Dec 2002)
+
+ 18 Dec 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add mips changes to sbin/MAKEDEV. This should close bug #12329,
+ thanks to Nicholas Wourms <nwourms@netscape.net>.
+
+ Quote some tests in /sbin/rc-update to fix/avoid the problem
+ in bug #
+
+ Fix awk regex in /etc/init.d/halt.sh to fix bug #11795.
+
+ Update shell for postgres user, closing bug #12258.
+
+ 11 Dec 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix src/awk/genenviron.awk not to add duplicate entries, closing
+ bug #8999.
+
+* rc-scripts 1.4.2.5 (09 Dec 2002)
+
+ 08 Dec 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add another sync to /etc/init.d/halt.sh, closing bug 8173.
+
+ Add smmsp uid and gid. Closes bug #8952.
+
+ 04 Dec 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Setup colums, etc up properly for serial consoles in /sbin/functions.sh.
+ Closes bug #11557, thanks to Erik Scrafford <erik@scrafford.org>.
+
+ Add headers similar to that of portage-2.0.45 and up to the
+ generated profile files (/etc/{profile,csh}.env). Updated
+ src/awk/genenviron.awk for this.
+
+ 01 Dec 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix typeo in /etc/devfsd.conf, closing bug #11424, thanks to the
+ sharp eye of Techie2000 <Linux@mochamail.com>.
+
+ Rename /sbin/update-modules to /sbin/modules-update, closing
+ bug #11445.
+
+ Nano moved from /usr/bin/nano to /bin/nano. Fix this in
+ /etc/env.d/00basic, bug #10916.
+
+ 27 Nov 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add more improvements to clustering code. This is from
+ Olivier Crete <crete@cerca.umontreal.ca>, bug #4151.
+
+ 26 Nov 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Change default 'net' dependency behaviour to be more suited
+ for notebook users. Basically if at least one net.* service
+ beside net.lo start successfully, the 'net' dependency is
+ considered up. Server admin can set RC_NET_STRICT_CHECKING="yes"
+ in /etc/conf.d/rc to change this back to the old default.
+ This is the start to address bug #2706.
+
+* rc-scripts 1.4.2.4 (26 Nov 2002)
+
+ 26 Nov 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Initial merge of bits for Adelie Linux for SSI clusters. More
+ info at:
+
+ http://www.cerca.umontreal.ca/hpc/en/projects/adelie/index.html
+
+ 25 Nov 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ One liner fix to src/awk/cachedepends.awk to once again fix
+ bug #7803.
+
+ 18 Nov 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add 'alias char-major-89 i2c-dev' to /etc/modules.d/aliases.
+ This should close bug #10891.
+
+* rc-scripts 1.4.2.3 (18 Nov 2002)
+
+ 18 Nov 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add some more checks to src/awk/*. Fix error printing for
+ /sbin/depscan.sh.
+
+ Link awk module with gcc and not with ld. This should fix
+ problems on sparc and alpha. Many thanks for this fix to
+ Stephan Jones <cretin@gentoo.org>.
+
+ Remove the copyright info from config files, thanks to
+ Matthew Kennedy <mkennedy@gentoo.org>.
+
+* rc-scripts 1.4.2.2 (18 Nov 2002)
+
+ 18 Nov 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add src/awk/genenviron.awk which is rc-envupdate.sh ported
+ to awk. This is also much faster than its bash version.
+
+ Remove the 'Spider cat fix' from depscan.sh.bash, as it makes
+ things even slower on older boxes. Bug #10548.
+
+ After a bored Vapier decided that he needed to update the
+ licenses of things in /etc :P, I did the rest. Hopefully
+ not too many people will nuke thier fstab :/
+
+* rc-scripts 1.4.2.1 (18 Nov 2002)
+
+ 18 Nov 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Update src/awk/cachedepends.awk to find its own rc-scripts,
+ fixing the need for find which broke systems with /usr on
+ a different partition.
+
+ 17 Nov 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add some extra checks to src/awk/cachedepends.awk and
+ src/awk/gendepends.awk.
+
+ Move some of the more generic functions in src/awk/gendepends.awk
+ to src/awk/functions.awk.
+
+* rc-scripts 1.4.2 (17 Nov 2002)
+
+ 17 Nov 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add initial version of new depscan.sh. This uses awk scripts
+ to do the main work, giving about 10 times speed improvement on
+ slower machines. Updated /sbin/depscan.sh, src/filefuncts.c,
+ src/Makefile, src/awk/cachedepends.awk and src/awk/gendepends.awk
+ for this. This should close bug #10548.
+
+* rc-scripts 1.4.1.2 (5 Nov 2002)
+
+ 5 Nov 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add UID/GID of 250 for Portage Fakeroot account.
+
+ 4 Nov 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Change /etc/init.d/clock to depend on localmount again, fixing
+ bug #10048.
+
+ Get deps on logger sane again. I wanted to get the logger started
+ as early as possible, but clock for one breaks if /usr is mounted
+ on seperate partition.
+
+ 29 Oct 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix return in /etc/init.d/modules to return 0 if /proc/modules
+ do not exists. Closes bug #7738, comment #5.
+
+* rc-scripts 1.4.1.1 (28 Oct 2002)
+
+ 28 Oct 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix /sbin/update-modules not to include backup files. Closes
+ bug #9707.
+
+ 26 Oct 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix update-modules borking if there are directories present
+ in /etc/modules.d/. Closes bug #9632.
+
+ 17 Oct 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Change deps on /etc/init.d/{clock,hostname,modules} not to
+ depend on localmount, but rather on checkroot, as all of them
+ just need / to be mounted. This should fix race conditions
+ because of checkfs dependency on modules. This should close
+ bug #9266.
+
+* rc-scripts 1.4.1 (13 Oct 2002)
+
+ 13 Oct 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Create and fix permissions on /tmp/.{ICE,X11}-unix/. This
+ is additional measures for bug #8281.
+
+ 12 Oct 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Update /etc/init.d/net.eth0 to fix bug #8626.
+
+ Fix /sbin/rc-update to check return code of "ln". This should
+ close bug #8867.
+
+ 29 Sep 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix indentation in /etc/inputrc. This should close
+ bug #8368.
+
+ Add extended status functionality. Should close bug #2462.
+
+ Add support for /sbin/rc-update to check if the rc-script
+ is executable or not. Thanks to widersacher@gmx.net, closing
+ bug #8326.
+
+ 25 Sep 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix /etc/init.d/bootmisc not to kill pidfiles of running
+ daemons. Improve NGPT support in /sbin/rc a bit.
+
+ 23 Sep 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix my last screwup with /etc/init.d/net.ppp0. Basically
+ forgot to change a few DEVICE's to IFACE ...
+
+ 22 Sep 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ NGPT support.
+
+ 17 Sep 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Did a small fix to /etc/init.d/net.eth0, thanks to
+ naanyaar2000@yahoo.com, bug #7407.
+
+ 16 Sep 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add the permission stuff for generic scsi when compiled as
+ module, thanks to Bauno <bauno@inwind.it>.
+
+ Add support for /etc/devfs.d/ for additional devfs config
+ stuff .. idea from Denys Duchier <Denys.Duchier@ps.uni-sb.de>.
+
+ 11 Sep 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix small type-o from last changes to /etc/init.d/netmount.
+ Should resolve bug #7803.
+
+* rc-scripts 1.4.0 (7 Sep 2002)
+
+ 7 Sep 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Update /etc/init.d/net.eth0 to handle individual broadcast
+ and netmask for aliases. Should close bug #7407.
+
+ Give /var/run/utmp and /var/log/wtmp the proper permissions
+ and ownership. First steps in fixing bug #7630.
+
+ Change Raid stuff again in /etc/init.d/checkfs.
+
+ 26 Aug 2002; Donny Davies <woodchip@gentoo.org>:
+
+ Give root a 'root' GECOS in /etc/passwd, was NULL before.
+
+* rc-scripts 1.3.9 (25 Aug 2002)
+
+ 25 Aug 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Update /sbin/rc to fix some spelling/slang mistakes. Closes
+ bug #6887.
+
+ Move /etc/init.d/net.ppp0 's config to /etc/conf.d/net.ppp0.
+ This closes bug #6378.
+
+ Add IPv6 support to /etc/init.d/net.eth0. Closes bug #6175,
+ with many thanks to Asbjorn Sannes <ace@sannes.org>.
+
+ 20 Aug 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Update /etc/init.d/bootmisc to reset pam_console permissions.
+
+ Update /etc/devfsd.conf to have the "pam_console_apply_devfsd.so"
+ line for getting devfs to work with pam_console.
+
+ 12 Aug 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Update /etc/init.d/keymaps to first load the windowkeys.inc then
+ the user selected one, fixing bug #6295.
+
+ 11 Aug 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Change the 'cat' in check_rcscript() to a single 'awk' in
+ /sbin/depscan.sh. This should fix broken pipe issues if the
+ loop exists too early. Resolves bug #5961.
+
+ Fix software RAID startup/shutdown, bug #5310. Modified
+ /etc/init.d/checkfs and /etc/init.d/halt.sh for this.
+
+* rc-scripts 1.3.8 (08 Aug 2002)
+
+ 7 Aug 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Move the color ls stuff to .bashrc. Fix bug #5250.
+
+ 6 Aug 2002; Dan Armak <danarmak@gentoo.org>:
+
+ Correct the comments in rc.conf about the XSESSION variable: it should
+ be set to "kde-<version>" not "KDE". Closes bug #5948.
+
+ 5 Aug 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix the 'Usage' line in the help to return the correct options for
+ the script (/sbin/runscript.sh). Resolve bug #6029.
+
+ 3 Aug 2002; Donny Davies <woodchip@gentoo.org>:
+
+ Added UPS shutdown support for nut to halt.sh.
+ Added nut user/group as uid/gid 84.
+
+ 27 Jul 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Updated /sbin/rc's way of checking for devfs support (now rather uses
+ awk, as it is more accurate). Closes bug #5458.
+
+ Add the Redhat/Mandrake /forcefsck and /fastboot options to our checkroot
+ and checkfs. Updated /etc/init.d/{checkroot,checkfs,halt.sh} for this.
+ Thanks goes to Chris PeBenito (bug #5570).
+
+ Changed most daemons to use /bin/false as shell. Should close bug #5388.
+
+ 27 Jul 2002; Nicholas Jones <carpaski@gentoo.org>:
+
+ Added vpopmail user and group as 89:89
+
+ 22 Jul 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add the cyrus user to /etc/passwd. Resolves bug #4100.
+
+ Some bugfixes and speed improvements to /sbin/depscan.sh after
+ last changes.
+
+ Replace some cat/grep's in /sbin/rc-envupdate.sh with awk's to
+ get some speed improvements.
+
+ 21 Jul 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix LVM support in /etc/init.d/checkfs again, thanks to help from
+ Kyle Manna <nitro@gentoo.org>.
+
+ Add software RAID support to /etc/init.d/checkfs, thanks to
+ Daniel Ahlberg <aliz@gentoo.org>.
+
+ Update the cache_depend() funtion in /sbin/depscan.sh not to
+ quit on any "}", but only on the one matching the first "{". This
+ requires wc in /bin, so baselayout should depend on
+ >=sys-apps/textutils-2.0.19-r2
+
+ Update /etc/init.d/netmount to try and detect nfs mounts that should be
+ mounted automatically on boot. This requires awk in /bin, so baselayout
+ should depend on >=sys-apps/gawk-3.1.0-r3.
+
+* rc-scripts 1.3.7 (17 Jul 2002)
+
+ 17 Jul 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add logging functionality to the rc-scripts, thanks to Alexander Holler,
+ bug #4037 for the basic idea. Updated /sbin/functions.sh for this.
+
+ 16 Jul 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add additional entries to /etc/services to support cyrus-imapd, thanks
+ to Nick Hadaway <raker@gentoo.org>.
+
+ Update /etc/init.d/consolefont to resolve bug #4968. This fixes a
+ problem with non 7bit ascii symbols.
+
+ Updated /etc/init.d/checkfs to detect if lvm is already active.
+ This should resolve bug #3613.
+
+ 5 Jun 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add "usb" group, gid 85. Move "sshd" user and group to 22. Move
+ "games" user and group to 35
+
+ 3 Jun 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Update Copyright displayed at boot, thanks to Sascha Schwabbauer
+ (aka cybersystem). Updated /sbin/rc for this.
+
+ 30 Jun 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Update /etc/skel/.bashrc to update the window title of X terminals
+ that supports it. Closes bug #4232.
+
+ 26 Jun 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add sshd user and group. Updated /etc/passwd and /etc/group for this.
+
+ Update /etc/inputrc to resolve bug #2599.
+
+ 20 Jun 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add /opt/bin to $PATH and $ROOTPATH, closing bug #3603. Modified
+ /etc/env.d/00basic for this.
+
+ Add some new daemon stop and pid detection stuff to /sbin/functions.sh.
+ Nothing official, but I spent enough time on it not to want to loose it :)
+
+ Fixed a bug in /sbin/functions.sh that caused rc-scripts run as cron jobs
+ to give output to stderr. This was caused by a call to "stty", which when
+ run without a attatched terminal, have this effect. Basically just pipe
+ stderr to /dev/null.
+
+ 5 Jun 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add /usr/local/share/man to $MANPATH (/etc/env.d/00basic), resolving
+ bug #3363
+
+ 26 May 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Update /etc/init.d/netmount not to try and mount NFS filesystems
+ if portmap was not started. This is to stop "hang" problems for
+ new users who do not add portmap to the default runlevel. See
+ bug #2555.
+
+ Add the video4linux stuff to /etc/devfsd.conf. Resolves bug #2015.
+
+ 19 May 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Move $EDITOR from /etc/profile to /etc/env.d/00basic.
+
+ 13 May 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Change the homes of user "at" and "cron" in /etc/passwd, as
+ they moved to /var/spool/cron...
+
+* rc-scripts 1.3.5 (12 May 2002)
+
+ 12 May 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Make slight modifications to /sbin/depscan.sh to improve speed (about
+ 1 second on a celeron 633).
+
+ Finally fix /sbin/runscript.sh to properly handle interdependencies
+ between types need/use and before/after on runlevel change. I can
+ actually kick myself for previous implementations, as this fix simplifies
+ things a lot, and is almost 30 lines of code less!
+
+ Change /etc/init.d/netmount not to fail if all mounts are not mounted.
+ It rather just exit with a warning, as I think most people have like
+ me mounts that are to boxes that are not always up.
+
+ Resolve bug #2439 (should not use try with the dd command for ramdisk
+ stuff). Also increase the number of inodes used for the ramdisk to
+ fix "out of space" errors. Updated /sbin/rc for this.
+
+ 10 May 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Resolve bug #2505 ... /sbin/rc-envupdate.sh should not use
+ backup files to generate /etc/profile.env.
+
+ Resolve bug #2489 and #2175. Modified /etc/init.d/net.eth0
+ for this.
+
+ 6 May 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fixed /sbin/rc-envupdate.sh to only use the $KDEDIR of the highest
+ /etc/env.d/ file. Same for $QTDIR.
+
+ 5 May 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add /etc/DIR_COLORS as it is no longer shipped with fileutils,
+ and is needed for some fixes.
+
+ 28 Apr 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Update /etc/rc.conf to be more clear and state that you should
+ remove consolefont from startup if you do not use it. Should
+ resolve bug #2174.
+
+ 26 Apr 2002; Donny Davies <woodchip@gentoo.org> passwd, group :
+
+ Added user/group apache with uid/gid 81.
+
+ 25 Apr 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Remove the "-net" from the line setting the default gateway
+ in /etc/init.d/net.eth0. Thanks to Peter W. Michaleas for
+ noting this.
+
+ 24 Apr 2002; Donny Davies <woodchip@gentoo.org> rc.conf :
+
+ Remove NFSSERVER from rc.conf since it's now covered in /etc/conf.d/nfs
+ which is installed with the nfs-utils package. Also tidied up some
+ really old, leftover junk like the non-supported stuff from rc5.
+ Closes #1754.
+
+ 23 Apr 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Remove creation of /var/run/utmpx from bootmisc again. Seems
+ other people have wierd problems.
+
+* rc-scripts 1.3.4 (21 Apr 2002)
+
+ 21 Apr 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add /sbin/rc-envupdate.sh to speedup updating of /etc/profile.env,
+ and /etc/csh.env. Update /etc/init.d/bootmisc to use this.
+
+ Implement the status commandline argument. Updated /sbin/runscript.sh
+ and /sbin/rc-help.sh for this.
+
+ Fix /sbin/depscan.sh to honour NEED and USE overriding BEFORE
+ and AFTER.
+
+ 12 Apr 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Update /etc/init.d/bootmisc to create /var/run/utmpx. This
+ is needed, else /usr/bin/newgrp segfault.
+
+ 11 Apr 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Update /etc/skel/.bash_profile to make it tcsh compadible.
+ Thanks to Väinö Järvelä for this fix.
+
+ Update /etc/profile to also set the PS? variables if $SHELL
+ is set to /bin/sh. This should make prompt colours in
+ bootstrap work again.
+
+ Move LVM stuff to checkfs to ensure that they get fscked.
+ This resolves bug #1552.
+
+* rc-scripts 1.3.3 (5 Apr 2002)
+
+ 5 Apr 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Move /etc/init.d/{depscan.sh,runscript.sh,functions.sh} to /sbin.
+ This is done to try and ensure system integrity.
+
+ 1 Apr 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add quotes to the "export INPUTRC=/etc/inputrc" line to resolve bug #1391.
+
+ Add a error message to /etc/init.d/consolefont, resolving bug #1415.
+
+ Add a bash check to the code that sets the prompt, fixing bug #1078.
+
+* rc-scripts 1.3.2 (24 Mar 2002)
+
+ 24 Mar 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Resolve bug #1274. Updated /etc/init.d/hostname and /etc/init.d/bootmisc
+ for this.
+
+ With the "before" and "after" stuff, recursion levels was getting too high,
+ and with some cases, things just plain did not work as it should. Reworked
+ things to to lower the levels of recursion and get the order right. Updated
+ /etc/init.d/runscript.sh for this.
+
+ Fixed a problem in /sbin/rc and /etc/init.d/runscript.sh where
+ ${svcdir}/softlevel did not always exist, but runscript.sh tried to open it.
+
+ Enhance --quiet support. Updated /etc/init.d/functions.sh for this.
+
+ Remove /etc/pwdb.conf, as pwdb already install a copy of this.
+
+ Remove /etc/pam.d/{rexec,rlogin,rsh} as pam already install this.
+
+ Added $INPUTRC to /etc/profile, since too many people keep on bugging me,
+ and it seems it has fallen now to my discression.
+
+* rc-scripts 1.3.1 (23 Mar 2002)
+
+ 23 Mar 2002; Daniel Robbins <drobbins@gentoo.org>: init.d/net.eth0: fix for
+ DHCP lease release from Jim Nutt.
+
+ 23 Mar 2002; Daniel Robbins <drobbins@gentoo.org>: rolling a new release
+ since there are a lot of important bug fixes in here that are needed.
+
+ 23 Mar 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Resolve bug #1292.
+
+ Remove the extra 'depmod -a' in /etc/init.d/modules, thanks to
+ Spidler.
+
+ 21 Mar 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Update /sbin/rc to fix a 'cat mounts' instead of the correct
+ version, 'cat /proc/mounts'.
+
+ 19 Mar 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add initial support for the --quiet flag that suppress output.
+
+ 18 Mar 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Remove the 'try' from 'try /etc/init.d/depscan.sh' in /sbin/rc
+ as not all errors by depscan.sh is critical. It should be
+ reworked to do better error handeling.
+
+ 14 Mar 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix the GID and UID of nobody and nogroup in /etc/passwd and
+ /etc/group to match those of Debian, FBSD and others. Thanks
+ to those who reported it, and Woodchip for looking up the
+ proper values.
+
+ Update /etc/init.d/net.eth0 to properly down DHCP interfaces.
+ This resolves bug #1150, thanks to Paul Fleischer.
+
+ 11 Mar 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Updated /etc/init.d/functions.sh not to use /usr/bin/basename,
+ as some users have /usr on seperate partition which is not
+ mounted when depscan.sh is run the first time.
+
+ Updated the checking for more than one service providing the
+ same virtual function in /etc/init.d/depscan.sh. It should
+ be working now, and this also fix a problem that when there is no
+ service providing a virtual, counter was used uninitialized.
+
+* rc-scripts 1.3.0 (10 Mar 2002)
+
+ 10 Mar 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Resolved bug #1021; updated /etc/init.d/consolefont for this.
+
+ Resolved bug #1029; updated /etc/init.d/net.eth0 for this.
+
+ Resolved bug #990; updated /etc/init.d/net.eth0, /etc/init.d/netmount
+ and /etc/init.d/localmount for this.
+
+ Lots of form/syntax cleanups, most things should be more
+ consistant now. Fixed fail detection/return values of lots of
+ scripts.
+
+ Lots of cleanup/fixes in the three main scripts behind our
+ rc-system, /sbin/rc, /etc/init.d/depscan.sh, /etc/init.d/runscript.sh
+
+ Fix a bug regarding a invalid $PATH for portage if /etc/init.d/functions.sh
+ is sourced in a ebuild.
+
+ Fix a bug that our rc-script wrapper introduced: Global variables
+ in scripts no longer worked. Updated /etc/init.d/runscript.sh for
+ this.
+
+ Implemented more error checking for the main startup code in /sbin/rc.
+ Also fixed try() for mounting /proc (maybe all mount commands).
+ The function worked fine in a simulated test, but in real life failed
+ to detect a error when mounting /proc (remember to thank Grant for
+ his UserMode ebuilds, and Guide).
+
+* rc-scripts 1.2.9 (6 Mar 2002)
+
+ 6 Mar 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ General form updates and some piping fixes.
+
+ Updated /etc/inittab, /etc/init.d/xdm and /etc/X11/startDM.sh
+ to fix a problem where startDM.sh would be respawned repeatedly
+ if xdm was not in the default runlevel.
+
+* rc-scripts 1.2.8 (4 Mar 2002)
+
+ 4 Mar 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add /etc/init.d/xdm, /etc/X11/startDM.sh and updated /etc/inittab
+ to fix the "dead key" problem we had with xdm/gdm/kdm. We should
+ move them to the xfree ebuild later on when things settles down.
+
+ Added some sanity checks to /sbin/rc, /etc/init.d/runscripts.sh.
+
+ Added a basic $PATH to /etc/init.d/functions.sh to fix a problem
+ where we had a invalid $PATH on boot in some cases.
+
+ Updated /etc/init.d/keymap and /etc/init.d/consolefont to work with
+ the new sys-apps/kbd package.
+
+* rc-scripts 1.2.7 (3 Mar 2002)
+
+ 3 Mar 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fixed the problem of rc-scripts trying to start/stop a service multiple
+ times if it fails to do so. Updated /etc/init.d/runscript.sh and /sbin/rc
+ for this.
+
+ Fixing some variable declarations in /etc/init.d/runscript.sh caused
+ /etc/init.d/net.lo to fail on stop ($IFACE was set invalid). Fixed
+ this.
+
+ Added caching of the "depend() { need foo; } " lines, and updated
+ /etc/init.d/depscan.sh to touch the actual files less. This should
+ speedup dependency caching a lot, especially on slow machines.
+
+ Updated /etc/passwd to have users with no shell defined, use /bin/false
+ for security.
+
+ Update /etc/fstab to mention /dev/shm since we dont mount it anymore.
+
+ 1 Mar 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Added a wrapper for sourcing the rc-scripts to eliminate syntax errors.
+ Thanks to Karl Trygve Kalleberg (aka karltk) for the idea. Updated
+ /etc/init.d/depscan.sh, /etc/init.d/functions.sh and
+ /etc/init.d/runscript.sh for this (added wrap_rcscript() function).
+
+ Removed stopping of dependent services that have current service as
+ a 'use'dependency ... should be less confusing now.
+ Updated /etc/init.d/runscript.sh for this.
+
+ 28 Feb 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Add /etc/conf.d/local.start and /etc/conf.d/local.stop for adding any misc
+ programs to startup. This should pretty much have /etc/init.d/ static,
+ except for baselayout updates, etc.
+
+ 27 Feb 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ In some wierd cases, a redundent /dev/.devfsd on a unmounted /dev can cause
+ problems. Fixed this in /sbin/rc.
+
+ Added the patches from Grant Goodyear (aka g2boojum) to enable us to
+ use a ramdisk to store the contents of ${svcdir}. Updated /sbin/rc,
+ /etc/init.d/functions.sh and /etc/init.d/checkroot for this.
+
+ 26 Feb 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Fix my brain dead update of the 25th. It really should keep
+ "gentoo=nodevfs" in mind. Also added 'get_bootparam()' to help in
+ retrieving kernel options. Updated /etc/init.d/functions.sh,
+ /etc/init.d/checkroot and /sbin/rc for this.
+
+ Updated /etc/init.d/consolefont to work without devfs as well.
+
+ When rebooting or shutting down, a service should not fail to stop
+ if a service it depends on, fails. Updated /etc/init.d/runscript.sh
+ for this.
+
+ 25 Feb 2002; Martin Schlemmer <azarah@gentoo.org>:
+
+ Added a check if /dev is mounted when creating entries for /etc/mtab.
+ This should solve a invalid entry or /dev being mounted even with
+ 'gentoo=nodevfs' option. Updated /etc/init.d/checkroot for this.
+
+ 17 Feb 2002: Daniel Robbins <drobbins@gentoo.org>: Made "xfs" the default
+ filesystem in /etc/fstab (from ReiserFS) and removed "notail" option (it's
+ just in a comment now)
+
+ 17 Feb 2002: Martin Schlemmer (azarah@gentoo.org):
+
+ Mmore fixes to 'after' and 'before', updated /etc/init.d/runscript.sh for
+ this. This should fix services not getting started in the correct order
+ in a tight loop, services getting stopped out of order, and some other
+ sanity checks. Updated rc-script.sh for updated help.
+
+ 15 Feb 2002: Martin Schlemmer (azarah@gentoo.org):
+
+ Update /etc/profile to resolve bug #588. Reimplemented things a bit,
+ and added the 'after' type. 'before' and 'after' will only work currently
+ for a change of runlevel. Updated /etc/init.d/depscan.sh,
+ /etc/init.d/runscript.sh and /sbin/rc for this.
+
+ 13 Feb 2002: Martin Schlemmer (azarah@gentoo.org):
+
+ Add some more entries to /etc/devfsd.conf to make alsa users life
+ easier ... thanks Tod.
+
+ 12 Feb 2002: Martin Schlemmer (azarah@gentoo.org):
+
+ Some more cleanups to /etc/init.d/depscan.sh and /etc/init.d/runscript.sh.
+
+ Fixed some services not starting again when restarting a service.
+ Seems simple is still the best way.
+
+ Fixed some other problems created with feature additions and cleanups.
+
+ 11 Feb 2002: Martin Schlemmer (azarah@gentoo.org):
+
+ General cleanups to /etc/init.d/depscan.sh and /etc/init.d/runscript.sh.
+
+ Added 'before *' to /etc/init.d/checkroot to make sure it gets
+ started first.
+
+ Added 'use *' to /etc/init.d/local to make sure it gets started
+ last.
+
+ 10 Feb 2002: Martin Schlemmer (azarah@gentoo.org):
+
+ Fixed /sbin/rc to stop a service on change of runlevel if it is
+ in 'use' by another service.
+
+ Added the 'provide' depend type for creating virtual services.
+ Updated /etc/init.d/depscan.sh for this.
+
+ Added the 'before' depend type. This is more for changing the
+ order services start in. Updated /etc/init.d/depscan.sh and
+ /etc/init.d/functions.sh for this.
+
+ Updated /etc/init.d/depscan.sh to work with '*' as argument for
+ dependency types. This can be used with 'use' and 'before' to
+ start a script last or first respectively.
+
+ Added save_options() and get_options() to /etc/init.d/functions.sh
+ for saving misc settings between startup/shutdown. Updated
+ /etc/init.d/net.eth0 to use these and properly down virtual
+ interfaces.
+
+ 6 Feb 2002: Martin Schlemmer (azarah@gentoo.org):
+
+ Updated both /etc/init.d/bootmisc and /etc/init.d/keymaps to be quiet
+ on no errors.
+
+* rc-scripts 1.2.6 (6 Feb 2002)
+
+ 2 Feb 2002: Martin Schlemmer (azarah@gentoo.org):
+
+ Updated /etc/net.eth0 to specify the gateway device via the $gateway
+ variable (something like gateway="eth0/192.168.0.1").
+
+ 2 Feb 2002: Martin Schlemmer (azarah@gentoo.org):
+
+ Added rc-script /etc/init.d/numlock, for enabling numlock at boot.
+
+ 29 Jan 2002: Martin Schlemmer (azarah@gentoo.org):
+
+ Hopefully the last fix to /etc/init.d/netmount to umount cleanly. This fix
+ implements a retry if not successful the first time, and will kill
+ processess using the mount. Also small type-o fix to /etc/init.d/halt.sh.
+
+ 27 Jan 2002: Donny Davies (woodchip@gentoo.org): security fix to
+ /etc/pam.d/sshd,login,chsh: added pam_shells.so to the stack.
+ Fixed /etc/passwd,group for user/group mysql.
+
+ 27 Jan 2002: Martin Schlemmer (azarah@gentoo.org): added charset
+ map file support to /etc/init.d/consolefont and the setting to
+ /etc/rc.conf.
+
+ 25 Jan 2002: Martin Schlemmer (azarah@gentoo.org): fixed dircolors
+ in skel files to support both versions of dircolors.
+
+ 23 Jan 2002: Martin Schlemmer (azarah@gentoo.org): fixed bug
+ in the restart stuff of /etc/init.d/runscript.sh that caused
+ a restart of a 'net' service not to restart services again
+ that depended on it.
+
+* rc-scripts 1.2.5 (20 Jan 2002)
+
+ 20 Jan 2002: Martin Schlemmer (azarah@gentoo.org): updated
+ /etc/init.d/net.eth0 to 'use' pcmcia.
+
+ 8 Jan 2002: Martin Schlemmer (azarah@gentoo.org): added '--sh' to
+ the dircolors command in /etc/skel/.bash_profile to handle cases
+ where bash do not export $SHELL.
+
+ 6 Jan 2002: Martin Schlemmer (azarah@gentoo.org): updated
+ /etc/init.d/runscripts.sh, /etc/init.d/net.eth0, /etc/conf.d/net and
+ removed /etc/init.d/net.eth0-dhcp to reflect a new 'bsd-ish' config
+ scheme for the net.eth* scripts.
+
+ 6 Jan 2002: Donny Davies (woodchip@gentoo.org): Removed email address
+ from manpages; no need for that..
+
+ 5 Jan 2002: Martin Schlemmer (azarah@gentoo.org): fix type-o in
+ /etc/devfsd.conf; had 'dvd' in the cdrw stuff.
+
+* rc-scripts 1.2.4 (30 Dec 2001)
+
+ 30 Dec 2001: Daniel Robbins (drobbins@gentoo.org): Changed default umask
+ back to 022 as it should be.
+
+ 30 Dec 2001; Martin Schlemmer (azarah@gentoo.org): Updated
+ /etc/init.d/checkfs to return 0 if the fs was successfully repaired.
+
+ 29 Dec 2001; Donny Davies (woodchip@gentoo.org):
+ sort -t: -k3,3 -n /etc/passwd,group. Ahhhh :))
+
+ 28 Dec 2001; Martin Schlemmer (azarah@gentoo.org);
+
+ Updated /etc/init.d/depscan.sh to store info about missing dependencies
+ of type 'need' in ${svcdir}/broken. Also updated /etc/init.d/runscript.sh
+ to use this when starting a script ('need' dependencies is critical for
+ startup). Added the broken() function to /etc/init.d/runscript.sh
+ to list the missing dependencies.
+
+ Updated /etc/init.d/runscript.sh for svc_start() to have better error
+ checking.
+
+ Updated /etc/init.d/functions.sh with ewend(), which is the same as
+ eend(), but print a warning on error, not a error. Updated
+ /etc/init.d/checkroot and /etc/init.d/checkfs to use this function.
+
+ 27 Dec 2001; Martin Schlemmer (azarah@gentoo.org);
+
+ Update /sbin/runscript.c to run /etc/init.d/rc-help.sh if no arguments
+ is passed to a rc-script.
+
+ Added /etc/init.d/rc-help.sh, simple script that prints out help for
+ the rc-scripts.
+
+ 25 Dec 2001; Martin Schlemmer (azarah@gentoo.org);
+
+ Update /etc/init.d/shutdown.sh and /etc/init.d/reboot.sh not to force the
+ halt and reboot. This fixes a problem where / was not unmounted properly
+ in some cases.
+
+ 24 Dec 2001; Martin Schlemmer (azarah@gentoo.org):
+
+ Move $svcdir to to /etc/init.d/functions.sh, and update
+ /etc/init.d/runscript.sh and /etc/init.d/depscan.sh for this
+
+ Modified /etc/init.d/runscript.sh to also restart the services that
+ depend on a service if that service is restarted. Enhanced the
+ restart function to be able to have custom restart() functions in
+ rc-scripts. The custom restart() have to use svc_stop() and
+ svc_start() to restart the service.
+
+ Add a pause function to /etc/init.d/runscript.sh. It will basically
+ stop a service without stopping the services that depends on that
+ service.
+
+ Add a pause function to /etc/init.d/runscript.sh. It will basically stop a
+ service without stopping the services that depends on that service.
+
+* rc-scripts 1.2.3 (18 Dec 2001)
+
+ 16 Dec 2001; Martin Schlemmer (azarah@gentoo.org):
+
+ Moved the stuff from /sbin/init (old) to /sbin/rc (basically drop the
+ init wrapper we used).
+
+ Some cleanups: take out the shm resize comment;
+
+ remove the $wrongmount;
+
+ remove the mountshm() function and insert it directly
+ where needed;
+
+ remove the setting of $PATH as /sbin/init already do
+ this for us.
+
+ Added the if statement to detect if it is the first time the 'boot'
+ runlevel is executed (if [ "$RUNLEVEL" = "S" ] && [ "$argv1" = "boot" ]).
+ $RUNLEVEL is a env var set by /sbin/init.
+
+ Also added functionality to detect if the kernel have DEVFS support
+ compiled in; seems new users thinks devfs is unstable and as they do
+ not always read the docs, it does not get compiled in ;/ Should
+ make live for us a bit easier.
+
+ 14 Dec 2001; Martin Schlemmer (azarah@gentoo.org):
+
+ Fixed /sbin/rc to kill a cosmetic bug in the part that stops all
+ the unneeded services.
+
+* rc-scripts 1.2.2 (8 Dec 2001)
+
+ 10 Dec 2001; Added a localhost entry in /etc/hosts.
+
+ 8 Dec 2001; Donny Davies (woodchip@gentoo.org): Added start-stop-daemon.c
+ to rc-scripts/sbin source. Moved rc-scripts/init.d/runscript.c to
+ rc-scripts/sbin/runscript.c. Added manpage for start-stop-daemon.
+ Start-stop-daemon is moved here from sysvinit by the way. There is stuff
+ in this ChangeLog that needs to be removed! Like the changes to hosts,
+ profile. /etc/{passwd,group} have minor UID and GID type fixes for
+ users ftp, postgres, xfs. Tweaked tarball.sh to not include CVS
+ directories.
+
+ 29 Nov 2001; Donny Davies (woodchip@gentoo.org): Added a man directory
+ to rc-scripts. Checked in two manpages there, one for modules.autoload.5
+ and one for update-modules.8. These were adapted from Debian. Updated
+ tarball.sh to include the new man directory. Updated baselayout to install
+ these manpages. Slightly tweak the /etc/modules.autoload comments.
+
+ 28 Nov 2001; Martin Schlemmer (azarah@gentoo.org):
+
+ Updated /sbin/init to work correctly with the 'gentoo=nodevfs' option,
+ and cleaned out old code.
+
+ Updated /etc/init.d/bootmisc with additional lock files to clean.
+
+ 27 Nov 2001; Martin Schlemmer (azarah@gentoo.org):
+
+ Updated /etc/init.d/depscan.sh for a virtual 'use' depend, called 'logger'
+ that can be used for services that needs to have a logger started before
+ they are started. Updated /etc/conf.d/basic with $SYSLOGGER that is used
+ to define what loggers the 'logger' depend represent.
+
+ 26 Nov 2001; Martin Schlemmer (azarah@gentoo.org):
+
+ Updated /etc/passwd and /etc/group with minor fixes to pass pwck
+ and grpck.
+
+ 25 Nov 2001; Martin Schlemmer (azarah@gentoo.org):
+
+ Changed umask in /etc/profile for the user to 077 for security.
+
+ Added a stop() function to /etc/init.d/clock. Also removed uneeded
+ 'source /etc/rc.conf' line.
+
+ Updated /etc/init.d/hostname to set the hostname to 'localhost' if
+ /etc/hostname is invalid.
+
+ Updated /sbin/init to move the entries in /lib/dev-state to /dev before
+ running devfsd, as it did still not save settings properly. Also removed
+ old /dev-state/compat stuff.
+
+ 25 Nov 2001; ncsd, the name service cache daemon script, has been removed
+ from the default "default" runlevel. It still exists in the archive so that
+ users who want/need it can add it easily.
+
+ 25 Nov 2001; Updated the /etc/fstab; removed usbdevfs (explicitly mounted),
+ removed notail from the ext2 boot partition, other cleanups.
+
+ 25 Nov 2001; Fixed init.d/clock script to work in UTC mode.
+
+ 24 Nov 2001; Martin Schlemmer (azarah@gentoo.org):
+
+ Added /etc/devfsd.conf and updated /sbin/init to use a new scheme for saving
+ /dev permissions. Also moved /dev-state to /lib/dev-state which is a more
+ standard location.
+
+ Fixed a ugly bug in /etc/init.d/depscan.sh. If a service depended on
+ itself, calling depscan.sh or changing runlevels cause a tempory effect
+ similar to a 'mini fork bomb'. Afterwards the depends was broken, and
+ changing runlevels did not want to work.
+
+ Updated /etc/init.d/halt.sh to terminate and display message for devfsd.
+ More cosmetic than anything else, but cant hurt with the new dev-state
+ scheme.
+
+ Updated /sbin/init to set the console log level to 1, so that bootup
+ can be much cleaner. Also updated /etc/init.d/modules not to have
+ a logger in it 'use' depends, as it should not be needed anymore.
+
+ Updated /sbin/rc to check if devfsd is still running between runlevel
+ changes.
+
+ Updated /etc/init.d/modules to run update-modules. We want to be sure
+ /etc/modules.conf is updated when running depmod -a.
+
+ Change ftp's uid to 21 in /etc/passwd (was the same as bind). Also
+ added a entry for xfs (X Font Server) in /etc/passwd and /etc/group.
+
+ Added /etc/init.d/net.ppp0, /etc/conf.d/net.ppp0 and
+ /usr/lib/ppp/chat-default as part of my new pppd scripts. Also
+ updated tarball.sh to handle ppp/chat-default.
+
+ Added /etc/skel/.bash* to make things cleaner.
+
+ Other minor changes.
+
+ 17 Nov 2001; Donny Davies (woodchip@gentoo.org): Added /etc/shells file
+ to rc-scripts. Can remove it from sys-libs/shadow at the next release.
+
+* rc-scripts 1.1.8 (15 Nov 2001)
+
+ 16 Nov 2001; removed bogus "mountall.test" script.
+
+ 15 Nov 2001; Martin Schlemmer (azarah@gentoo.org):
+
+ Updated init.d/{runscript.sh,depscan.sh}, sbin/rc to the new dep being
+ 'use' not 'uses', as it fits better with 'need' (not 'needs'). Also
+ removed unneeded for loop from init.d/depscan.sh, and other fixes. Updated
+ names of new functions in init.d/runscript.sh to better sounding ones.
+ Updated init.d/modules, init.d/netmount to use 'use'. Lots of other
+ fixes/cleanups.
+
+ Removed try() out of init.d/runscript.sh (why was this here ?).
+
+ 14 Nov 2001; Martin Schlemmer (azarah@gentoo.org):
+
+ Now init.d/bootmisc cleans /tmp. Also creates /etc/resolv.conf if it
+ doesn't exist.
+
+ init.d/hostname: Added check for a valid /etc/hostname.
+
+ init.d/keymaps: Added check for valid $KEYMAP.
+
+ init.d/modules: Added sysklogd, metalog, syslog-ng as 'use' deps. This
+ should solve Woodchip's syslog+glue issue. We just have to change the
+ console loglevel for metalog and syslog-ng (sysklogd already updated) not to
+ output info and warnings, etc to the console, then boot will be much cleaner.
+ Also the install guide will need changing to add the loggers to 'boot' and
+ not 'default' runlevel.
+
+ init.d/mountall.test: Hopefully updated to the new rc-scripts style. Is
+ this really needed (I cannot see that it is used anywhere ...)?
+
+ 13 Nov 2001; Martin Schlemmer (azarah@gentoo.org):
+
+ Updated init.d/runscript.sh, init.d/depscan.sh and sbin/rc with a new depend
+ called 'uses'. It basically have the same usage as 'need', except that it
+ do not start services that is not in the current and 'boot' runlevels.
+
+ Updated init.d/netmount to use the 'uses' depend.
+
+ 11 Nov 2001; Martin Schlemmer (azarah@gentoo.org):
+
+ Fixed init.d/runscript.sh not to destroy the 'need' depends in
+ /${svcdir}/need. This caused subsequent starting and stopping of services
+ not to start depends.
+
+ 7 Nov 2001; Martin Schlemmer (azarah@gentoo.org):
+
+ Fixed a problem in sbin/rc where the ${svcdir}/softscripts directory got
+ destroyed before stopping running services scheduled to be stopped. This
+ with the fact that $SOFTLEVEL was set too early, caused the services to be
+ stopped in the wrong order.
+
+ 30 Oct 2001; Martin Schlemmer (azarah@gentoo.org):
+
+ Modified init.d/netmount to check if any network filesystems is mounted.
+
+ 29 Oct 2001; init.d/netmount: umount -art doesn't seem to work, so I added
+ some awk and grep magic to find all remote filesystems and umount them.
+
+ 29 Oct 2001; Martin Schlemmer (azarah@gentoo.org):
+
+ A fix for checkroot (missing "/"); it now actually checks the root
+ filesystem. Also, a localmount cleanliness fix.
+
+* rc-scripts 1.1.7 (18 Oct 2001)
+
+[old changelog format follows]
+
+ *lots of scripts; woodchip
+ removed old rc5 scripts from cvs
+
+ *init.d/runscript.sh; agriffis
+ Added support for rc.conf and home-grown functions
+
+ *init.d/modules;
+ Now correctly looks at /etc/modules.autoload
+
+rc-scripts-1.1.6, released 15 Sep 2001
+======================================
+
+ *init.d/runscript.sh, others
+ Handling of "net" dependencies resolve to all net devices in
+ /etc/runlevels/boot and /etc/runlevels/[curr-runlevel]. INTERFACES
+ variable in /etc/rc.conf has been removed.
+
+ *init.d/runscript.sh
+ New "zap" option for manually resetting the state of an initscript
+ to stopped.
+
+ *init.d/{samba,sysklogd,sshd}
+ Removed from CVS; they live in their respective packages.
+
+rc-scripts-1.1.5, released 02 Sep 2001
+====================================
+
+ *sbin/rc-update
+ New version of the rc-update command for the new initscripts. Works
+ similarly to the old version, except this one updates our dependency
+ cache.
+
+ *init.d/functions.sh
+ New and better looking informational message functions (einfo, einfon).
+ Brand new message functions (ewarn).
+
+ *sbin/init, init.d/checkroot
+ We're going back to a /proc/mounts-based mtab symlink because it's
+ just plain better. Appropriate changes made.
+
+# vim:expandtab
diff --git a/bin/rc-status b/bin/rc-status
new file mode 100755
index 0000000..1476175
--- /dev/null
+++ b/bin/rc-status
@@ -0,0 +1,217 @@
+#!/bin/bash
+################################################################################
+# #
+# Author: Sean E. Russell <ser@germane-software.com> #
+# Version: 1.0 #
+# Date: Jun 26, 2002 #
+# Adaptation: Mike Frysinger [SpanKY] <vapier@gentoo.org> #
+# Original code was in Ruby ... recoded into bash (at syntax level) #
+# #
+# This application displays information about the RC system used by Gentoo. #
+# In particular, it displays a tree-like format of a run level, showing #
+# all of the services that are installed at that level, and what each #
+# service's status is (running, stopped, etc.) #
+# #
+# -a can be used to display all runlevels #
+# -d can be used to display service dependancies #
+# -u will display all unassigned services #
+# -s will display all services #
+# -h will display help #
+# <runlevel> is used to choose the run level for which information is #
+# displayed #
+# #
+# By default, rc-status only displays information about the current #
+# runlevel; services installed and services running. #
+# #
+################################################################################
+
+# grab code from functions.sh so we don't have to reproduce it
+source /sbin/functions.sh
+runleveldir=/etc/runlevels
+
+# grab settings from conf.d/rc
+source /etc/conf.d/rc
+source "${svclib}/sh/rc-daemon.sh"
+
+################################################################################
+# Parse command line options #
+################################################################################
+do_opt() {
+ case $1 in
+ --all|-a)
+ ALL=true
+ ;;
+ --depend)
+ DEPEND=true
+ ;;
+ --unused|-u)
+ ALL=true
+ UNUSED=true
+ ;;
+ --list|-l)
+ ls -1 ${runleveldir}
+ exit 0
+ ;;
+ --servicelist|-s)
+ ALL=true
+ SERVICELIST=true
+ ;;
+ --nocolor|-nc)
+ ;;
+ --help|-h|-*)
+ echo "USAGE: $0 [command | <runlevel>]"
+ echo
+ echo "Commands:"
+ echo " -a, --all Show services at all run levels"
+ echo " -l, --list Show list of run levels"
+ echo " -u, --unused Show services not assigned to any run level"
+ echo " -s, --servicelist Show service list"
+ echo " -nc,--nocolor Monochrome output only"
+ echo " <runlevel> Show services assigned to <runlevel>"
+ echo
+ echo "If no arguments are supplied, shows services for current run level."
+ exit 0
+ ;;
+ *)
+ runlevel=$1
+ ;;
+ esac
+}
+for opt in "$@" ; do
+ do_opt ${opt}
+ [[ -n $2 ]] && shift
+done
+
+################################################################################
+# Find the current runlevel being queried. This is either something supplied #
+# on the command line, or pulled from softlevel #
+################################################################################
+if [[ -z ${runlevel} ]] ; then
+ if [[ -e ${svcdir}/softlevel ]] ; then
+ runlevel=$(<${svcdir}/softlevel)
+ else
+ ewarn "Could not local current runlevel in ${svcdir}/softlevel"
+ if [[ -d ${runleveldir}/single ]] ; then
+ runlevel=single
+ elif [[ -d ${runleveldir}/default ]] ; then
+ runlevel=default
+ else
+ eerror "Your installation is probably broken ... please \`emerge baselayout\`"
+ exit 1
+ fi
+ ewarn "Assuming current runrevel is '${runlevel}'"
+ fi
+fi
+if [[ ! -d ${runleveldir}/${runlevel} ]] ; then
+ eerror "${runlevel} is not a valid run level !"
+ eerror "Valid runlevels (obtained from \`rc-status --list\`):"
+ rc-status --list
+ exit 1
+fi
+
+################################################################################
+# Build up a hash of the services associated with each run level. In the most #
+# trivial case, this is simply the current runlevel. If --all was specified, #
+# we gather information about all of the runlevels. If --unused was #
+# specified, we pull info about all of the services and filter for the ones #
+# that don't appear in any runlevel. #
+################################################################################
+runlevelidxs=$(ls ${runleveldir})
+declare -a runlevels
+# For each directory in /etc/runlevels, do ...
+arridx=0
+for level in ${runlevelidxs} ; do
+ if [[ ${level} == ${runlevel} || -n ${ALL} ]] ; then
+ runlevels[${arridx}]=$(find ${runleveldir}/${level} -maxdepth 1 -type l -printf '%f ')
+ let "arridx += 1"
+ fi
+done
+
+# In case --all was specified, get a list of all the services set up in
+# /etc/init.d; services can be added, but not enabled, and we need to
+# identify these 'orphan' services.
+in_list() { #$1=list $2=find
+ for ele in $1 ; do
+ if [[ ${ele} == $2 ]] ; then
+ echo 1
+ return 0
+ fi
+ done
+ echo 0
+ return 0
+}
+if [[ -n ${ALL} ]] ; then
+ unassigned=
+ allservices=
+ for service in $(ls -1 /etc/init.d | grep -v '\.sh$') ; do
+ if [[ $(in_list "${runlevels[*]}" "${service}") -eq 0 ]] ; then
+ unassigned="${unassigned} ${service}"
+ fi
+ allservices="${allservices} ${service}"
+ done
+ runlevelidxs="${runlevelidxs} UNASSIGNED"
+ runlevels[${arridx}]="${unassigned}"
+ runlevels[${arridx}+1]="${allservices}"
+fi
+
+################################################################################
+# Now collect information about the status of the various services; whether #
+# they're started, broken, or failed. Put all of this into arrays. #
+################################################################################
+if [[ -x ${svcdir}/started ]]; then
+ started=$(ls ${svcdir}/started)
+ # If we're root then update service statuses incase any naughty daemons
+ # stopped running without our say so
+ if [[ ${EUID} == 0 ]]; then
+ for service in ${started}; do
+ update_service_status "${service}"
+ done
+ started=$(ls ${svcdir}/started)
+ fi
+fi
+[[ -x ${svcdir}/starting ]] && starting=$(ls ${svcdir}/starting)
+[[ -x ${svcdir}/inactive ]] && inactive=$(ls ${svcdir}/inactive)
+[[ -x ${svcdir}/stopping ]] && stopping=$(ls ${svcdir}/stopping)
+
+################################################################################
+# Now print out the information we've gathered. We do this by going through #
+# the hash of 'runlevels' information, and for each String key/Array value #
+# pair, print the runlevel; then for each service in that runlevel, print the #
+# service name and its status. #
+################################################################################
+# Define a helper method for printing the status of a service; '[ xxx ]'
+print_msg() {
+ printf " %-$((COLS - 5 - ${#3}))s%s\n" "$1" "${BRACKET}[ $2$3 ${BRACKET}]${NORMAL}"
+}
+
+# if --all wasnt specified, dont print everything
+[[ -z ${ALL} ]] && runlevelidxs=${runlevel}
+if [[ -z ${UNUSED} ]] ; then
+ if [[ -z ${SERVICELIST} ]] ; then
+ arridx=0
+ else
+ runlevelidxs="all"
+ let "arridx += 1"
+ fi
+else
+ runlevelidxs="unused"
+fi
+
+for level in ${runlevelidxs} ; do
+ echo "Runlevel: ${HILITE}${level}${NORMAL}"
+ for service in ${runlevels[${arridx}]} ; do
+ if [[ -n ${inactive} && $(in_list "${inactive}" "${service}") -eq 1 ]] ; then
+ print_msg "${service}" "${WARN}" 'inactive'
+ elif [[ $(in_list "${started}" "${service}") -eq 1 ]] ; then
+ print_msg "${service}" "${GOOD}" 'started'
+ elif [[ -n ${starting} && $(in_list "${starting}" "${service}") -eq 1 ]] ; then
+ print_msg "${service}" "${GOOD}" 'starting'
+ elif [[ -n ${stopping} && $(in_list "${stopping}" "${service}") -eq 1 ]] ; then
+ print_msg "${service}" "${BAD}" 'stopping'
+ else
+ print_msg "${service}" "${BAD}" 'stopped'
+ fi
+ done
+ let "arridx += 1"
+ [ -n "${UNUSED}" ] && exit 0
+done
diff --git a/etc/conf.d/bootmisc b/etc/conf.d/bootmisc
new file mode 100644
index 0000000..e3292f9
--- /dev/null
+++ b/etc/conf.d/bootmisc
@@ -0,0 +1,12 @@
+# /etc/conf.d/bootmisc
+
+# Put a nologin file in /etc to prevent people from logging in before
+# system startup is complete
+
+DELAYLOGIN="no"
+
+
+# Should we completely wipe out /tmp or just selectively remove known
+# locks / files / etc... ?
+
+WIPE_TMP="no"
diff --git a/etc/conf.d/clock b/etc/conf.d/clock
new file mode 100644
index 0000000..0d2cc1e
--- /dev/null
+++ b/etc/conf.d/clock
@@ -0,0 +1,26 @@
+# /etc/conf.d/clock
+
+# Set CLOCK to "UTC" if your system clock is set to UTC (also known as
+# Greenwich Mean Time). If your clock is set to the local time, then
+# set CLOCK to "local".
+
+CLOCK="UTC"
+
+# If you wish to pass any other arguments to hwclock during bootup,
+# you may do so here.
+
+CLOCK_OPTS=""
+
+# If you want to set the Hardware Clock to the current System Time
+# during shutdown, then say "yes" here.
+
+CLOCK_SYSTOHC="no"
+
+
+### ALPHA SPECIFIC OPTIONS ###
+
+# If your alpha uses the SRM console, set this to "yes".
+SRM="no"
+
+# If your alpha uses the ARC console, set this to "yes".
+ARC="no"
diff --git a/etc/conf.d/consolefont b/etc/conf.d/consolefont
new file mode 100644
index 0000000..7f430b1
--- /dev/null
+++ b/etc/conf.d/consolefont
@@ -0,0 +1,16 @@
+# /etc/conf.d/consolefont
+
+# CONSOLEFONT specifies the default font that you'd like Linux to use on the
+# console. You can find a good selection of fonts in /usr/share/consolefonts;
+# you shouldn't specify the trailing ".psf.gz", just the font name below.
+# To use the default console font, comment out the CONSOLEFONT setting below.
+# This setting is used by the /etc/init.d/consolefont script (NOTE: if you do
+# not want to use it, run "rc-update del consolefont" as root).
+
+CONSOLEFONT="default8x16"
+
+# CONSOLETRANSLATION is the charset map file to use. Leave commented to use
+# the default one. Have a look in /usr/share/consoletrans for a selection of
+# map files you can use.
+
+#CONSOLETRANSLATION="8859-1_to_uni"
diff --git a/etc/conf.d/domainname b/etc/conf.d/domainname
new file mode 100644
index 0000000..75631ac
--- /dev/null
+++ b/etc/conf.d/domainname
@@ -0,0 +1,17 @@
+# /etc/conf.d/domainname
+
+# When setting up resolv.conf, what should take precedence?
+# If you wish to always override DHCP/whatever, set this to 1.
+OVERRIDE=1
+
+# To have a proper FQDN, you need to setup /etc/hosts and /etc/resolv.conf
+# properly (domain entry in /etc/resolv.conf, and FQDN in /etc/hosts).
+#
+#DNSDOMAIN=""
+
+# This only set what /bin/hostname returns. If you need to setup NIS, meaning
+# what /bin/domainname returns, please see:
+#
+# http://www.linux-nis.org/nis-howto/HOWTO/
+#
+#NISDOMAIN=""
diff --git a/etc/conf.d/env_whitelist b/etc/conf.d/env_whitelist
new file mode 100644
index 0000000..03fc270
--- /dev/null
+++ b/etc/conf.d/env_whitelist
@@ -0,0 +1,10 @@
+# /etc/conf.d/env_whitelist: Environment whitelist for rc-system
+
+# Specify which variables is allowed to be passed from the environment to the
+# rc-system. If it is not set by the environment, then the variable will be
+# taken from /etc/profile.env - meaning, if you need to set LANG or such,
+# do it in a /etc/env.d/00myownstuff file for example, and run env-update.
+
+# User controlled
+LANG
+
diff --git a/etc/conf.d/hostname b/etc/conf.d/hostname
new file mode 100644
index 0000000..619abcd
--- /dev/null
+++ b/etc/conf.d/hostname
@@ -0,0 +1,4 @@
+# /etc/conf.d/hostname
+
+# Set to the hostname of this machine
+HOSTNAME="localhost"
diff --git a/etc/conf.d/keymaps b/etc/conf.d/keymaps
new file mode 100644
index 0000000..eb68fbe
--- /dev/null
+++ b/etc/conf.d/keymaps
@@ -0,0 +1,26 @@
+# /etc/conf.d/keymaps
+
+# Use KEYMAP to specify the default console keymap. There is a complete tree
+# of keymaps in /usr/share/keymaps to choose from.
+
+KEYMAP="us"
+
+
+# Should we first load the 'windowkeys' console keymap? Most x86 users will
+# say "yes" here. Note that non-x86 users should leave it as "no".
+
+SET_WINDOWKEYS="no"
+
+
+# The maps to load for extended keyboards. Most users will leave this as is.
+
+EXTENDED_KEYMAPS=""
+#EXTENDED_KEYMAPS="backspace keypad euro"
+
+
+# Tell dumpkeys(1) to interpret character action codes to be
+# from the specified character set.
+# This only matters if you set UNICODE="yes" in /etc/rc.conf.
+# For a list of valid sets, run `dumpkeys --help`
+
+DUMPKEYS_CHARSET=""
diff --git a/etc/conf.d/local.start b/etc/conf.d/local.start
new file mode 100644
index 0000000..a55d2cc
--- /dev/null
+++ b/etc/conf.d/local.start
@@ -0,0 +1,5 @@
+# /etc/conf.d/local.start
+
+# This is a good place to load any misc programs
+# on startup ( use 1>&2 to hide output)
+
diff --git a/etc/conf.d/local.stop b/etc/conf.d/local.stop
new file mode 100644
index 0000000..7dc89f6
--- /dev/null
+++ b/etc/conf.d/local.stop
@@ -0,0 +1,8 @@
+# /etc/conf.d/local.stop
+
+# This is a good place to unload any misc.
+# programs you started above.
+# For example, if you are using OSS and have
+# "/usr/local/bin/soundon" above, put
+# "/usr/local/bin/soundoff" here.
+
diff --git a/etc/conf.d/net b/etc/conf.d/net
new file mode 100644
index 0000000..54337cf
--- /dev/null
+++ b/etc/conf.d/net
@@ -0,0 +1,4 @@
+# This blank configuration will automatically use DHCP for any net.*
+# scripts in /etc/init.d. To create a more complete configuration,
+# please review /etc/conf.d/net.example and save your configuration
+# in /etc/conf.d/net (this file :]!).
diff --git a/etc/conf.d/net.example b/etc/conf.d/net.example
new file mode 100644
index 0000000..dda45a1
--- /dev/null
+++ b/etc/conf.d/net.example
@@ -0,0 +1,570 @@
+##############################################################################
+# QUICK-START
+#
+# The quickest start is if you want to use DHCP.
+# In that case, everything should work out of the box, no configuration
+# necessary, though the startup script will warn you that you haven't
+# specified anything.
+#
+# If you want to use a static address or use DHCP explicitly, jump
+# down to the section labelled INTERFACE HANDLERS.
+#
+# If you want to do anything more fancy, you should take the time to
+# read through the rest of this file.
+
+##############################################################################
+# DEFAULTS
+#
+# hotplug_eth0="yes"
+# Do we allow hotplug to bring up interfaces or not? The default is we do,
+# otherwise put no in the above value.
+# NOTE: hotplug just has to be installed for hotplugging to work - it does
+# not matter if it's in any runlevel or not.
+
+##############################################################################
+# MODULES
+#
+# We now support modular networking scripts which means we can easily
+# add support for new interface types and modules while keeping
+# compatability with existing ones.
+#
+# Modules load by default if the package they need is installed. If
+# you specify a module here that doesn't have it's package installed
+# then you get an error stating which package you need to install.
+# Ideally, you only use the modules setting when you have two or more
+# packages installed that supply the same service.
+#
+# In other words, you probably should DO NOTHING HERE...
+
+# Prefer ifconfig over iproute2
+#modules=( "iproute2" )
+
+# You can also specify other modules for an interface
+# In this case we prefer udhcpc over dhcpcd
+#modules_eth0=( "udhcpc" )
+
+# You can also specify which modules not to use - for example you may be
+# using a supplicant or linux-wlan-ng to control wireless configuration but
+# you still want to configure network settings per ESSID associated with.
+#modules=( "!iwconfig" "!wpa_supplicant" )
+# IMPORTANT: If you need the above, please disable modules in that order
+
+
+##############################################################################
+# INTERFACE HANDLERS
+#
+# We provide two interface handlers presently: ifconfig and iproute2.
+# You need one of these to do any kind of network configuration.
+# For ifconfig support, emerge sys-apps/net-tools
+# For iproute2 support, emerge sys-apps/iproute2
+
+# If you don't specify an interface then we prefer iproute2 if it's installed
+# To prefer ifconfig over iproute2
+#modules=( "ifconfig" )
+
+# For a static configuration, use something like this
+# (They all do exactly the same thing btw)
+#config_eth0=( "192.168.0.2/24" )
+#config_eth0=( "192.168.0.2 netmask 255.255.255.0" )
+
+# We can also specify a broadcast
+#config_eth0=( "192.168.0.2/24 brd 192.168.0.255" )
+#config_eth0=( "192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.255" )
+
+# If you need more than one address, you can use something like this
+# NOTE: ifconfig creates an aliased device for each extra IPv4 address
+# (eth0:1, eth0:2, etc)
+# iproute2 does not do this as there is no need to
+#config_eth0=(
+# "192.168.0.2/24"
+# "192.168.0.3/24"
+# "192.168.0.4/24"
+#)
+# Or you can use sequence expresions
+#config_eth0=( "192.168.0.{2..4}/24" )
+# which does the same as above. Be careful though as if you use this and
+# fallbacks, you have to ensure that both end up with the same number of
+# values otherwise your fallback won't work correctly.
+
+# You can also use IPv6 addresses
+#config_eth0=(
+# "192.168.0.2/24"
+# "4321:0:1:2:3:4:567:89ab"
+# "4321:0:1:2:3:4:567:89ac"
+#)
+
+# If you wish to keep existing addresses + routing and the interface is up,
+# you can specify a noop (no operation). If the interface is down or there
+# are no addresses assigned, then we move onto the next step (default dhcp)
+# This is useful when configuring your interface with a kernel command line
+# or similar
+#config_eth0=( "noop" "192.168.0.2/24" )
+
+# If you don't want ANY address (only useful when calling for advanced stuff)
+#config_eth0=( "null" )
+
+# Here's how todo routing if you need it - the below sets the default gateway
+#routes_eth0=(
+# "default via 192.168.0.1"
+# "default via 4321:0:1:2:3:4:567:89ab"
+#)
+
+# If a specified module fails (like dhcp - see below), you can specify a
+# fallback like so
+#fallback_eth0=( "192.168.0.2 netmask 255.255.255.0" )
+#fallback_route_eth0=( "default via 192.168.0.1" )
+
+# NOTE: fallback entry must match the entry location in config_eth0
+# As such you can only have one fallback route.
+
+# Some users may need to alter the MTU - here's how
+#mtu_eth0="1500"
+
+##############################################################################
+# OPTIONAL MODULES
+
+# INTERFACE RENAMING
+# There is no consistent device renaming scheme for Linux.
+# The preferred way of naming devices is via the kernel module directly or
+# by using udev (http://www.reactivated.net/udevrules.php)
+
+# If you are unable to write udev rules, then we do provide a way of renaming
+# the interface based on it's MAC address, but it is not optimal.
+# Here is how to rename an interface whose MAC address is 00:11:22:33:44:55
+# to foo1
+#rename_001122334455="foo1"
+
+# You can also do this based on current device name - although this is not
+# recommended. Here we rename eth1 to foo2.
+#rename_eth1="foo2"
+
+#-----------------------------------------------------------------------------
+# WIRELESS (802.11 support)
+# Wireless can be provided by iwconfig or wpa_supplicant
+
+# iwconfig
+# emerge net-wireless/wireless-tools
+# Wireless options are held in /etc/conf.d/wireless - but could be here too
+# Consult the sample file /etc/conf.d/wireless.example for instructions
+# iwconfig is the default
+
+# wpa_supplicant
+# emerge net-wireless/wpa-supplicant
+# Wireless options are held in /etc/wpa_supplicant.conf
+# Consult the sample file /etc/wpa_supplicant.conf.example for instructions
+# To choose wpa_supplicant over iwconfig
+#modules=( "wpa_supplicant" )
+# To configure wpa_supplicant
+#wpa_supplicant_eth0="-Dprism54" # For Prism54 based cards
+#wpa_supplicant_ath0="-Dmadwifi" # For Atheros based cards
+# Consult wpa_supplicant for more drivers
+# By default we give wpa_suppliant 60 seconds to associate and authenticate
+# 0 means we wait indefinitely
+#associate_timeout_eth0=60
+
+# GENERIC WIRELESS OPTIONS
+# PLEASE READ THE INSTRUCTIONS IN /etc/conf.d/wireless.example FOR
+# HOW TO USE THIS ESSID VARIABLE
+# You can also override any settings found here per ESSID - which is very
+# handy if you use different networks a lot
+#config_ESSID=( "dhcp" )
+#dhcpcd_ESSID="-t 5"
+
+# Setting name/domain server causes /etc/resolv.conf to be overwritten
+# Note that if DHCP is used, and you want this to take precedence then
+# set dhcp_ESSID="nodns"
+#dns_servers_ESSID=( "192.168.0.1" "192.168.0.2" )
+#dns_domain_ESSID="some.domain"
+#dns_search_path_ESSID="search.this.domain search.that.domain"
+# Please check the man page for resolv.conf for more information
+# as domain and search are mutually exclusive.
+
+# You can also override any settings found here per MAC address of the AP
+# incase you use Access Points with the same ESSID but need different
+# networking configs. Below is an example - of course you use the same
+# method with other variables
+#mac_config_001122334455=( "dhcp" )
+#mac_dhcpcd_001122334455="-t 10"
+#mac_dns_servers_001122334455=( "192.168.0.1" "192.168.0.2" )
+
+# When an interface has been associated with an Access Point, a global
+# variable called ESSID is set to the Access Point's ESSID for use in the
+# pre/post user functions below (although it's not available in preup as you
+# won't have associated then)
+
+# If you're using anything else to configure wireless on your interface AND
+# you have installed any of the above packages, you need to disable them
+#modules=( "!iwconfig" "!wpa_supplicant" )
+
+#-----------------------------------------------------------------------------
+# DHCP
+# DHCP can be provided by dhcpcd, dhclient, udhcpc or pump
+#
+# dhclient: emerge net-misc/dhcp
+# dhcpcd: emerge net-misc/dhcpcd
+# pump: emerge net-misc/pump
+# udhcpc: emerge net-misc/udhcp
+
+# If you have more than one DHCP client installed, you need to specify which
+# one to use - otherwise we default to dhcpcd if available
+#modules=( "udhcpc" ) # to select udhcpc over dhcpcd
+#
+# Notes:
+# - dhcpcd, udhcpc and pump send the current hostname
+# to the DHCP server by default
+# pump always sends the current hostname - so below to disable
+# udhcpc and dhcpcd from doing this
+# - dhcpcd does not daemonize when the lease time is infinite
+# - udhcp-0.9.3-r3 and earlier does not support getting NTP servers
+# - dhclient does not support getting NTP servers
+# - pump does not support getting NIS servers
+# - DHCP tends to erase any existing device information - so add
+# static addresses after dhcp if you need them
+
+# Regardless of which DHCP client you prefer, you configure them the
+# same way using one of following depending on which interface modules
+# you're using.
+#config_eth0=( "dhcp" )
+
+# For passing custom options to dhcpcd use something like the following. This
+# example reduces the timeout for retrieving an address from 60 seconds (the
+# default) to 10 seconds.
+#dhcpcd_eth0="-t 10"
+
+# dhclient, udhcpc and pump don't have many runtime options
+# You can pass options to them in a similar manner to dhcpcd though
+#dhclient_eth0="..."
+#udhcpc_eth0="..."
+#pump_eth0="..."
+
+# To set options for dhclient, you need to have an /etc/dhclient.conf file
+# See the dhclient man page for details
+
+# GENERIC DHCP OPTIONS
+# Set generic DHCP options like so
+#dhcp_eth0="release nodns nontp nonis nogateway nosendhost"
+
+# This tells the dhcp client to release it's lease when it stops, not to
+# overwrite dns, ntp and nis settings, not to set a default route and not to
+# send the current hostname to the dhcp server and when it starts.
+# You can use any combination of the above options - the default is not to
+# use any of them.
+
+# DHCLIENT
+# dhclient can modify /etc/dhclient.conf (or the file specified by the -cf
+# option) with the current hostname and to strip any script lines. To enable
+# this, add dhclient_edit_config="yes" to /etc/conf.d/net
+
+#-----------------------------------------------------------------------------
+# Automatic Private IP Addressing (APIPA)
+# For APIPA support, emerge net-misc/iputils or net-analyzer/arping
+
+# APIPA is a module that tries to find a free address in the range
+# 169.254.0.0-169.254.255.255 by arping a random address in that range on the
+# interface. If no reply is found then we assign that address to the interface
+
+# This is only useful for LANs where there is no DHCP server and you don't
+# connect directly to the internet.
+#config_eth0=( "dhcp" )
+#fallback_eth0=( "apipa" )
+
+#-----------------------------------------------------------------------------
+# VLAN (802.1q support)
+# For VLAN support, emerge net-misc/vconfig
+
+# Specify the VLAN numbers for the interface like so
+# Please ensure your VLAN IDs are NOT zero-padded
+#vlans_eth0="1 2"
+
+# You can also configure the VLAN - see for vconfig man page for more details
+#vconfig_eth0=( "set_name_type VLAN_PLUS_VID_NO_PAD" )
+#vconfig_vlan1=( "set_flag 1" "set_egress_map 2 6" )
+#config_vlan1=( "172.16.3.1 netmask 255.255.254.0" )
+#config_vlan2=( "172.16.2.1 netmask 255.255.254.0" )
+
+# NOTE: Vlans can be configured with a . in their interface names
+# When configuring vlans with this name type, you need to replace . with a _
+#config_eth0.1=( "dhcp" ) - does not work
+#config_eth0_1=( "dhcp" ) - does work
+
+#-----------------------------------------------------------------------------
+# Bonding
+# For link bonding/trunking emerge net-misc/ifenslave
+
+# To bond interfaces together
+#slaves_bond0="eth0 eth1 eth2"
+#config_bond0=( "null" ) # You may not want to assign an IP the the bond
+
+# If any of the slaves require extra configuration - for example wireless or
+# ppp devices - we need to write a depend function for the bond so they get
+# configured correctly.
+# This is exactly the same as a depend() function in our init scripts
+#depend_br0() {
+# need net.eth0 net.eth1
+#}
+
+#-----------------------------------------------------------------------------
+# ADSL
+# For ADSL support, emerge net-dialup/rp-pppoe
+# You should make the following settings and also put your
+# username/password information in /etc/ppp/pap-secrets
+
+# Configure the interface to use ADSL
+#config_eth0=( "adsl" )
+
+# You probably won't need to edit /etc/ppp/pppoe.conf if you set this
+#adsl_user_eth0="my-adsl-username"
+
+#-----------------------------------------------------------------------------
+# ISDN
+# For ISDN support, emerge net-dialup/isdn4k-utils
+# You should make the following settings and also put your
+# username/password information in /etc/ppp/pap-secrets
+
+# Configure the interface to use ISDN
+#config_ippp0=( "dhcp" )
+# It's important to specify dhcp if you need it!
+#config_ippp0=( "192.168.0.1/24" )
+# Otherwise, you can use a static IP
+
+# NOTE: The interface name must be either ippp or isdn followed by a number
+
+# You may need this option to set the default route
+#ipppd_eth0="defaultroute"
+
+#-----------------------------------------------------------------------------
+# MAC changer
+# To set a specific MAC address
+#mac_eth0="00:11:22:33:44:55"
+
+# For changing MAC addresses using the below, emerge net-analyzer/macchanger
+# - to randomize the last 3 bytes only
+#mac_eth0="random-ending"
+# - to randomize between the same physical type of connection (eg fibre,
+# copper, wireless) , all vendors
+#mac_eth0="random-samekind"
+# - to randomize between any physical type of connection (eg fibre, copper,
+# wireless) , all vendors
+#mac_eth0="random-anykind"
+# - full randomization - WARNING: some MAC addresses generated by this may NOT
+# act as expected
+#mac_eth0="random-full"
+# custom - passes all parameters directly to net-analyzer/macchanger
+#mac_eth0="some custom set of parameters"
+
+# You can also set other options based on the MAC address of your network card
+# Handy if you use different docking stations with laptops
+#config_001122334455=( "dhcp" )
+
+#-----------------------------------------------------------------------------
+# TUN/TAP
+# For TUN/TAP support emerge sys-apps/usermode-utilities
+#
+# NOTE: The interface name must be either tun or tap followed by a number
+#config_tun1=( "192.168.0.1/24")
+
+# For passing custom options to tunctl use something like the following. This
+# example sets the owner to adm
+#tunctl_tun1="-u adm"
+
+#-----------------------------------------------------------------------------
+# Bridging (802.1d)
+# For bridging support emerge net-misc/bridge-utils
+
+# To add ports to bridge br0
+#bridge_br0="eth0 eth1"
+# or dynamically add them when the interface comes up
+#bridge_add_eth0="br0"
+#bridge_add_eth1="br0"
+
+# You need to configure the ports to null values so dhcp does not get started
+#config_eth0=( "null" )
+#config_eth1=( "null" )
+
+# Finally give the bridge an address - dhcp or a static IP
+#config_br0=( "dhcp" ) # may not work when adding ports dynamically
+#config_br0=( "192.168.0.1/24" )
+
+# If any of the ports require extra configuration - for example wireless or
+# ppp devices - we need to write a depend function for the bridge so they get
+# configured correctly.
+# This is exactly the same as a depend() function in our init scripts
+#depend_br0() {
+# need net.eth0 net.eth1
+#}
+
+# NOTE: This creates an interface called br0 - you can give the interface
+# any name you like
+
+# Below is an example of configuring the bridge
+# Consult "man brctl" for more details
+#brctl_br0=( "setfd 0" "sethello 0" "stp off" )
+
+#-----------------------------------------------------------------------------
+# Tunnelling
+# For GRE tunnels
+#iptunnel_vpn0="mode gre remote 207.170.82.1 key 0xffffffff ttl 255"
+
+# For IPIP tunnels
+#iptunnel_vpn0="mode ipip remote 207.170.82.2 ttl 255"
+
+# To configure the interface
+#config_vpn0=( "192.168.0.2 pointopoint 192.168.1.2" ) # ifconfig style
+#config_vpn0=( "192.168.0.2 peer 192.168.1.1" ) # iproute2 style
+
+#-----------------------------------------------------------------------------
+# System
+# For configuring system specifics such as domain, dns, ntp and nis servers
+# It's rare that you would need todo this, but you can anyway.
+# This is most benefit to wireless users who don't use DHCP so they can change
+# their configs based on ESSID. See wireless.example for more details
+
+# To use dns settings such as these, dns_servers_eth0 must be set!
+# dns_domain_eth0="your.domain"
+# dns_servers_eth0="192.168.0.2 192.168.0.3"
+# dns_search_path_eth0="this.domain that.domain"
+
+# ntp_servers_eth0="192.168.0.2 192.168.0.3"
+
+# nis_domain_eth0="domain"
+# nis_servers_eth0="192.168.0.2 192.168.0.3"
+
+#-----------------------------------------------------------------------------
+# Cable in/out detection
+# Sometimes the cable is in, others it's out. Obviously you don't want to
+# restart net.eth0 every time when you plug it in either.
+#
+# netplug is a package that detects this and requires no extra configuration
+# on your part.
+# emerge sys-apps/netplug
+# and you're done :)
+
+# By default we wait 10 seconds for netplug to configure the interface for us
+# if it doesn't, we abort but leave netplug running and the net.eth0 service
+# marked as inactive so when a cable is plugged in it starts fine.
+# plug_timeout="10"
+
+# If you don't want to use netplug on a specific interface but you have it
+# installed, you can disable it for that interface via the modules statement
+# modules_eth0=( "!netplug" )
+
+##############################################################################
+# ADVANCED CONFIGURATION
+#
+# Four functions can be defined which will be called surrounding the
+# start/stop operations. The functions are called with the interface
+# name first so that one function can control multiple adapters. An extra two
+# functions can be defined when an interface fails to start or stop.
+#
+# The return values for the preup and predown functions should be 0
+# (success) to indicate that configuration or deconfiguration of the
+# interface can continue. If preup returns a non-zero value, then
+# interface configuration will be aborted. If predown returns a
+# non-zero value, then the interface will not be allowed to continue
+# deconfiguration.
+#
+# The return values for the postup, postdown, failup and faildown functions are
+# ignored since there's nothing to do if they indicate failure.
+#
+# ${IFACE} is set to the interface being brought up/down
+# ${IFVAR} is ${IFACE} converted to variable name bash allows
+
+#preup() {
+# # Test for link on the interface prior to bringing it up. This
+# # only works on some network adapters and requires the mii-diag
+# # package to be installed.
+# if mii-tool ${IFACE} 2> /dev/null | grep -q 'no link'; then
+# ewarn "No link on ${IFACE}, aborting configuration"
+# return 1
+# fi
+#
+# # Test for link on the interface prior to bringing it up. This
+# # only works on some network adapters and requires the ethtool
+# # package to be installed.
+# if ethtool ${IFACE} | grep -q 'Link detected: no'; then
+# ewarn "No link on ${IFACE}, aborting configuration"
+# return 1
+# fi
+#
+# # Remember to return 0 on success
+# return 0
+#}
+
+#predown() {
+# # The default in the script is to test for NFS root and disallow
+# # downing interfaces in that case. Note that if you specify a
+# # predown() function you will override that logic. Here it is, in
+# # case you still want it...
+# if is_net_fs /; then
+# eerror "root filesystem is network mounted -- can't stop ${IFACE}"
+# return 1
+# fi
+#
+# # Remember to return 0 on success
+# return 0
+#}
+
+#postup() {
+# # This function could be used, for example, to register with a
+# # dynamic DNS service. Another possibility would be to
+# # send/receive mail once the interface is brought up.
+# return 0
+#}
+
+#postdown() {
+# # This function is mostly here for completeness... I haven't
+# # thought of anything nifty to do with it yet ;-)
+# # Return 0 always
+# return 0
+#}
+
+#failup() {
+# # This function is mostly here for completeness... I haven't
+# # thought of anything nifty to do with it yet ;-)
+#}
+
+#faildown() {
+# # This function is mostly here for completeness... I haven't
+# # thought of anything nifty to do with it yet ;-)
+#}
+
+##############################################################################
+# FORCING MODULES
+# The Big Fat Warning :- If you use module forcing do not complain to us or
+# file bugs about it not working!
+#
+# Loading modules is a slow afair - we have to check each one for the following
+# 1) Code sanity
+# 2) Has the required package been emerged?
+# 3) Has it modified anything?
+# 4) Have all the dependant modules been loaded?
+
+# Then we have to strip out the conflicting modules based on user preference
+# and default configuration and sort them into the correct order.
+# Finally we check the end result for dependancies.
+
+# This, of course, takes valuable CPU time so we provide module forcing as a
+# means to speed things up. We still do *some* checking but not much.
+
+# It is essential that you force modules in the correct order and supply all
+# the modules you need. You must always supply an interface module - we
+# supply ifconfig or iproute2.
+
+# The Big Fat Warning :- If you use module forcing do not complain to us or
+# file bugs about it not working!
+
+# Now that we've warned you twice, here's how to do it
+#modules_force=( "ifconfig" )
+#modules_force=( "iproute2" "dhcpcd" )
+
+# We can also apply this to a specific interface
+#modules_force_eth1=( "iproute2" )
+
+# The below will not work
+#modules_force=( "dhcpcd" )
+# No interface (ifconfig/iproute2)
+#modules_force=( "ifconfig" "essidnet" "iwconfig" )
+# Although it will not crash, essidnet will not work as it has to come after
+# iwconfig
+#modules_force=( "iproute2" "ifconfig" )
+# The interface will be setup twice which will cause problems
diff --git a/etc/conf.d/rc b/etc/conf.d/rc
new file mode 100644
index 0000000..b0b6167
--- /dev/null
+++ b/etc/conf.d/rc
@@ -0,0 +1,180 @@
+# /etc/conf.d/rc: Global config file for the Gentoo RC System
+
+# This is the number of tty's used in most of the rc-scripts (like
+# consolefont, numlock, etc ...)
+
+RC_TTY_NUMBER=11
+
+# Set to "yes" if you want the rc system to try and start services
+# in parallel for a slight speed improvement.
+
+RC_PARALLEL_STARTUP="no"
+
+# RC_NET_STRICT_CHECKING allows some flexibility with the 'net' service.
+# The following values are allowed:
+# none - The 'net' service is always considered up.
+# no - This basically means that at least one net.* service besides net.lo
+# must be up. This can be used by notebook users that have a wifi and
+# a static nic, and only wants one up at any given time to have the
+# 'net' service seen as up.
+# lo - This is the same as the 'no' option, but net.lo is also counted.
+# This should be useful to people that do not care about any specific
+# interface being up at boot.
+# yes - For this ALL network interfaces MUST be up for the 'net' service to
+# be considered up.
+
+RC_NET_STRICT_CHECKING="no"
+
+# RC_AUTO_INTERFACE allows us to try and configure your interfaces
+# automatically. This includes:
+# - link /etc/{resolv,ntp,yp}.conf to /var/lib/net-scripts
+# - calculate a metric based on what interfaces are up and type
+# - apply interface state (resolv.conf, ntp.conf, etc)
+# - merge resolv.conf and ntp.conf from active interfaces based on metric
+# otherwise we don't do the above
+
+RC_AUTO_INTERFACE="no"
+
+# RC_VOLUME_ORDER allows you to specify, or even remove the volume setup
+# for various volume managers (MD, EVMS2, LVM, DM, etc). Note that they are
+# stopped in reverse order.
+
+RC_VOLUME_ORDER="raid evms lvm dm"
+
+# RC_BOOTLOG will generate a log of the boot messages shown on the console.
+# Useful for headless machines or debugging. You need to emerge the
+# app-admin/showconsole package for this to work.
+
+RC_BOOTLOG="no"
+
+# RC_USE_FSTAB allows you to override the default mount options for the
+# standard /proc, /sys, /dev, and /dev/pts mount points. Note that this
+# is the new way for selecting ramfs/tmpfs/etc... for udev mounting.
+
+RC_USE_FSTAB="no"
+
+# RC_USE_CONFIG_PROFILE allows you to have different /etc/conf.d files
+# based on your runlevel - if a conf.d file for your profile does not exist
+# then we try and use the default one.
+# To enable runlevel selection at boot, append "softlevel=foobar" to your
+# kernel line to change to the foobar runlevel. Here we would search for
+# /etc/conf.d/<service>.foobar config files before trying to use the default
+# /etc/conf.d/<service>.
+# Note that it is only active if 'softlevel' was specified via the kernel line,
+# and it is intended to use for different grub/lilo entries to specify config
+# changes for say laptops between home and work, where you would have setup
+# 'work' and 'home' runlevels, with /etc/conf.d/*.<runlevel> as needed.
+
+RC_USE_CONFIG_PROFILE="yes"
+
+# RC_FORCE_AUTO tries its best to prevent user interaction during the boot and
+# shutdown process. For example, fsck will automatically be run or volumes
+# remounted to create proper directory trees. This feature can be dangerous
+# and is meant ONLY for headless machines where getting a physical console
+# hooked up is a huge pita.
+
+RC_FORCE_AUTO="no"
+
+# Use this variable to control the /dev management behavior.
+# auto - let the scripts figure out what's best at boot
+# devfs - use devfs (requires sys-fs/devfsd)
+# udev - use udev (requires sys-fs/udev)
+# static - let the user manage /dev
+
+RC_DEVICES="auto"
+
+# UDEV OPTION:
+# Set to "yes" if you want to save /dev to a tarball on shutdown
+# and restore it on startup. This is useful if you have a lot of
+# custom device nodes that udev does not handle/know about.
+
+RC_DEVICE_TARBALL="no"
+
+
+
+#
+# Controlling start-stop-daemon behavior
+
+# Set to "yes" if stop_daemon() should always retry killing the
+# service with sig KILL if it fails the first time.
+
+RC_RETRY_KILL="yes"
+
+
+# Set the amount of seconds stop_daemon() should wait between
+# retries.
+
+RC_RETRY_TIMEOUT=1
+
+
+# Set the amount of times stop_daemon() should try to kill
+# a service before giving up.
+
+RC_RETRY_COUNT=5
+
+
+# Set to "yes" if stop_daemon() should fail if the service
+# is marked as started, but not actually running on stop.
+
+RC_FAIL_ON_ZOMBIE="no"
+
+
+# Set to "yes" if stop_daemon() should attempt to kill
+# any children left in the system. This does not affect sshd.
+
+RC_KILL_CHILDREN="yes"
+
+
+# Set the amount of seconds start_daemon() waits after starting
+# the daemon to check it is still running. If it's not then we
+# try and stop any children if possible.
+RC_WAIT_ON_START="0.1"
+
+
+# Some daemons are started and stopped via start_stop_daemon.
+# We can change launch them through other daemons here, for example valgrind.
+# This is only useful for serious debugging of the daemon
+# Note non alphanumeric chars in the script name need to be changed to _
+# This is shown in the below example.
+# WARNING: If the script's "stop" function does not supply a PID file then
+# all processes using the same daemon will be killed.
+#RC_DAEMON_syslog_ng="/usr/bin/valgrind --tool=memcheck --log-file=/tmp/valgrind.syslog-ng"
+
+# strace needs to be prefixed with --background as it does not detach when
+# it's following
+#RC_DAEMON_syslog_ng="--background /usr/sbin/strace -f -o /tmp/strace.syslog-ng"
+
+#
+# Internal configuration variables
+#
+# NB: These are for advanced users, and you should really
+# know what you are doing before changing them!
+#
+
+
+# rc-scripts dep-cache directory
+#
+# NOTE: Do not remove the next line, as its needed by the baselayout ebuild!
+#
+# svcdir="/var/lib/init.d"
+
+svcdir="/var/lib/init.d"
+
+
+# Should we mount $svcdir in a ram disk for some speed increase
+# for slower machines, or for the more extreme setups ?
+
+svcmount="no"
+
+
+# FS type that should be used for $svcdir. Note that you need
+# $svcmount above set to "yes" for this to work ... Currently
+# tmpfs, ramfs, and ramdisk are supported (tmpfs is the default).
+
+svcfstype="tmpfs"
+
+
+# Size of $svcdir in KB. Note that ramfs doesn't support this
+# due to kernel limitations.
+
+svcsize=2048
diff --git a/etc/conf.d/wireless.example b/etc/conf.d/wireless.example
new file mode 100644
index 0000000..94c7918
--- /dev/null
+++ b/etc/conf.d/wireless.example
@@ -0,0 +1,283 @@
+# /etc/conf.d/wireless:
+# Global wireless config file for net.* rc-scripts
+
+##############################################################################
+# IMPORTANT
+# linux-wlan-ng is not supported as they have their own configuration program
+# ensure that /etc/conf.d/net has the entry "!iwconfig" in it's modules line
+# Try and use an alternative driver if you need to use this - hostap-driver
+# supports non-usb linux-wlan-ng driven devices
+##############################################################################
+
+##############################################################################
+# HINTS
+##############################################################################
+# Remember to change eth0 to your wireless interface which may be
+# eth0, eth1, wlan0, ath0 - you get the idea. If you're not sure
+# you can type "iwconfig" at the command prompt and it will tell you which
+# interfaces are wireless.
+# Say that your wireless interface is ath0 - the line
+# #essid_eth0="any"
+# becomes
+# #essid_ath0="any"
+#
+# Remember to change ESSID to your ESSID.
+# Say that your ESSID is My NET - the line
+# #key_ESSID="s:passkey"
+# becomes
+# #key_My_NET="s:passkey"
+# Notice that the space has changed to an underscore - do the same with all
+# characters not in a-z A-Z (english alphabet) 0-9. This only applies to
+# variables and not values.
+#
+# Any ESSID's in values like essid_eth0="My NET" may need to be escaped
+# This means placing the character \ before the character
+# \" need to be escaped for example
+# So if your ESSID is
+# My "\ NET
+# it becomes
+# My \"\\ NET
+# for example
+# #essid_eth0="My\"\\NET"
+#
+# So using the above we can use
+# #dns_domain_My____NET="My\"\\NET"
+# which is an invalid dns domain, but shows the how to use the variable
+# structure
+#
+# As a final note, most users will just need to set the following options
+# key_ESSID1="s:yourkeyhere enc open" # s: means a text key
+# key_ESSID2="aaaa-bbbb-cccc-dd" # no s: means a hex key
+# preferred_aps=( "ESSID1" "ESSID2" )
+#
+# Clear? Good. Now configure your wireless network below
+#########################################################
+
+##############################################################################
+# SETTINGS
+##############################################################################
+# Hard code an ESSID to an interface - leave this unset if you wish the driver
+# to scan for available Access Points
+# Set to "any" to connect to any ESSID - the driver picks an Access Point
+# This needs to be done when the driver doesn't support scanning
+# This may work for drivers that don't support scanning but you need automatic
+# AP association
+# I would only set this as a last resort really - use the preferred_aps
+# setting at the bottom of this file
+
+# However, using ad-hoc (without scanning for APs) and master mode
+# do require the ESSID to be set - do this here
+#essid_eth0="any"
+
+# Set the mode of the interface (managed, ad-hoc, master or auto)
+# The default is auto
+# If it's ad-hoc or master you also may need to specify the channel below
+#mode_eth0="auto"
+
+# If managed mode fails, drop to ad-hoc mode with the below ESSID?
+#adhoc_essid_eth0="WLAN"
+
+#Channel can be set (1-14), but defaults to 3 if not set.
+#
+# The below is taken verbatim from the BSD wavelan documentation found at
+# http://www.netbsd.org/Documentation/network/wavelan.html
+# There are 14 channels possible; We are told that channels 1-11 are legal for
+# North America, channels 1-13 for most of Europe, channels 10-13 for France,
+# and only channel 14 for Japan. If in doubt, please refer to the documentation
+# that came with your card or access point. Make sure that the channel you
+# select is the same channel your access point (or the other card in an ad-hoc
+# network) is on. The default for cards sold in North America and most of Europe
+# is 3; the default for cards sold in France is 11, and the default for cards
+# sold in Japan is 14.
+#channel_eth0="3"
+
+# Setup any other config commands. This is basically the iwconfig argument
+# without the iwconfig $iface
+#iwconfig_eth0=""
+
+# Set private driver ioctls. This is basically the iwpriv argument without
+# the iwpriv $iface
+#iwpriv_eth0=""
+
+# Seconds to wait before scanning
+# Some drivers need to wait until they have finished "loading"
+# before they can scan - otherwise they error and claim that they cannot scan
+# or resource is unavailable. The default is to wait zero seconds
+#sleep_scan_eth0="1"
+
+# Seconds to wait until associated. The default is to wait 10 seconds.
+# 0 means wait indefinitely. WARNING : this can cause an infinite delay when
+# booting.
+#associate_timeout_eth0="5"
+
+# By default a successful association in Managed mode sets the MAC
+# address of the AP connected to. However, some drivers (namely
+# the ipw2100) don't set an invalid MAC address when association
+# fails - so we need to check on link quality which some drivers
+# don't report properly either.
+# So if you have connection problems try flipping this setting
+# Valid options are MAC, quality and all - defaults to MAC
+#associate_test_eth0="MAC"
+
+# Some driver/card combinations need to scan in Ad-Hoc mode
+# After scanning, the mode is reset to the one defined above
+#scan_mode_eth0="Ad-Hoc"
+
+# Below you can define private ioctls to run before and after scanning
+# Format is the same as the iwpriv_eth0 above
+# This is needed for the HostAP drivers
+#iwpriv_scan_pre_eth0="host_roaming 2"
+#iwpriv_scan_post_eth0="host_roaming 0"
+
+# Define a WEP key per ESSID or MAC address (of the AP, not your card)
+# The encryption type (open or restricted) must match the
+# encryption type on the Access Point
+# You can't use "any" for an ESSID here
+#key_ESSID="1234-1234-1234-1234-1234-1234-56"
+# or you can use strings. Passphrase IS NOT supported
+# To use a string, prefix it with s:
+# Note - this example also sets the encryption method to open
+# which is regarded as more secure than restricted
+#key_ESSID="s:foobar enc open"
+#key_ESSID="s:foobar enc restricted"
+
+# If you have whitespace in your key, here's how to set it and use other
+# commands like using open encryption.
+#key_ESSID="s:'foo bar' enc open"
+
+# WEP key for the AP with MAC address 001122334455
+#key_001122334455="s:foobar"
+
+# Here are some more examples of keys as some users find others work
+# and some don't where they should all do the same thing
+#key_ESSID="open s:foobar"
+#key_ESSID="open 1234-5678-9012"
+#key_ESSID="s:foobar enc open"
+#key_ESSID="1234-5678-9012 enc open"
+
+# You may want to set muliple keys - here's an example
+# It sets 4 keys on the card and instructs to use key 2 by default
+#key_ESSID="[1] s:passkey1 key [2] s:passkey2 key [3] s:passkey3 key [4] s:passkey4 key [2]"
+
+# You can also override the interface settings found in /etc/conf.d/net
+# per ESSID - which is very handy if you use different networks a lot
+#config_ESSID=( "dhcp" )
+#dhcpcd_ESSID="-t 5"
+#routes_ESSID=()
+#fallback_ESSID=()
+
+# Setting name/domain server causes /etc/resolv.conf to be overwritten
+# Note that if DHCP is used, and you want this to take precedence then
+# please put -R in your dhcpcd options
+#dns_servers_ESSID=( "192.168.0.1" "192.168.0.2" )
+#dns_domain_ESSID="some.domain"
+#dns_search_path_ESSID="search.this.domain search.that.domain"
+# Please check the man page for resolv.conf for more information
+# as domain and search (searchdomains) are mutually exclusive and
+# searchdomains takes precedence
+
+# You can also set any of the /etc/conf.d/net variables per MAC address
+# incase you use Access Points with the same ESSID but need different
+# networking configs. Below is an example - of course you use the same
+# method with other variables
+#config_001122334455=( "dhcp" )
+#dhcpcd_001122334455="-t 10"
+#dns_servers_001122334455=( "192.168.0.1" "192.168.0.2" )
+
+# Map a MAC address to an ESSID
+# This is used when the Access Point is not broadcasting it's ESSID
+# WARNING: This will override the ESSID being broadcast due to some
+# Access Points sending an ESSID even when they have been configured
+# not too!
+# Change 001122334455 to the MAC address and ESSID to the ESSID
+# it should map to
+#essid_001122334455="ESSID"
+
+# This lists the preferred ESSIDs to connect to in order
+# ESSID's can contain any characters here as they must match the broadcast
+# ESSID exactly.
+# Surround each ESSID with the " character and seperate them with a space
+# If the first ESSID isn't found then it moves onto the next
+# If this isn't defined then it connects to the first one found
+#preferred_aps=( "ESSID 1" "ESSID 2" )
+
+# You can also define a preferred_aps list per interface
+#preferred_aps_eth0=( "ESSID 3" "ESSID 4" )
+
+# You can also say whether we only connect to preferred APs or not
+# Values are "any", "preferredonly", "forcepreferred", "forcepreferredonly" and "forceany"
+# "any" means it will connect to visible APs in the preferred list and then any
+# other available AP
+# "preferredonly" means it will only connect to visible APs in the preferred list
+# "forcepreferred" means it will forceably connect to APs in order if it does not find
+# them in a scan
+# "forcepreferredonly" means it forceably connects to the APs in order and does not bother
+# to scan
+# "forceany" does the same as forcepreferred + connects to any other available AP
+# Default is "any"
+#associate_order="any"
+#associate_order_eth0="any"
+
+# You can define blacklisted Access Points in the same way
+#blacklist_aps=( "ESSID 1" "ESSID 2" )
+#blacklist_aps_eth0=( "ESSID 3" ESSID 4" )
+
+# If you have more than one wireless card, you can say if you want
+# to allow each card to associate with the same Access Point or not
+# Values are "yes" and "no"
+# Default is "yes"
+#unique_ap="yes"
+#unique_ap_eth0="yes"
+
+# IMPORTANT: preferred_only, blacklisted_aps and unique_ap only work when
+# essid_eth0 is not set and your card is capable of scanning
+
+# NOTE: preferred_aps list ignores blacklisted_aps - so if you have
+# the same ESSID in both, well, you're a bit silly :p
+
+
+##############################################################################
+# ADVANCED CONFIGURATION
+#
+# Two functions can be defined which will be called surrounding the
+# associate function. The functions are called with the interface
+# name first so that one function can control multiple adapters.
+#
+# The return values for the preassociate function should be 0
+# (success) to indicate that configuration or deconfiguration of the
+# interface can continue. If preassociate returns a non-zero value, then
+# interface configuration will be aborted.
+#
+# The return value for the postassociate function is ignored
+# since there's nothing to do if it indicates failure.
+
+#preassociate() {
+# # The below adds two configuration variables leap_user_ESSID
+# # and leap_pass_ESSID. When they are both confiugred for the ESSID
+# # being connected to then we run the CISCO LEAP script
+#
+# local user pass
+# eval user=\"\$\{leap_user_${ESSIDVAR}\}\"
+# eval pass=\"\$\{leap_pass_${ESSIDVAR}\}\"
+#
+# if [[ -n ${user} && -n ${pass} ]]; then
+# if [[ ! -x /opt/cisco/bin/leapscript ]]; then
+# eend "For LEAP support, please emerge net-misc/cisco-aironet-client-utils"
+# return 1
+# fi
+# einfo "Waiting for LEAP Authentication on \"${ESSID//\\\\//}\""
+# if /opt/cisco/bin/leapscript ${user} ${pass} | grep -q 'Login incorrect'; then
+# ewarn "Login Failed for ${user}"
+# return 1
+# fi
+# fi
+#
+# return 0
+#}
+
+#postassociate() {
+# # This function is mostly here for completeness... I haven't
+# # thought of anything nifty to do with it yet ;-)
+# # Return 0 always
+# return 0
+#}
diff --git a/etc/env.d/00basic b/etc/env.d/00basic
new file mode 100644
index 0000000..d19d540
--- /dev/null
+++ b/etc/env.d/00basic
@@ -0,0 +1,10 @@
+# /etc/env.d/00basic
+
+PATH="/opt/bin"
+ROOTPATH="/opt/bin"
+LDPATH="/usr/local/lib"
+MANPATH="/usr/local/share/man:/usr/share/man"
+INFOPATH="/usr/share/info"
+CVS_RSH="ssh"
+PAGER="/usr/bin/less"
+LESSOPEN="|lesspipe.sh %s"
diff --git a/etc/filesystems b/etc/filesystems
new file mode 100644
index 0000000..de172c9
--- /dev/null
+++ b/etc/filesystems
@@ -0,0 +1,14 @@
+# /etc/filesystems
+#
+# This file defines the filesystems search order used by a
+# 'mount -t auto' command.
+#
+
+# Uncomment the following line if your modular kernel has vfat
+# support and you want mount to try vfat.
+#vfat
+
+# Keep the last '*' intact as it directs mount to use the
+# filesystems list available at /proc/filesystems also.
+# Don't remove it unless you REALLY knows what you are doing!
+*
diff --git a/etc/fstab b/etc/fstab
new file mode 100644
index 0000000..64cb8de
--- /dev/null
+++ b/etc/fstab
@@ -0,0 +1,30 @@
+# /etc/fstab: static file system information.
+#
+# noatime turns off atimes for increased performance (atimes normally aren't
+# needed; notail increases performance of ReiserFS (at the expense of storage
+# efficiency). It's safe to drop the noatime options if you want and to
+# switch between notail / tail freely.
+#
+# The root filesystem should have a pass number of either 0 or 1.
+# All other filesystems should have a pass number of 0 or greater than 1.
+#
+# See the manpage fstab(5) for more information.
+#
+
+# <fs> <mountpoint> <type> <opts> <dump/pass>
+
+# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
+/dev/BOOT /boot ext2 noauto,noatime 1 2
+/dev/ROOT / ext3 noatime 0 1
+/dev/SWAP none swap sw 0 0
+/dev/cdroms/cdrom0 /mnt/cdrom iso9660 noauto,ro 0 0
+#/dev/fd0 /mnt/floppy auto noauto 0 0
+
+# NOTE: The next line is critical for boot!
+proc /proc proc defaults 0 0
+
+# glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for
+# POSIX shared memory (shm_open, shm_unlink).
+# (tmpfs is a dynamically expandable/shrinkable ramdisk, and will
+# use almost no memory if not populated with files)
+shm /dev/shm tmpfs nodev,nosuid,noexec 0 0
diff --git a/etc/group b/etc/group
new file mode 100644
index 0000000..2d58052
--- /dev/null
+++ b/etc/group
@@ -0,0 +1,43 @@
+root::0:root
+bin::1:root,bin,daemon
+daemon::2:root,bin,daemon
+sys::3:root,bin,adm
+adm::4:root,adm,daemon
+tty::5:
+disk::6:root,adm
+lp::7:lp
+mem::8:
+kmem::9:
+wheel::10:root
+floppy::11:root
+mail::12:mail
+news::13:news
+uucp::14:uucp
+man::15:man
+cron::16:cron
+console::17:
+audio::18:
+cdrom::19:
+dialout::20:root
+ftp::21:
+sshd::22:
+at::25:at
+tape::26:root
+video::27:root
+squid::31:squid
+gdm::32:gdm
+xfs::33:xfs
+games::35:
+postgres::70:
+cdrw::80:
+nut::84:
+usb::85:
+users::100:games
+nofiles:x:200:
+postfix:x:207:
+postdrop:x:208:
+smmsp:x:209:smmsp
+portage::250:portage
+utmp:x:406:
+nogroup::65533:
+nobody::65534:
diff --git a/etc/hosts b/etc/hosts
new file mode 100644
index 0000000..53f39d3
--- /dev/null
+++ b/etc/hosts
@@ -0,0 +1,31 @@
+# /etc/hosts: Local Host Database
+#
+# This file describes a number of aliases-to-address mappings for the for
+# local hosts that share this file.
+#
+# In the presence of the domain name service or NIS, this file may not be
+# consulted at all; see /etc/host.conf for the resolution order.
+#
+
+# IPv4 and IPv6 localhost aliases
+127.0.0.1 localhost
+::1 localhost
+
+#
+# Imaginary network.
+#10.0.0.2 myname
+#10.0.0.3 myfriend
+#
+# According to RFC 1918, you can use the following IP networks for private
+# nets which will never be connected to the Internet:
+#
+# 10.0.0.0 - 10.255.255.255
+# 172.16.0.0 - 172.31.255.255
+# 192.168.0.0 - 192.168.255.255
+#
+# In case you want to be able to connect directly to the Internet (i.e. not
+# behind a NAT, ADSL router, etc...), you need real official assigned
+# numbers. Do not try to invent your own network numbers but instead get one
+# from your network provider (if any) or from your regional registry (ARIN,
+# APNIC, LACNIC, RIPE NCC, or AfriNIC.)
+#
diff --git a/etc/inittab b/etc/inittab
new file mode 100644
index 0000000..a2c679a
--- /dev/null
+++ b/etc/inittab
@@ -0,0 +1,45 @@
+# /etc/inittab:
+#
+# This file describes how the INIT process should set up
+# the system in a certain run-level.
+#
+
+# Default runlevel.
+id:3:initdefault:
+
+# System initialization, mount local filesystems, etc.
+si::sysinit:/sbin/rc sysinit
+
+# Further system initialization, brings up the boot runlevel.
+rc::bootwait:/sbin/rc boot
+
+l0:0:wait:/sbin/rc shutdown
+l1:S1:wait:/sbin/rc single
+l2:2:wait:/sbin/rc nonetwork
+l3:3:wait:/sbin/rc default
+l4:4:wait:/sbin/rc default
+l5:5:wait:/sbin/rc default
+l6:6:wait:/sbin/rc reboot
+#z6:6:respawn:/sbin/sulogin
+
+# TERMINALS
+c1:12345:respawn:/sbin/agetty 38400 tty1 linux
+c2:12345:respawn:/sbin/agetty 38400 tty2 linux
+c3:12345:respawn:/sbin/agetty 38400 tty3 linux
+c4:12345:respawn:/sbin/agetty 38400 tty4 linux
+c5:12345:respawn:/sbin/agetty 38400 tty5 linux
+c6:12345:respawn:/sbin/agetty 38400 tty6 linux
+
+# SERIAL CONSOLES
+#s0:12345:respawn:/sbin/agetty 9600 ttyS0 vt100
+#s1:12345:respawn:/sbin/agetty 9600 ttyS1 vt100
+
+# What to do at the "Three Finger Salute".
+ca:12345:ctrlaltdel:/sbin/shutdown -r now
+
+# Used by /etc/init.d/xdm to control DM startup.
+# Read the comments in /etc/init.d/xdm for more
+# info. Do NOT remove, as this will start nothing
+# extra at boot if /etc/init.d/xdm is not added
+# to the "default" runlevel.
+x:a:once:/etc/X11/startDM.sh
diff --git a/etc/inputrc b/etc/inputrc
new file mode 100644
index 0000000..aaabc80
--- /dev/null
+++ b/etc/inputrc
@@ -0,0 +1,56 @@
+# /etc/inputrc: initialization file for readline
+#
+# For more information on how this file works, please see the
+# INITIALIZATION FILE section of the readline(3) man page
+#
+
+# do not bell on tab-completion
+#set bell-style none
+
+set meta-flag on
+set input-meta on
+set convert-meta off
+set output-meta on
+
+# Completed names which are symbolic links to
+# directories have a slash appended.
+set mark-symlinked-directories on
+
+$if mode=emacs
+
+# for linux console and RH/Debian xterm
+"\e[1~": beginning-of-line
+"\e[4~": end-of-line
+#"\e[5~": beginning-of-history
+#"\e[6~": end-of-history
+"\e[5~": history-search-backward
+"\e[6~": history-search-forward
+"\e[3~": delete-char
+"\e[2~": quoted-insert
+
+# gnome-terminal (escape + arrow key)
+"\e[5C": forward-word
+"\e[5D": backward-word
+# konsole / xterm / rxvt (escape + arrow key)
+"\e\e[C": forward-word
+"\e\e[D": backward-word
+# aterm / eterm (control + arrow key)
+"\eOc": forward-word
+"\eOd": backward-word
+
+$if term=rxvt
+"\e[8~": end-of-line
+$endif
+
+# for non RH/Debian xterm, can't hurt for RH/Debian xterm
+"\eOH": beginning-of-line
+"\eOF": end-of-line
+
+# for freebsd console
+"\e[H": beginning-of-line
+"\e[F": end-of-line
+$endif
+
+# fix Home and End for German users
+"\e[7~": beginning-of-line
+"\e[8~": end-of-line
diff --git a/etc/issue b/etc/issue
new file mode 100644
index 0000000..015e46d
--- /dev/null
+++ b/etc/issue
@@ -0,0 +1,3 @@
+
+This is \n.\O (\s \m \r) \t
+
diff --git a/etc/issue.devfix b/etc/issue.devfix
new file mode 100644
index 0000000..163e50f
--- /dev/null
+++ b/etc/issue.devfix
@@ -0,0 +1,21 @@
+-----------------------------------------------------
+Your system seems to be missing critical device files
+in /dev ! Although you may be running udev or devfs,
+the root partition is missing these required files !
+
+To rectify this situation, please do the following:
+mkdir /mnt/fixit
+mount --bind / /mnt/fixit
+cp -a /dev/* /mnt/fixit/dev/
+umount /mnt/fixit
+rmdir /mnt/fixit
+
+You may refer to these instructions at /etc/issue.
+If you previously had an issue file, it has been
+backed up at /etc/issue.devfix. Once you've fixed
+your system, you will have to restore your old issue
+file in order to get rid of this warning.
+
+Thanks for using Gentoo ! :)
+http://bugs.gentoo.org/show_bug.cgi?id=40987
+-----------------------------------------------------
diff --git a/etc/issue.logo b/etc/issue.logo
new file mode 100644
index 0000000..d8e20ef
--- /dev/null
+++ b/etc/issue.logo
@@ -0,0 +1,13 @@
+ .
+ .vir. d$b
+ .d$$$$$$b. .cd$$b. .d$$b. d$$$$$$$$$$$b .d$$b. .d$$b.
+ $$$$( )$$$b d$$$()$$$. d$$$$$$$b Q$$$$$$$P$$$P.$$$$$$$b. .$$$$$$$b.
+ Q$$$$$$$$$$B$$$$$$$$P" d$$$PQ$$$$b. $$$$. .$$$P' `$$$ .$$$P' `$$$
+ "$$$$$$$P Q$$$$$$$b d$$$P Q$$$$b $$$$b $$$$b..d$$$ $$$$b..d$$$
+ d$$$$$$P" "$$$$$$$$ Q$$$ Q$$$$ $$$$$ `Q$$$$$$$P `Q$$$$$$$P
+ $$$$$$$P `""""" "" "" Q$$$P "Q$$$P" "Q$$$P"
+ `Q$$P" """
+
+
+This is \n.\O (\s \m \r) \t
+
diff --git a/etc/modules.autoload.d/kernel-2.4 b/etc/modules.autoload.d/kernel-2.4
new file mode 100644
index 0000000..a92bec1
--- /dev/null
+++ b/etc/modules.autoload.d/kernel-2.4
@@ -0,0 +1,11 @@
+# /etc/modules.autoload.d/kernel-2.4: kernel modules to load when system boots.
+#
+# Note that this file is for 2.4 kernels. If you need different modules
+# for a 2.6 kernel, you can create /etc/modules.autoload.d/kernel-2.6
+#
+# Add the names of modules that you'd like to load when the system
+# starts into this file, one per line. Comments begin with # and
+# are ignored. Read man modules.autoload for additional details.
+
+# For example:
+# 3c59x
diff --git a/etc/modules.autoload.d/kernel-2.6 b/etc/modules.autoload.d/kernel-2.6
new file mode 100644
index 0000000..6a9efab
--- /dev/null
+++ b/etc/modules.autoload.d/kernel-2.6
@@ -0,0 +1,10 @@
+# /etc/modules.autoload.d/kernel-2.6: kernel modules to load when system boots.
+#
+# Note that this file is for 2.6 kernels.
+#
+# Add the names of modules that you'd like to load when the system
+# starts into this file, one per line. Comments begin with # and
+# are ignored. Read man modules.autoload for additional details.
+
+# For example:
+# 3c59x
diff --git a/etc/modules.d/aliases b/etc/modules.d/aliases
new file mode 100644
index 0000000..85ff710
--- /dev/null
+++ b/etc/modules.d/aliases
@@ -0,0 +1,46 @@
+# Aliases to tell insmod/modprobe which modules to use
+
+# Uncomment the network protocols you don't want loaded:
+# alias net-pf-1 off # Unix
+# alias net-pf-2 off # IPv4
+# alias net-pf-3 off # Amateur Radio AX.25
+# alias net-pf-4 off # IPX
+# alias net-pf-5 off # DDP / appletalk
+# alias net-pf-6 off # Amateur Radio NET/ROM
+# alias net-pf-9 off # X.25
+# alias net-pf-10 off # IPv6
+# alias net-pf-11 off # ROSE / Amateur Radio X.25 PLP
+# alias net-pf-19 off # Acorn Econet
+
+alias char-major-10-175 agpgart
+alias char-major-10-200 tun
+alias char-major-81 bttv
+alias char-major-108 ppp_generic
+alias /dev/ppp ppp_generic
+alias tty-ldisc-3 ppp_async
+alias tty-ldisc-14 ppp_synctty
+alias ppp-compress-21 bsd_comp
+alias ppp-compress-24 ppp_deflate
+alias ppp-compress-26 ppp_deflate
+
+# Crypto modules (see http://www.kerneli.org/)
+alias loop-xfer-gen-0 loop_gen
+alias loop-xfer-3 loop_fish2
+alias loop-xfer-gen-10 loop_gen
+alias cipher-2 des
+alias cipher-3 fish2
+alias cipher-4 blowfish
+alias cipher-6 idea
+alias cipher-7 serp6f
+alias cipher-8 mars6
+alias cipher-11 rc62
+alias cipher-15 dfc2
+alias cipher-16 rijndael
+alias cipher-17 rc5
+
+# Support for i2c and lm_sensors
+alias char-major-89 i2c-dev
+
+# Old nvidia support ...
+alias char-major-195 NVdriver
+alias /dev/nvidiactl char-major-195
diff --git a/etc/modules.d/i386 b/etc/modules.d/i386
new file mode 100644
index 0000000..b89459f
--- /dev/null
+++ b/etc/modules.d/i386
@@ -0,0 +1,4 @@
+alias parport_lowlevel parport_pc
+alias char-major-10-144 nvram
+alias binfmt-0064 binfmt_aout
+alias char-major-10-135 rtc
diff --git a/etc/networks b/etc/networks
new file mode 100644
index 0000000..48327f0
--- /dev/null
+++ b/etc/networks
@@ -0,0 +1,8 @@
+# /etc/networks
+#
+# This file describes a number of netname-to-adress
+# mappings for the TCP/IP subsytem. It is mostly
+# used at boot time, when no name servers are running.
+#
+
+loopback 127.0.0.0
diff --git a/etc/passwd b/etc/passwd
new file mode 100644
index 0000000..e30265c
--- /dev/null
+++ b/etc/passwd
@@ -0,0 +1,28 @@
+root:x:0:0:root:/root:/bin/bash
+bin:x:1:1:bin:/bin:/bin/false
+daemon:x:2:2:daemon:/sbin:/bin/false
+adm:x:3:4:adm:/var/adm:/bin/false
+lp:x:4:7:lp:/var/spool/lpd:/bin/false
+sync:x:5:0:sync:/sbin:/bin/sync
+shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
+halt:x:7:0:halt:/sbin:/sbin/halt
+mail:x:8:12:mail:/var/spool/mail:/bin/false
+news:x:9:13:news:/usr/lib/news:/bin/false
+uucp:x:10:14:uucp:/var/spool/uucppublic:/bin/false
+operator:x:11:0:operator:/root:/bin/bash
+man:x:13:15:man:/usr/share/man:/bin/false
+postmaster:x:14:12:postmaster:/var/spool/mail:/bin/false
+cron:x:16:16:cron:/var/spool/cron:/bin/false
+ftp:x:21:21::/home/ftp:/bin/false
+sshd:x:22:22:sshd:/dev/null:/bin/false
+at:x:25:25:at:/var/spool/cron/atjobs:/bin/false
+squid:x:31:31:Squid:/var/cache/squid:/bin/false
+gdm:x:32:32:GDM:/var/lib/gdm:/bin/false
+xfs:x:33:33:X Font Server:/etc/X11/fs:/bin/false
+games:x:35:35:games:/usr/games:/bin/false
+postgres:x:70:70::/var/lib/postgresql:/bin/bash
+nut:x:84:84:nut:/var/state/nut:/bin/false
+postfix:x:207:207:postfix:/var/spool/postfix:/bin/false
+smmsp:x:209:209:smmsp:/var/spool/mqueue:/bin/false
+portage:x:250:250:portage:/var/tmp/portage:/bin/false
+nobody:x:65534:65534:nobody:/:/bin/false
diff --git a/etc/profile b/etc/profile
new file mode 100644
index 0000000..835b0ab
--- /dev/null
+++ b/etc/profile
@@ -0,0 +1,58 @@
+# /etc/profile: login shell setup
+#
+# That this file is used by any Bourne-shell derivative to setup the
+# environment for login shells.
+#
+
+# Load environment settings from profile.env, which is created by
+# env-update from the files in /etc/env.d
+if [ -e /etc/profile.env ] ; then
+ . /etc/profile.env
+fi
+
+# 077 would be more secure, but 022 is generally quite realistic
+umask 022
+
+# Set up PATH depending on whether we're root or a normal user.
+# There's no real reason to exclude sbin paths from the normal user,
+# but it can make tab-completion easier when they aren't in the
+# user's PATH to pollute the executable namespace.
+#
+# It is intentional in the following line to use || instead of -o.
+# This way the evaluation can be short-circuited and calling whoami is
+# avoided.
+if [ "$EUID" = "0" ] || [ "$USER" = "root" ] ; then
+ PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${ROOTPATH}"
+else
+ PATH="/usr/local/bin:/usr/bin:/bin:${PATH}"
+fi
+export PATH
+unset ROOTPATH
+
+# Extract the value of EDITOR
+[ -z "$EDITOR" ] && EDITOR="`. /etc/rc.conf 2>/dev/null; echo $EDITOR`"
+[ -z "$EDITOR" ] && EDITOR="/bin/nano"
+export EDITOR
+
+if [ -n "${BASH_VERSION}" ] ; then
+ # Newer bash ebuilds include /etc/bash/bashrc which will setup PS1
+ # including color. We leave out color here because not all
+ # terminals support it.
+ if [ -f /etc/bash/bashrc ] ; then
+ # Bash login shells run only /etc/profile
+ # Bash non-login shells run only /etc/bash/bashrc
+ # Since we want to run /etc/bash/bashrc regardless, we source it
+ # from here. It is unfortunate that there is no way to do
+ # this *after* the user's .bash_profile runs (without putting
+ # it in the user's dot-files), but it shouldn't make any
+ # difference.
+ . /etc/bash/bashrc
+ else
+ PS1='\u@\h \w \$ '
+ fi
+else
+ # Setup a bland default prompt. Since this prompt should be useable
+ # on color and non-color terminals, as well as shells that don't
+ # understand sequences such as \h, don't put anything special in it.
+ PS1="`whoami`@`uname -n | cut -f1 -d.` \$ "
+fi
diff --git a/etc/protocols b/etc/protocols
new file mode 100644
index 0000000..3f48ccb
--- /dev/null
+++ b/etc/protocols
@@ -0,0 +1,42 @@
+# /etc/protocols
+#
+# Internet (IP) protocols definition file
+#
+# See protocols(5) for more info
+#
+
+ip 0 IP # internet protocol, pseudo protocol number
+icmp 1 ICMP # internet control message protocol
+igmp 2 IGMP # Internet Group Management
+ggp 3 GGP # gateway-gateway protocol
+ipencap 4 IP-ENCAP # IP encapsulated in IP (officially ``IP'')
+st 5 ST # ST datagram mode
+tcp 6 TCP # transmission control protocol
+egp 8 EGP # exterior gateway protocol
+pup 12 PUP # PARC universal packet protocol
+udp 17 UDP # user datagram protocol
+hmp 20 HMP # host monitoring protocol
+xns-idp 22 XNS-IDP # Xerox NS IDP
+rdp 27 RDP # "reliable datagram" protocol
+iso-tp4 29 ISO-TP4 # ISO Transport Protocol class 4
+xtp 36 XTP # Xpress Tranfer Protocol
+ddp 37 DDP # Datagram Delivery Protocol
+idpr-cmtp 38 IDPR-CMTP # IDPR Control Message Transport
+ipv6 41 IPv6 # IPv6
+ipv6-route 43 IPv6-Route # Routing Header for IPv6
+ipv6-frag 44 IPv6-Frag # Fragment Header for IPv6
+idrp 45 IDRP # Inter-Domain Routing Protocol
+rsvp 46 RSVP # Reservation Protocol
+gre 47 GRE # General Routing Encapsulation
+esp 50 ESP # Encap Security Payload for IPv6
+ah 51 AH # Authentication Header for IPv6
+skip 57 SKIP # SKIP
+ipv6-icmp 58 IPv6-ICMP # ICMP for IPv6
+ipv6-nonxt 59 IPv6-NoNxt # No Next Header for IPv6
+ipv6-opts 60 IPv6-Opts # Destination Options for IPv6
+rspf 73 RSPF # Radio Shortest Path First.
+vmtp 81 VMTP # Versatile Message Transport
+ospf 89 OSPFIGP # Open Shortest Path First IGP
+ipip 94 IPIP # IP-within-IP Encapsulation Protocol
+encap 98 ENCAP # Yet Another IP encapsulation
+pim 103 PIM # Protocol Independent Multicast
diff --git a/etc/rc.conf b/etc/rc.conf
new file mode 100644
index 0000000..b1c90e5
--- /dev/null
+++ b/etc/rc.conf
@@ -0,0 +1,39 @@
+# /etc/rc.conf: Global startup script configuration settings
+
+# UNICODE specifies whether you want to have UNICODE support in the console.
+# If you set to yes, please make sure to set a UNICODE aware CONSOLEFONT and
+# KEYMAP in the /etc/conf.d/consolefont and /etc/conf.d/keymaps config files.
+
+UNICODE="no"
+
+# Set EDITOR to your preferred editor.
+# You may use something other than what is listed here.
+
+EDITOR="/bin/nano"
+#EDITOR="/usr/bin/vim"
+#EDITOR="/usr/bin/emacs"
+
+# What display manager do you use ? [ xdm | gdm | kdm | entrance ]
+#DISPLAYMANAGER="xdm"
+
+# XSESSION is a new variable to control what window manager to start
+# default with X if run with xdm, startx or xinit. The default behavior
+# is to look in /etc/X11/Sessions/ and run the script in matching the
+# value that XSESSION is set to. The support scripts are smart enough to
+# look in all bin directories if it cant find a match in /etc/X11/Sessions/,
+# so setting it to "enlightenment" can also work. This is basically used
+# as a way for the system admin to configure a default system wide WM,
+# allthough it will work if the user export XSESSION in his .bash_profile, etc.
+#
+# NOTE: 1) this behaviour is overridden when a ~/.xinitrc exists, and startx
+# is called.
+# 2) even if ~/.xsession exists, if XSESSION can be resolved, it will
+# be executed rather than ~/.xsession, else KDM breaks ...
+#
+# Defaults depending on what you install currently include:
+#
+# Gnome - will start gnome-session
+# kde-<version> - will start startkde (ex: kde-3.0.2)
+# Xsession - will start a terminal and a few other nice apps
+
+#XSESSION="Gnome"
diff --git a/etc/services b/etc/services
new file mode 100644
index 0000000..eabc167
--- /dev/null
+++ b/etc/services
@@ -0,0 +1,969 @@
+# /etc/services
+#
+# Network services, Internet style
+#
+# Note that it is presently the policy of IANA to assign a single well-known
+# port number for both TCP and UDP; hence, most entries here have two entries
+# even if the protocol doesn't support UDP operations.
+#
+# Some References:
+# http://www.iana.org/assignments/port-numbers
+# http://www.freebsd.org/cgi/cvsweb.cgi/src/etc/services
+#
+# Each line describes one service, and is of the form:
+# service-name port/protocol [aliases ...] [# comment]
+#
+
+#
+# IANA Assignments [Well Known Ports]
+# The Well Known Ports are assigned by the IANA and on most systems can
+# only be used by system (or root) processes or by programs executed by
+# privileged users.
+# The range for assigned ports managed by the IANA is 0-1023.
+#
+tcpmux 1/tcp # TCP port service multiplexer
+tcpmux 1/udp
+compressnet 2/tcp # Management Utility
+compressnet 2/udp
+compressnet 3/tcp # Compression Process
+compressnet 3/udp
+rje 5/tcp # Remote Job Entry
+rje 5/udp
+echo 7/tcp # Echo
+echo 7/udp
+discard 9/tcp sink null # Discard
+discard 9/udp sink null
+systat 11/tcp users # Active Users
+systat 11/udp users
+daytime 13/tcp # Daytime (RFC 867)
+daytime 13/udp
+#netstat 15/tcp # (was once asssigned, no more)
+qotd 17/tcp quote # Quote of the Day
+qotd 17/udp quote
+msp 18/tcp # Message Send Protocol
+msp 18/udp
+chargen 19/tcp ttytst source # Character Generator
+chargen 19/udp ttytst source
+ftp-data 20/tcp # File Transfer [Default Data]
+ftp-data 20/udp
+ftp 21/tcp # File Transfer [Control]
+ftp 21/udp fsp fspd
+ssh 22/tcp # SSH Remote Login Protocol
+ssh 22/udp
+telnet 23/tcp # Telnet
+telnet 23/udp
+# private 24/tcp # any private mail system
+# private 24/udp
+smtp 25/tcp mail # Simple Mail Transfer
+smtp 25/udp
+nsw-fe 27/tcp # NSW User System FE
+nsw-fe 27/udp
+msg-icp 29/tcp # MSG ICP
+msg-icp 29/udp
+msg-auth 31/tcp # MSG Authentication
+msg-auth 31/udp
+dsp 33/tcp # Display Support Protocol
+dsp 33/udp
+# private 35/tcp # any private printer server
+# private 35/udp
+time 37/tcp timserver
+time 37/udp timserver
+rap 38/tcp # Route Access Protocol
+rap 38/udp
+rlp 39/tcp resource # Resource Location Protocol
+rlp 39/udp resource
+graphics 41/tcp # Graphics
+graphics 41/udp
+nameserver 42/tcp name # Host Name Server
+nameserver 42/udp name
+nicname 43/tcp whois # Who Is
+nicname 43/udp whois
+mpm-flags 44/tcp # MPM FLAGS Protocol
+mpm-flags 44/udp
+mpm 45/tcp # Message Processing Module [recv]
+mpm 45/udp
+mpm-snd 46/tcp # MPM [default send]
+mpm-snd 46/udp
+ni-ftp 47/tcp # NI FTP
+ni-ftp 47/udp
+auditd 48/tcp # Digital Audit Daemon
+auditd 48/udp
+tacacs 49/tcp # Login Host Protocol (TACACS)
+tacacs 49/udp
+re-mail-ck 50/tcp # Remote Mail Checking Protocol
+re-mail-ck 50/udp
+domain 53/tcp # Domain Name Server
+domain 53/udp
+xns-ch 54/tcp # XNS Clearinghouse
+xns-ch 54/udp
+isi-gl 55/tcp # ISI Graphics Language
+isi-gl 55/udp
+xns-auth 56/tcp # XNS Authentication
+xns-auth 56/udp
+# private 57/tcp # any private terminal access
+# private 57/udp
+xns-mail 58/tcp # XNS Mail
+xns-mail 58/udp
+# private 59/tcp # any private file service
+# private 59/udp
+ni-mail 61/tcp # NI MAIL
+ni-mail 61/udp
+acas 62/tcp # ACA Services
+acas 62/udp
+whois++ 63/tcp # whois++
+whois++ 63/udp
+covia 64/tcp # Communications Integrator (CI)
+covia 64/udp
+tacacs-ds 65/tcp # TACACS-Database Service
+tacacs-ds 65/udp
+sql*net 66/tcp # Oracle SQL*NET
+sql*net 66/udp
+bootps 67/tcp # Bootstrap Protocol Server (BOOTP)
+bootps 67/udp
+bootpc 68/tcp # Bootstrap Protocol Client (BOOTP)
+bootpc 68/udp
+tftp 69/tcp # Trivial File Transfer
+tftp 69/udp
+gopher 70/tcp # Gopher
+gopher 70/udp
+netrjs-1 71/tcp # Remote Job Service
+netrjs-1 71/udp
+netrjs-2 72/tcp
+netrjs-2 72/udp
+netrjs-3 73/tcp
+netrjs-3 73/udp
+netrjs-4 74/tcp
+netrjs-4 74/udp
+# private 75/tcp # any private dial out service
+# private 75/udp
+deos 76/tcp # Distributed External Object Store
+deos 76/udp
+# private 77/tcp # any private RJE service
+# private 77/udp
+vettcp 78/tcp # vettcp
+vettcp 78/udp
+finger 79/tcp # Finger
+finger 79/udp
+http 80/tcp www www-http # World Wide Web HTTP
+http 80/udp www www-http
+hosts2-ns 81/tcp # HOSTS2 Name Server
+hosts2-ns 81/udp
+xfer 82/tcp # XFER Utility
+xfer 82/udp
+mit-ml-dev 83/tcp # MIT ML Device
+mit-ml-dev 83/udp
+ctf 84/tcp # Common Trace Facility
+ctf 84/udp
+mit-ml-dev 85/tcp # MIT ML Device
+mit-ml-dev 85/udp
+mfcobol 86/tcp # Micro Focus Cobol
+mfcobol 86/udp
+# private 87/tcp # any private terminal link
+# private 87/udp
+kerberos 88/tcp kerberos5 krb5 # Kerberos
+kerberos 88/udp kerberos5 krb5
+su-mit-tg 89/tcp # SU/MIT Telnet Gateway
+su-mit-tg 89/udp
+dnsix 90/tcp # DNSIX Securit Attribute Token Map
+dnsix 90/udp
+mit-dov 91/tcp # MIT Dover Spooler
+mit-dov 91/udp
+npp 92/tcp # Network Printing Protocol
+npp 92/udp
+dcp 93/tcp # Device Control Protocol
+dcp 93/udp
+objcall 94/tcp # Tivoli Object Dispatcher
+objcall 94/udp
+supdup 95/tcp # SUPDUP
+supdup 95/udp
+dixie 96/tcp # DIXIE Protocol Specification
+dixie 96/udp
+swift-rvf 97/tcp # Swift Remote Virtural File Protocol
+swift-rvf 97/udp
+tacnews 98/tcp # TAC News
+tacnews 98/udp
+metagram 99/tcp # Metagram Relay
+metagram 99/udp
+#newacct 100/tcp # [unauthorized use]
+hostname 101/tcp hostnames # NIC Host Name Server
+hostname 101/udp hostnames
+iso-tsap 102/tcp tsap # ISO-TSAP Class 0
+iso-tsap 102/udp tsap
+gppitnp 103/tcp # Genesis Point-to-Point Trans Net
+gppitnp 103/udp
+acr-nema 104/tcp # ACR-NEMA Digital Imag. & Comm. 300
+acr-nema 104/udp
+cso 105/tcp csnet-ns cso-ns # CCSO name server protocol
+cso 105/udp csnet-ns cso-ns
+3com-tsmux 106/tcp poppassd # 3COM-TSMUX
+3com-tsmux 106/udp poppassd # Eudora: Unauthorized use by insecure poppassd protocol
+rtelnet 107/tcp # Remote Telnet Service
+rtelnet 107/udp
+snagas 108/tcp # SNA Gateway Access Server
+snagas 108/udp
+pop2 109/tcp pop-2 postoffice# Post Office Protocol - Version 2
+pop2 109/udp pop-2
+pop3 110/tcp pop-3 # Post Office Protocol - Version 3
+pop3 110/udp pop-3
+sunrpc 111/tcp portmapper # SUN Remote Procedure Call
+sunrpc 111/udp portmapper
+mcidas 112/tcp # McIDAS Data Transmission Protocol
+mcidas 112/udp
+auth 113/tcp authentication tap ident # Authentication Service
+auth 113/udp
+sftp 115/tcp # Simple File Transfer Protocol
+sftp 115/udp
+ansanotify 116/tcp # ANSA REX Notify
+ansanotify 116/udp
+uucp-path 117/tcp # UUCP Path Service
+uucp-path 117/udp
+sqlserv 118/tcp # SQL Services
+sqlserv 118/udp
+nntp 119/tcp readnews untp # Network News Transfer Protocol
+nntp 119/udp readnews untp
+cfdptkt 120/tcp # CFDPTKT
+cfdptkt 120/udp
+erpc 121/tcp # Encore Expedited Remote Pro.Call
+erpc 121/udp
+smakynet 122/tcp # SMAKYNET
+smakynet 122/udp
+ntp 123/tcp # Network Time Protocol
+ntp 123/udp
+ansatrader 124/tcp # ANSA REX Trader
+ansatrader 124/udp
+locus-map 125/tcp # Locus PC-Interface Net Map Ser
+locus-map 125/udp
+nxedit 126/tcp unitary # NXEdit
+nxedit 126/udp unitary # Unisys Unitary Login
+locus-con 127/tcp # Locus PC-Interface Conn Server
+locus-con 127/udp
+gss-xlicen 128/tcp # GSS X License Verification
+gss-xlicen 128/udp
+pwdgen 129/tcp # Password Generator Protocol
+pwdgen 129/udp
+cisco-fna 130/tcp # cisco FNATIVE
+cisco-fna 130/udp
+cisco-tna 131/tcp # cisco TNATIVE
+cisco-tna 131/udp
+cisco-sys 132/tcp # cisco SYSMAINT
+cisco-sys 132/udp
+statsrv 133/tcp # Statistics Service
+statsrv 133/udp
+ingres-net 134/tcp # INGRES-NET Service
+ingres-net 134/udp
+epmap 135/tcp loc-srv # DCE endpoint resolution
+epmap 135/udp loc-srv
+profile 136/tcp # PROFILE Naming System
+profile 136/udp
+netbios-ns 137/tcp # NETBIOS Name Service
+netbios-ns 137/udp
+netbios-dgm 138/tcp # NETBIOS Datagram Service
+netbios-dgm 138/udp
+netbios-ssn 139/tcp # NETBIOS Session Service
+netbios-ssn 139/udp
+emfis-data 140/tcp # EMFIS Data Service
+emfis-data 140/udp
+emfis-cntl 141/tcp # EMFIS Control Service
+emfis-cntl 141/udp
+imap 143/tcp imap2 # Internet Message Access Protocol
+imap 143/udp imap2
+uma 144/tcp # Universal Management Architecture
+uma 144/udp
+uaac 145/tcp # UAAC Protocol
+uaac 145/udp
+iso-tp0 146/tcp # ISO-TP0
+iso-tp0 146/udp
+iso-ip 147/tcp # ISO-IP
+iso-ip 147/udp
+jargon 148/tcp # Jargon
+jargon 148/udp
+aed-512 149/tcp # AED 512 Emulation Service
+aed-512 149/udp
+sql-net 150/tcp # SQL-NET
+sql-net 150/udp
+hems 151/tcp # HEMS
+hems 151/udp
+bftp 152/tcp # Background File Transfer Program
+bftp 152/udp
+sgmp 153/tcp # SGMP
+sgmp 153/udp
+netsc-prod 154/tcp # NETSC
+netsc-prod 154/udp
+netsc-dev 155/tcp
+netsc-dev 155/udp
+sqlsrv 156/tcp # SQL Service
+sqlsrv 156/udp
+knet-cmp 157/tcp # KNET/VM Command/Message Protocol
+knet-cmp 157/udp
+pcmail-srv 158/tcp # PCMail Server
+pcmail-srv 158/udp
+nss-routing 159/tcp # NSS-Routing
+nss-routing 159/udp
+sgmp-traps 160/tcp # SGMP-TRAPS
+sgmp-traps 160/udp
+snmp 161/tcp # Simple Net Mgmt Proto
+snmp 161/udp
+snmptrap 162/tcp snmp-trap # Traps for SNMP
+snmptrap 162/udp snmp-trap
+cmip-man 163/tcp # CMIP/TCP Manager
+cmip-man 163/udp
+cmip-agent 164/tcp # CMIP/TCP Agent
+cmip-agent 164/udp
+xns-courier 165/tcp # Xerox
+xns-courier 165/udp
+s-net 166/tcp # Sirius Systems
+s-net 166/udp
+namp 167/tcp # NAMP
+namp 167/udp
+rsvd 168/tcp # RSVD
+rsvd 168/udp
+send 169/tcp # SEND
+send 169/udp
+print-srv 170/tcp # Network PostScript
+print-srv 170/udp
+multiplex 171/tcp # Network Innovations Multiplex
+multiplex 171/udp
+cl/1 172/tcp # Network Innovations CL/1
+cl/1 172/udp
+xyplex-mux 173/tcp # Xyplex
+xyplex-mux 173/udp
+mailq 174/tcp # Mailer transport queue for Zmailer
+mailq 174/udp
+vmnet 175/tcp # VMNET
+vmnet 175/udp
+genrad-mux 176/tcp # GENRAD-MUX
+genrad-mux 176/udp
+xdmcp 177/tcp # X Display Manager Control Protocol
+xdmcp 177/udp
+nextstep 178/tcp NeXTStep NextStep# NextStep Window Server
+nextstep 178/udp NeXTStep NextStep
+bgp 179/tcp # Border Gateway Protocol
+bgp 179/udp
+ris 180/tcp # Intergraph
+ris 180/udp
+unify 181/tcp # Unify
+unify 181/udp
+audit 182/tcp # Unisys Audit SITP
+audit 182/udp
+ocbinder 183/tcp # OCBinder
+ocbinder 183/udp
+ocserver 184/tcp # OCServer
+ocserver 184/udp
+remote-kis 185/tcp # Remote-KIS
+remote-kis 185/udp
+kis 186/tcp # KIS Protocol
+kis 186/udp
+aci 187/tcp # Application Communication Interface
+aci 187/udp
+mumps 188/tcp # Plus Five's MUMPS
+mumps 188/udp
+qft 189/tcp # Queued File Transport
+qft 189/udp
+gacp 190/tcp # Gateway Access Control Protocol
+gacp 190/udp
+prospero 191/tcp # Prospero Directory Service
+prospero 191/udp
+osu-nms 192/tcp # OSU Network Monitoring System
+osu-nms 192/udp
+srmp 193/tcp # Spider Remote Monitoring Protocol
+srmp 193/udp
+irc 194/tcp # Internet Relay Chat Protocol
+irc 194/udp
+dn6-nlm-aud 195/tcp # DNSIX Network Level Module Audit
+dn6-nlm-aud 195/udp
+dn6-smm-red 196/tcp # DNSIX Session Mgt Module Audit Redir
+dn6-smm-red 196/udp
+dls 197/tcp # Directory Location Service
+dls 197/udp
+dls-mon 198/tcp # Directory Location Service Monitor
+dls-mon 198/udp
+smux 199/tcp # SNMP Unix Multiplexer
+smux 199/udp
+src 200/tcp # IBM System Resource Controller
+src 200/udp
+at-rtmp 201/tcp # AppleTalk Routing Maintenance
+at-rtmp 201/udp
+at-nbp 202/tcp # AppleTalk Name Binding
+at-nbp 202/udp
+at-echo 204/tcp # AppleTalk Echo
+at-echo 204/udp
+at-zis 206/tcp # AppleTalk Zone Information
+at-zis 206/udp
+qmtp 209/tcp # The Quick Mail Transfer Protocol
+qmtp 209/udp
+z39.50 210/tcp wais z3950 # ANSI Z39.50
+z39.50 210/udp wais z3950
+914c/g 211/tcp # Texas Instruments 914C/G Terminal
+914c/g 211/udp
+anet 212/tcp # ATEXSSTR
+anet 212/udp
+ipx 213/tcp # IPX
+ipx 213/udp
+imap3 220/tcp # Interactive Mail Access
+imap3 220/udp
+link 245/tcp # ttylink
+link 245/udp
+pawserv 345/tcp # Perf Analysis Workbench
+pawserv 345/udp
+zserv 346/tcp # Zebra server
+zserv 346/udp
+fatserv 347/tcp # Fatmen Server
+fatserv 347/udp
+scoi2odialog 360/tcp # scoi2odialog
+scoi2odialog 360/udp
+semantix 361/tcp # Semantix
+semantix 361/udp
+srssend 362/tcp # SRS Send
+srssend 362/udp
+rsvp_tunnel 363/tcp # RSVP Tunnel
+rsvp_tunnel 363/udp
+aurora-cmgr 364/tcp # Aurora CMGR
+aurora-cmgr 364/udp
+dtk 365/tcp # Deception Tool Kit
+dtk 365/udp
+odmr 366/tcp # ODMR
+odmr 366/udp
+rpc2portmap 369/tcp # Coda portmapper
+rpc2portmap 369/udp
+codaauth2 370/tcp # Coda authentication server
+codaauth2 370/udp
+clearcase 371/tcp # Clearcase
+clearcase 371/udp
+ulistproc 372/tcp ulistserv # UNIX Listserv
+ulistproc 372/udp ulistserv
+ldap 389/tcp # Lightweight Directory Access Protocol
+ldap 389/udp
+imsp 406/tcp # Interactive Mail Support Protocol
+imsp 406/udp
+svrloc 427/tcp # Server Location
+svrloc 427/udp
+mobileip-agent 434/tcp # MobileIP-Agent
+mobileip-agent 434/udp
+mobilip-mn 435/tcp # MobilIP-MN
+mobilip-mn 435/udp
+https 443/tcp # MCom
+https 443/udp
+snpp 444/tcp # Simple Network Paging Protocol
+snpp 444/udp
+microsoft-ds 445/tcp Microsoft-DS
+microsoft-ds 445/udp Microsoft-DS
+kpasswd 464/tcp kpwd # Kerberos "passwd"
+kpasswd 464/udp kpwd
+photuris 468/tcp
+photuris 468/udp
+saft 487/tcp # Simple Asynchronous File Transfer
+saft 487/udp
+gss-http 488/tcp
+gss-http 488/udp
+pim-rp-disc 496/tcp
+pim-rp-disc 496/udp
+isakmp 500/tcp # IPsec - Internet Security Association and Key Management Protocol
+isakmp 500/udp
+exec 512/tcp # remote process execution
+comsat 512/udp biff # notify users of new mail received
+login 513/tcp # remote login a la telnet
+who 513/udp whod # who's logged in to machines
+shell 514/tcp cmd # no passwords used
+syslog 514/udp
+printer 515/tcp spooler # line printer spooler
+printer 515/udp spooler
+videotex 516/tcp
+videotex 516/udp
+talk 517/tcp # like tenex link
+talk 517/udp
+ntalk 518/tcp
+ntalk 518/udp
+utime 519/tcp unixtime
+utime 519/udp unixtime
+efs 520/tcp # extended file name server
+router 520/udp route routed # local routing process
+ripng 521/tcp
+ripng 521/udp
+ulp 522/tcp
+ulp 522/udp
+ibm-db2 523/tcp
+ibm-db2 523/udp
+ncp 524/tcp
+ncp 524/udp
+timed 525/tcp timeserver
+timed 525/udp timeserver
+tempo 526/tcp newdate
+tempo 526/udp newdate
+courier 530/tcp rpc
+courier 530/udp rpc
+conference 531/tcp chat
+conference 531/udp chat
+netnews 532/tcp readnews
+netnews 532/udp readnews
+netwall 533/tcp # -for emergency broadcasts
+netwall 533/udp
+mm-admin 534/tcp # MegaMedia Admin
+mm-admin 534/udp
+iiop 535/tcp
+iiop 535/udp
+opalis-rdv 536/tcp
+opalis-rdv 536/udp
+nmsp 537/tcp # Networked Media Streaming Protocol
+nmsp 537/udp
+gdomap 538/tcp # GNUstep distributed objects
+gdomap 538/udp
+uucp 540/tcp uucpd # uucp daemon
+uucp 540/udp uucpd
+klogin 543/tcp # Kerberized `rlogin' (v5)
+klogin 543/udp
+kshell 544/tcp krcmd # Kerberized `rsh' (v5)
+kshell 544/udp krcmd
+appleqtcsrvr 545/tcp
+appleqtcsrvr 545/udp
+dhcpv6-client 546/tcp # DHCPv6 Client
+dhcpv6-client 546/udp
+dhcpv6-server 547/tcp # DHCPv6 Server
+dhcpv6-server 547/udp
+afpovertcp 548/tcp # AFP over TCP
+afpovertcp 548/udp
+rtsp 554/tcp # Real Time Stream Control Protocol
+rtsp 554/udp
+dsf 555/tcp
+dsf 555/udp
+remotefs 556/tcp rfs_server rfs # Brunhoff remote filesystem
+remotefs 556/udp rfs_server rfs
+nntps 563/tcp snntp # NNTP over SSL
+nntps 563/udp snntp
+9pfs 564/tcp # plan 9 file service
+9pfs 564/udp
+whoami 565/tcp
+whoami 565/udp
+submission 587/tcp # mail message submission
+submission 587/udp
+http-alt 591/tcp # FileMaker, Inc. - HTTP Alternate
+http-alt 591/udp
+nqs 607/tcp # Network Queuing system
+nqs 607/udp
+npmp-local 610/tcp dqs313_qmaster # npmp-local / DQS
+npmp-local 610/udp dqs313_qmaster
+npmp-gui 611/tcp dqs313_execd # npmp-gui / DQS
+npmp-gui 611/udp dqs313_execd
+hmmp-ind 612/tcp dqs313_intercell# HMMP Indication / DQS
+hmmp-ind 612/udp dqs313_intercell
+cryptoadmin 624/tcp # Crypto Admin
+cryptoadmin 624/udp
+dec_dlm 625/tcp # DEC DLM
+dec_dlm 625/udp
+asia 626/tcp
+asia 626/udp
+passgo-tivoli 627/tcp # PassGo Tivoli
+passgo-tivoli 627/udp
+qmqp 628/tcp # Qmail QMQP
+qmqp 628/udp
+3com-amp3 629/tcp
+3com-amp3 629/udp
+rda 630/tcp
+rda 630/udp
+ipp 631/tcp # Internet Printing Protocol
+ipp 631/udp
+ldaps 636/tcp # LDAP over SSL
+ldaps 636/udp
+tinc 655/tcp # TINC control port
+tinc 655/udp
+acap 674/tcp # Application Configuration Access Protocol
+acap 674/udp
+ha-cluster 694/tcp # Heartbeat HA-cluster
+ha-cluster 694/udp
+silc 706/tcp # SILC
+silc 706/udp
+kerberos-adm 749/tcp # Kerberos `kadmin' (v5)
+kerberos-adm 749/udp
+kerberos-iv 750/tcp kerberos4 kdc # Kerberos (server)
+kerberos-iv 750/udp kerberos4 kdc
+webster 765/tcp # Network dictionary
+webster 765/udp
+phonebook 767/tcp # Network phonebook
+phonebook 767/udp
+rsync 873/tcp # rsync
+rsync 873/udp
+ftps-data 989/tcp # ftp protocol, data, over TLS/SSL
+ftps-data 989/udp
+ftps 990/tcp # ftp protocol, control, over TLS/SSL
+ftps 990/udp
+nas 991/tcp # Netnews Administration System
+nas 991/udp
+telnets 992/tcp # telnet protocol over TLS/SSL
+telnets 992/udp
+imaps 993/tcp # imap4 protocol over TLS/SSL
+imaps 993/udp
+ircs 994/tcp # irc protocol over TLS/SSL
+ircs 994/udp
+pop3s 995/tcp # pop3 protocol over TLS/SSL
+pop3s 995/udp
+
+#
+# IANA Assignments [Registered Ports]
+#
+# The Registered Ports are listed by the IANA and on most systems can be
+# used by ordinary user processes or programs executed by ordinary
+# users.
+# Ports are used in the TCP [RFC793] to name the ends of logical
+# connections which carry long term conversations. For the purpose of
+# providing services to unknown callers, a service contact port is
+# defined. This list specifies the port used by the server process as
+# its contact port.
+# The IANA registers uses of these ports as a convenience to the
+# community.
+# To the extent possible, these same port assignments are used with the
+# UDP [RFC768].
+# The Registered Ports are in the range 1024-49151.
+#
+socks 1080/tcp # socks proxy server
+socks 1080/udp
+rmiregistry 1099/tcp # Java RMI Registry
+rmiregistry 1099/udp
+kazaa 1214/tcp # KAZAA
+kazaa 1214/udp
+bvcontrol 1236/tcp rmtcfg # Gracilis Packeten remote config server
+bvcontrol 1236/udp rmtcfg
+nessus 1241/tcp # Nessus vulnerability assessment scanner
+nessus 1241/udp
+h323hostcallsc 1300/tcp # H323 Host Call Secure
+h323hostcallsc 1300/udp
+lotusnote 1352/tcp # Lotus Note
+lotusnote 1352/udp
+ms-sql-s 1433/tcp # Microsoft-SQL-Server
+ms-sql-s 1433/udp
+ms-sql-m 1434/tcp # Microsoft-SQL-Monitor
+ms-sql-m 1434/udp
+ica 1494/tcp # Citrix ICA Client
+ica 1494/udp
+wins 1512/tcp # Microsoft's Windows Internet Name Service
+wins 1512/udp
+ingreslock 1524/tcp
+ingreslock 1524/udp
+prospero-np 1525/tcp # Prospero non-privileged
+prospero-np 1525/udp
+datametrics 1645/tcp old-radius # datametrics / old radius entry
+datametrics 1645/udp old-radius
+sa-msg-port 1646/tcp old-radacct # sa-msg-port / old radacct entry
+sa-msg-port 1646/udp old-radacct
+rsap 1647/tcp
+rsap 1647/udp
+concurrent-lm 1648/tcp
+concurrent-lm 1648/udp
+kermit 1649/tcp
+kermit 1649/udp
+l2tp 1701/tcp
+l2tp 1701/udp
+h323gatedisc 1718/tcp
+h323gatedisc 1718/udp
+h323gatestat 1719/tcp
+h323gatestat 1719/udp
+h323hostcall 1720/tcp
+h323hostcall 1720/udp
+tftp-mcast 1758/tcp
+tftp-mcast 1758/udp
+hello 1789/tcp
+hello 1789/udp
+radius 1812/tcp # Radius
+radius 1812/udp
+radius-acct 1813/tcp radacct # Radius Accounting
+radius-acct 1813/udp radacct
+mtp 1911/tcp # Starlight Networks Multimedia Transport Protocol
+mtp 1911/udp
+unix-status 1957/tcp # remstats unix-status server
+unix-status 1957/udp
+hsrp 1985/tcp # Hot Standby Router Protocol
+hsrp 1985/udp
+licensedaemon 1986/tcp # cisco license management
+licensedaemon 1986/udp
+tr-rsrb-p1 1987/tcp # cisco RSRB Priority 1 port
+tr-rsrb-p1 1987/udp
+tr-rsrb-p2 1988/tcp # cisco RSRB Priority 2 port
+tr-rsrb-p2 1988/udp
+tr-rsrb-p3 1989/tcp # cisco RSRB Priority 3 port
+tr-rsrb-p3 1989/udp
+stun-p1 1990/tcp # cisco STUN Priority 1 port
+stun-p1 1990/udp
+stun-p2 1991/tcp # cisco STUN Priority 2 port
+stun-p2 1991/udp
+stun-p3 1992/tcp # cisco STUN Priority 3 port
+stun-p3 1992/udp
+snmp-tcp-port 1994/tcp # cisco SNMP TCP port
+snmp-tcp-port 1994/udp
+stun-port 1995/tcp # cisco serial tunnel port
+stun-port 1995/udp
+perf-port 1996/tcp # cisco Remote SRB port
+perf-port 1996/udp
+gdp-port 1997/tcp # cisco Gateway Discovery Protocol
+gdp-port 1997/udp
+x25-svc-port 1998/tcp # cisco X.25 service (XOT)
+x25-svc-port 1998/udp
+tcp-id-port 1999/tcp # cisco identification port
+tcp-id-port 1999/udp
+cisco-sccp 2000/tcp sieve # Cisco SCCP
+cisco-sccp 2000/udp sieve
+nfs 2049/tcp # Network File System
+nfs 2049/udp
+rtcm-sc104 2101/tcp # RTCM SC-104
+rtcm-sc104 2101/udp
+zephyr-srv 2102/tcp # Zephyr server
+zephyr-srv 2102/udp
+zephyr-clt 2103/tcp # Zephyr serv-hm connection
+zephyr-clt 2103/udp
+zephyr-hm 2104/tcp # Zephyr hostmanager
+zephyr-hm 2104/udp
+cvspserver 2401/tcp # CVS client/server operations
+cvspserver 2401/udp
+venus 2430/tcp # codacon port
+venus 2430/udp
+venus-se 2431/tcp # tcp side effects
+venus-se 2431/udp
+codasrv 2432/tcp # not used
+codasrv 2432/udp
+codasrv-se 2433/tcp # tcp side effects
+codasrv-se 2433/udp
+mon 2583/tcp
+mon 2583/udp
+hpstgmgr 2600/tcp zebrasrv
+hpstgmgr 2600/udp zebrasrv
+discp-client 2601/tcp zebra # discp client
+discp-client 2601/udp zebra
+discp-server 2602/tcp ripd # discp server
+discp-server 2602/udp ripd
+servicemeter 2603/tcp ripngd # Service Meter
+servicemeter 2603/udp ripngd
+nsc-ccs 2604/tcp ospfd # NSC CCS
+nsc-ccs 2604/udp ospfd
+nsc-posa 2605/tcp bgpd # NSC POSA
+nsc-posa 2605/udp bgpd
+netmon 2606/tcp ospf6d # Dell Netmon
+netmon 2606/udp ospf6d
+connection 2607/tcp # Dell Connection
+connection 2607/udp
+wag-service 2608/tcp # Wag Service
+wag-service 2608/udp
+dict 2628/tcp # Dictionary server
+dict 2628/udp
+corbaloc 2809/tcp # CORBA LOC
+corbaloc 2809/udp
+ndtp 2882/tcp # Network Dictionary Transfer Protocol
+ndtp 2882/udp
+gds_db 3050/tcp # InterBase server
+gds_db 3050/udp
+icpv2 3130/tcp icp # Internet Cache Protocol (Squid)
+icpv2 3130/udp icp
+mysql 3306/tcp # MySQL
+mysql 3306/udp
+trnsprntproxy 3346/tcp # Transparent Proxy
+trnsprntproxy 3346/udp
+ms-wbt-server 3389/tcp rdp # MS WBT Server
+ms-wbt-server 3389/udp rdp # Microsoft Remote Desktop Protocol
+prsvp 3455/tcp # RSVP Port
+prsvp 3455/udp
+nut 3493/tcp # Network UPS Tools
+nut 3493/udp
+distcc 3632/tcp # Distributed Compiler
+distcc 3632/udp
+daap 3689/tcp # Digital Audio Access Protocol
+daap 3689/udp
+svn 3690/tcp # Subversion
+svn 3690/udp
+netboot-pxe 3928/tcp pxe # PXE NetBoot Manager
+netboot-pxe 3928/udp pxe
+smauth-port 3929/tcp # AMS Port
+smauth-port 3929/udp
+pxc-spvr-ft 4002/tcp pxc-spvr-ft
+pxc-spvr-ft 4002/udp pxc-spvr-ft
+pxc-splr-ft 4003/tcp pxc-splr-ft rquotad
+pxc-splr-ft 4003/udp pxc-splr-ft rquotad
+pxc-roid 4004/tcp pxc-roid
+pxc-roid 4004/udp pxc-roid
+pxc-pin 4005/tcp pxc-pin
+pxc-pin 4005/udp pxc-pin
+pxc-spvr 4006/tcp pxc-spvr
+pxc-spvr 4006/udp pxc-spvr
+pxc-splr 4007/tcp pxc-splr
+pxc-splr 4007/udp pxc-splr
+rwhois 4321/tcp # Remote Who Is
+rwhois 4321/udp
+krb524 4444/tcp
+krb524 4444/udp
+hylafax 4559/tcp # HylaFAX client-server protocol (new)
+hylafax 4559/udp
+piranha1 4600/tcp
+piranha1 4600/udp
+radmin-port 4899/tcp # RAdmin Port
+radmin-port 4899/udp
+rfe 5002/tcp # Radio Free Ethernet
+rfe 5002/udp
+ita-agent 5051/tcp # ITA Agent
+ita-agent 5051/udp
+xmpp-client 5222/tcp # XMPP Client Connection
+xmpp-client 5222/udp
+xmpp-server 5269/tcp # XMPP Server Connection
+xmpp-server 5269/udp
+cfengine 5308/tcp # CFengine
+cfengine 5308/udp
+postgresql 5432/tcp # POSTGRES
+postgresql 5432/udp
+sgi-eventmond 5553/tcp # SGI Eventmond Port
+sgi-eventmond 5553/udp
+sgi-esphttp 5554/tcp # SGI ESP HTTP
+sgi-esphttp 5554/udp
+cvsup 5999/tcp # CVSup
+cvsup 5999/udp
+x11 6000/tcp # X Window System
+x11 6000/udp
+gnutella-svc 6346/tcp
+gnutella-svc 6346/udp
+gnutella-rtr 6347/tcp
+gnutella-rtr 6347/udp
+sane-port 6566/tcp # SANE Network Scanner Control Port
+sane-port 6566/udp
+afs3-fileserver 7000/tcp bbs # file server itself
+afs3-fileserver 7000/udp bbs
+afs3-callback 7001/tcp # callbacks to cache managers
+afs3-callback 7001/udp
+afs3-prserver 7002/tcp # users & groups database
+afs3-prserver 7002/udp
+afs3-vlserver 7003/tcp # volume location database
+afs3-vlserver 7003/udp
+afs3-kaserver 7004/tcp # AFS/Kerberos authentication
+afs3-kaserver 7004/udp
+afs3-volser 7005/tcp # volume managment server
+afs3-volser 7005/udp
+afs3-errors 7006/tcp # error interpretation service
+afs3-errors 7006/udp
+afs3-bos 7007/tcp # basic overseer process
+afs3-bos 7007/udp
+afs3-update 7008/tcp # server-to-server updater
+afs3-update 7008/udp
+afs3-rmtsys 7009/tcp # remote cache manager service
+afs3-rmtsys 7009/udp
+font-service 7100/tcp xfs # X Font Service
+font-service 7100/udp xfs
+http-alt 8008/tcp # HTTP Alternate
+http-alt 8008/udp
+http-alt 8080/tcp # HTTP Alternate
+http-alt 8080/udp
+bacula-dir 9101/tcp # Bacula Director
+bacula-dir 9101/udp
+bacula-fd 9102/tcp # Bacula File Daemon
+bacula-fd 9102/udp
+bacula-sd 9103/tcp # Bacula Storage Daemon
+bacula-sd 9103/udp
+sd 9876/tcp # Session Director
+sd 9876/udp
+cyborg-systems 9888/tcp # CYBORG Systems
+cyborg-systems 9888/udp
+monkeycom 9898/tcp # MonkeyCom
+monkeycom 9898/udp
+amanda 10080/tcp # amanda backup services
+amanda 10080/udp
+smsqp 11201/tcp # Alamin SMS gateway
+smsqp 11201/udp
+hkp 11371/tcp # OpenPGP HTTP Keyserver
+hkp 11371/udp
+h323callsigalt 11720/tcp # h323 Call Signal Alternate
+h323callsigalt 11720/udp
+bprd 13720/tcp # BPRD Protocol (VERITAS NetBackup)
+bprd 13720/udp
+bpdbm 13721/tcp # BPDBM Protocol (VERITAS NetBackup)
+bpdbm 13721/udp
+bpjava-msvc 13722/tcp # BP Java MSVC Protocol
+bpjava-msvc 13722/udp
+vnetd 13724/tcp # Veritas Network Utility
+vnetd 13724/udp
+bpcd 13782/tcp # VERITAS NetBackup
+bpcd 13782/udp
+vopied 13783/tcp # VOPIED Protocol
+vopied 13783/udp
+xpilot 15345/tcp # XPilot Contact Port
+xpilot 15345/udp
+wnn6 22273/tcp # wnn6
+wnn6 22273/udp
+binkp 24554/tcp # Bink fidonet protocol
+binkp 24554/udp
+quake 26000/tcp # Quake @!#
+quake 26000/udp
+wnn6-ds 26208/tcp
+wnn6-ds 26208/udp
+traceroute 33434/tcp # traceroute use
+traceroute 33434/udp
+
+#=========================================================================
+# The remaining port numbers are not as allocated by IANA.
+
+# Kerberos (Project Athena/MIT) services
+# Note that these are for Kerberos v4, and are unofficial
+kerberos_master 751/tcp # Kerberos authentication
+kerberos_master 751/udp
+passwd_server 752/tcp # Kerberos passwd server
+passwd_server 752/udp
+krb_prop 754/tcp # Kerberos slave propagation
+krbupdate 760/tcp kreg # Kerberos registration
+kpop 1109/tcp # Pop with Kerberos
+knetd 2053/tcp # Kerberos de-multiplexor
+eklogin 2105/tcp # Kerberos encrypted rlogin
+
+# CVSup support http://www.cvsup.org/
+supfilesrv 871/tcp # SUP server
+supfiledbg 1127/tcp # SUP debugging
+
+# Datagram Delivery Protocol services
+rtmp 1/ddp # Routing Table Maintenance Protocol
+nbp 2/ddp # Name Binding Protocol
+echo 4/ddp # AppleTalk Echo Protocol
+zip 6/ddp # Zone Information Protocol
+
+# Many services now accepted as 'standard'
+linuxconf 98/tcp # LinuxConf
+smtps 465/tcp ssmtp # smtp protocol over TLS/SSL
+smtps 465/udp ssmtp
+swat 901/tcp # Samba configuration tool
+rndc 953/tcp # rndc control sockets (BIND 9)
+rndc 953/udp
+skkserv 1178/tcp # SKK Japanese input method
+xtel 1313/tcp # french minitel
+support 1529/tcp # GNATS
+cfinger 2003/tcp lmtp # GNU Finger
+ninstall 2150/tcp # ninstall service
+ninstall 2150/udp
+afbackup 2988/tcp # Afbackup system
+afbackup 2988/udp
+fax 4557/tcp # FAX transmission service (old)
+noclog 5354/tcp # noclogd with TCP (nocol)
+noclog 5354/udp
+hostmon 5355/tcp # hostmon uses TCP (nocol)
+hostmon 5355/udp
+rplay 5555/tcp # RPlay audio service
+rplay 5555/udp
+canna 5680/tcp # Canna (Japanese Input)
+x11-ssh 6010/tcp x11-ssh-offset
+x11-ssh 6010/udp x11-ssh-offset
+ircd 6667/tcp # Internet Relay Chat
+ircd 6667/udp
+webcache 8080/tcp # WWW caching service
+webcache 8080/udp
+tproxy 8081/tcp # Transparent Proxy
+tproxy 8081/udp
+jetdirect 9100/tcp #HP JetDirect card
+jetdirect 9100/udp
+mandelspawn 9359/udp mandelbrot # network mandelbrot
+kamanda 10081/tcp # amanda backup services (Kerberos)
+kamanda 10081/udp
+amandaidx 10082/tcp # amanda backup services
+amidxtape 10083/tcp # amanda backup services
+isdnlog 20011/tcp # isdn logging system
+isdnlog 20011/udp
+vboxd 20012/tcp # voice box system
+vboxd 20012/udp
+wnn4_Cn 22289/tcp wnn6_Cn # Wnn (Chinese input)
+wnn4_Kr 22305/tcp wnn6_Kr # Wnn (Korean input)
+wnn4_Tw 22321/tcp wnn6_Tw # Wnn (Taiwanse input)
+asp 27374/tcp # Address Search Protocol
+asp 27374/udp
+tfido 60177/tcp # Ifmail
+tfido 60177/udp
+fido 60179/tcp # Ifmail
+fido 60179/udp
+
+# Local services
+
diff --git a/etc/shadow b/etc/shadow
new file mode 100644
index 0000000..03ecc34
--- /dev/null
+++ b/etc/shadow
@@ -0,0 +1,18 @@
+root:*:10770:0:::::
+halt:*:9797:0:::::
+operator:*:9797:0:::::
+shutdown:*:9797:0:::::
+sync:*:9797:0:::::
+bin:*:9797:0:::::
+ftp:*:9797:0:::::
+daemon:*:9797:0:::::
+adm:*:9797:0:::::
+lp:*:9797:0:::::
+mail:*:9797:0:::::
+postmaster:*:9797:0:::::
+news:*:9797:0:::::
+uucp:*:9797:0:::::
+man:*:9797:0:::::
+games:*:9797:0:::::
+guest:*:9797:0:::::
+nobody:*:9797:0:::::
diff --git a/etc/shells b/etc/shells
new file mode 100644
index 0000000..41347b5
--- /dev/null
+++ b/etc/shells
@@ -0,0 +1,9 @@
+# /etc/shells: valid login shells
+/bin/sh
+/bin/bash
+/bin/tcsh
+/bin/csh
+/bin/esh
+/bin/ksh
+/bin/zsh
+/bin/sash
diff --git a/etc/sysctl.conf b/etc/sysctl.conf
new file mode 100644
index 0000000..973c6b3
--- /dev/null
+++ b/etc/sysctl.conf
@@ -0,0 +1,48 @@
+# /etc/sysctl.conf
+#
+# For more information on how this file works, please see
+# the manpages sysctl(8) and sysctl.conf(5).
+#
+# In order for this file to work properly, you must first
+# enable 'Sysctl support' in the kernel.
+#
+# Look in /proc/sys/ for all the things you can setup.
+#
+
+# Disables packet forwarding
+#net.ipv4.ip_forward = 0
+# Disables IP dynaddr
+#net.ipv4.ip_dynaddr = 0
+# Disable ECN
+#net.ipv4.tcp_ecn = 0
+# Enables source route verification
+net.ipv4.conf.default.rp_filter = 1
+# Enable reverse path
+net.ipv4.conf.all.rp_filter = 1
+
+# Disable source route
+#net.ipv4.conf.all.accept_source_route = 0
+#net.ipv4.conf.default.accept_source_route = 0
+
+# Disable redirects
+#net.ipv4.conf.all.accept_redirects = 0
+#net.ipv4.conf.default.accept_redirects = 0
+
+# Disable secure redirects
+#net.ipv4.conf.all.secure_redirects = 0
+#net.ipv4.conf.default.secure_redirects = 0
+
+# Ignore ICMP broadcasts
+#net.ipv4.icmp_echo_ignore_broadcasts = 1
+
+# Disables the magic-sysrq key
+#kernel.sysrq = 0
+# When the kernel panics, automatically reboot in 3 seconds
+#kernel.panic = 3
+# Allow for more PIDs (cool factor!); may break some programs
+#kernel.pid_max = 999999
+
+# TCP Port for lock manager
+#fs.nfs.nlm_tcpport = 0
+# UDP Port for lock manager
+#fs.nfs.nlm_udpport = 0
diff --git a/init.d/bootmisc b/init.d/bootmisc
new file mode 100755
index 0000000..ad7637f
--- /dev/null
+++ b/init.d/bootmisc
@@ -0,0 +1,141 @@
+#!/sbin/runscript
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ use clock hostname
+ need localmount
+ before logger
+}
+
+start() {
+ [[ ${BOOT} != "yes" ]] && return 0
+
+ #
+ # Put a nologin file in /etc to prevent people from logging in before
+ # system startup is complete.
+ #
+ if [[ ${DELAYLOGIN} == "yes" ]] ; then
+ echo "System bootup in progress - please wait" > /etc/nologin
+ cp /etc/nologin /etc/nologin.boot &> /dev/null
+ fi
+
+ if [[ -e /etc/sysctl.conf ]] ; then
+ ebegin "Configuring kernel parameters"
+ /sbin/sysctl -q -p /etc/sysctl.conf
+ eend 0
+ fi
+
+ if [[ -z ${CDBOOT} ]] && ! touch /var/run/.keep 2> /dev/null ; then
+ ewarn "Skipping /var and /tmp initialization (ro root?)"
+ return 0
+ fi
+
+ if [[ -x /sbin/env-update.sh ]] ; then
+ ebegin "Updating environment"
+ /sbin/env-update.sh -u > /dev/null
+ eend 0
+ fi
+
+ #
+ # Take care of random stuff [ /var/lock | /var/run | pam ]
+ #
+
+ if [[ -d /var/lib/net-scripts/state ]] ; then
+ ebegin "Cleaning /var/lib/net-scripts/state"
+ rm -rf /var/lib/net-scripts/state/*
+ eend 0
+ fi
+
+ ebegin "Cleaning /var/lock, /var/run"
+ rm -rf /var/run/console.lock /var/run/console/*
+
+ if [[ -z ${CDBOOT} ]] ; then
+ #
+ # Clean up any stale locks.
+ #
+ find /var/lock -type f -print0 | xargs -0 rm -f --
+ #
+ # Clean up /var/run and create /var/run/utmp so that we can login.
+ #
+ for x in $(find /var/run/ ! -type d ! -name utmp ! -name innd.pid ! -name random-seed) ; do
+ local daemon=${x##*/}
+ daemon=${daemon%*.pid}
+ # Do not remove pidfiles of already running daemons
+ if [[ -z $(ps --no-heading -C "${daemon}") ]] ; then
+ if [[ -f ${x} || -L ${x} ]] ; then
+ rm -f "${x}"
+ fi
+ fi
+ done
+ fi
+
+ # Reset pam_console permissions if we are actually using it
+ if [[ -x /sbin/pam_console_apply && ! -c /dev/.devfsd && \
+ -n $(grep -v -e '^[[:space:]]*#' /etc/pam.d/* | grep 'pam_console') ]] ; then
+ /sbin/pam_console_apply -r
+ fi
+
+ # Create the .keep to stop portage from removing /var/lock
+ > /var/lock/.keep
+ eend 0
+
+ #
+ # Clean up /tmp directory
+ #
+ if [[ -z ${CDBOOT} ]] && [[ -d /tmp ]] ; then
+ cd /tmp
+ if [[ ${WIPE_TMP} == "yes" ]] ; then
+ ebegin "Wiping /tmp directory"
+ # This eval stuff sucks, so if someone has a better *working*
+ # solution, please file a bug at http://bugs.gentoo.org/
+ # Originally ripped from Debian init scripts
+ local exceptions="
+ '!' -name . -a
+ '!' '(' -uid 0 -a
+ '('
+ -path './lost+found/*' -o
+ -path './quota.user/*' -o
+ -path './aquota.user/*' -o
+ -path './quota.group/*' -o
+ -path './aquota.group/*' -o
+ -path './.journal/*'
+ ')'
+ ')'"
+ # First kill most files, then kill empty dirs
+ eval find . -xdev -depth ${exceptions} ! -type d -print0 | xargs -0 rm -f --
+ eval find . -xdev -depth ${exceptions} -type d -empty -exec rmdir '{}' \\';'
+ eend 0
+ else
+ ebegin "Cleaning /tmp directory"
+ (
+ rm -f /tmp/.X*-lock /tmp/esrv* /tmp/kio* /tmp/jpsock.* /tmp/.fam*
+ rm -rf /tmp/.esd* /tmp/orbit-* /tmp/ssh-* /tmp/ksocket-* /tmp/.*-unix
+ ) &> /dev/null
+ eend 0
+ fi
+
+ (
+ # Make sure our X11 stuff have the correct permissions
+ mkdir -p /tmp/.{ICE,X11}-unix
+ chown 0:0 /tmp/.{ICE,X11}-unix
+ chmod 1777 /tmp/.{ICE,X11}-unix
+ [[ -x /sbin/restorecon ]] && restorecon /tmp/.{ICE,X11}-unix
+ ) &> /dev/null
+ fi
+
+ #
+ # Create an 'after-boot' dmesg log
+ #
+ touch /var/log/dmesg
+ chmod 640 /var/log/dmesg
+ dmesg > /var/log/dmesg
+
+ #
+ # Check for /etc/resolv.conf, and create if missing
+ #
+ [[ -f /etc/resolv.conf ]] || touch /etc/resolv.conf &> /dev/null
+}
+
+
+# vim:ts=4
diff --git a/init.d/checkfs b/init.d/checkfs
new file mode 100755
index 0000000..dbdfd0a
--- /dev/null
+++ b/init.d/checkfs
@@ -0,0 +1,54 @@
+#!/sbin/runscript
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ need checkroot modules
+}
+
+start() {
+ local retval=0
+
+ # Start RAID/LVM/EVMS/DM volumes for /usr, /var, etc.
+ # NOTE: this should be done *before* mounting anything
+ [[ -z ${CDBOOT} ]] && start_volumes
+
+ # Setup dm-crypt mappings if any
+ start_addon dm-crypt
+
+ if [[ -f /fastboot ]] || [[ -n ${CDBOOT} ]] ; then
+ rm -f /fastboot
+ else
+ ebegin "Checking all filesystems"
+ if [[ -f /forcefsck ]] ; then
+ ewarn "A full fsck has been forced"
+ fsck -C -R -A -a -f
+ retval=$?
+ rm -f /forcefsck
+ else
+ fsck -C -T -R -A -a
+ retval=$?
+ fi
+ if [[ ${retval} -eq 0 ]] ; then
+ eend 0
+ elif [[ ${retval} -ge 1 && ${retval} -le 3 ]] ; then
+ ewend 1 "Filesystem errors corrected."
+ # Everything should be ok, so return a pass
+ return 0
+ else
+ if [[ ${RC_FORCE_AUTO} == "yes" ]] ; then
+ eend 2 "Fsck could not correct all errors, rerunning"
+ fsck -C -T -R -A -a -y
+ retval=$?
+ fi
+
+ if [[ ${retval} -gt 3 ]] ; then
+ eend 2 "Fsck could not correct all errors, manual repair needed"
+ /sbin/sulogin ${CONSOLE}
+ fi
+ fi
+ fi
+}
+
+
+# vim:ts=4
diff --git a/init.d/checkroot b/init.d/checkroot
new file mode 100755
index 0000000..613f88a
--- /dev/null
+++ b/init.d/checkroot
@@ -0,0 +1,124 @@
+#!/sbin/runscript
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ before *
+}
+
+start() {
+ local retval=0
+
+ if [[ ! -f /fastboot && -z ${CDBOOT} ]] && ! is_net_fs / ; then
+ if touch -c / >& /dev/null ; then
+ ebegin "Remounting root filesystem read-only"
+ mount -n -o remount,ro /
+ eend $?
+ fi
+
+ if [[ -f /forcefsck ]] || get_bootparam "forcefsck" ; then
+ ebegin "Checking root filesystem (full fsck forced)"
+ fsck -C -a -f /
+ # /forcefsck isn't deleted because checkfs needs it.
+ # it'll be deleted in that script.
+ retval=$?
+ else
+ # Obey the fs_passno setting for / (see fstab(5))
+ # - find the / entry
+ # - make sure we have 6 fields
+ # - see if fs_passno is something other than 0
+ if [[ -n $(awk '($1 ~ /^(\/|UUID|LABEL)/ && $2 == "/" \
+ && NF == 6 && $6 != 0) { print }' /etc/fstab) ]]
+ then
+ ebegin "Checking root filesystem"
+ fsck -C -T -a /
+ retval=$?
+ else
+ ebegin "Skipping root filesystem check (fstab's passno == 0)"
+ retval=0
+ fi
+ fi
+
+ if [[ ${retval} -eq 0 ]] ; then
+ eend 0
+ elif [[ ${retval} -eq 1 ]] ; then
+ ewend 1 "Filesystem repaired"
+ elif [[ ${retval} -eq 2 || ${retval} -eq 3 ]] ; then
+ ewend 1 "Filesystem repaired, but reboot needed!"
+ echo -ne "\a"; sleep 1; echo -ne "\a"; sleep 1
+ echo -ne "\a"; sleep 1; echo -ne "\a"; sleep 1
+ ewarn "Rebooting in 10 seconds ..."
+ sleep 10
+ einfo "Rebooting"
+ /sbin/reboot -f
+ else
+ if [[ ${RC_FORCE_AUTO} == "yes" ]] ; then
+ eend 2 "Rerunning fsck in force mode"
+ fsck -y -C -T -a /
+ else
+ eend 2 "Filesystem couldn't be fixed :("
+ /sbin/sulogin ${CONSOLE}
+ fi
+ einfo "Unmounting filesystems"
+ /bin/mount -a -o remount,ro &> /dev/null
+ einfo "Rebooting"
+ /sbin/reboot -f
+ fi
+ fi
+
+ # Should we mount root rw ?
+ if mount -vf -o remount / 2> /dev/null | \
+ awk '{ if ($6 ~ /rw/) exit 0; else exit 1; }'
+ then
+ ebegin "Remounting root filesystem read/write"
+ mount -n -o remount,rw / &> /dev/null
+ if [[ $? -ne 0 ]] ; then
+ eend 2 "Root filesystem could not be mounted read/write :("
+ if [[ ${RC_FORCE_AUTO} != "yes" ]] ; then
+ /sbin/sulogin ${CONSOLE}
+ fi
+ else
+ eend 0
+ fi
+ fi
+
+ if [[ ${BOOT} == "yes" ]] ; then
+ local x=
+ local y=
+
+ #
+ # Create /etc/mtab
+ #
+
+ # Don't create mtab if /etc is readonly
+ if ! touch /etc/mtab 2> /dev/null ; then
+ ewarn "Skipping /etc/mtab initialization (ro root?)"
+ return 0
+ fi
+
+ # Clear the existing mtab
+ > /etc/mtab
+
+ # Add the entry for / to mtab
+ mount -f /
+
+ # Don't list root more than once
+ awk '$2 != "/" {print}' /proc/mounts >> /etc/mtab
+
+ # Now make sure /etc/mtab have additional info (gid, etc) in there
+ for x in $(awk '{ print $2 }' /proc/mounts | sort -u) ; do
+ for y in $(awk '{ print $2 }' /etc/fstab) ; do
+ if [[ ${x} == ${y} ]] ; then
+ mount -f -o remount $x
+ continue
+ fi
+ done
+ done
+
+ # Remove stale backups
+ rm -f /etc/mtab~ /etc/mtab~~
+ fi
+}
+
+
+# vim:ts=4
diff --git a/init.d/clock b/init.d/clock
new file mode 100755
index 0000000..2ce9616
--- /dev/null
+++ b/init.d/clock
@@ -0,0 +1,144 @@
+#!/sbin/runscript
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+opts="save"
+
+depend() {
+ need localmount
+}
+
+setupopts() {
+ if is_uml_sys ; then
+ TBLURB="UML"
+ fakeit=1
+ elif is_vserver_sys ; then
+ TBLURB="VServer"
+ fakeit=1
+ elif is_xenU_sys ; then
+ TBLURB="xen"
+ fakeit=1
+ elif grep -q ' cobd$' /proc/devices ; then
+ TBLURB="coLinux"
+ fakeit=1
+ elif [[ ${CLOCK} == "UTC" ]] ; then
+ myopts="--utc"
+ TBLURB="UTC"
+ else
+ myopts="--localtime"
+ TBLURB="Local Time"
+ fi
+ [[ ${fakeit} -eq 1 ]] && return 0
+
+ if [[ ${readonly} == "yes" ]] ; then
+ myadj="--noadjfile"
+ else
+ myadj="--adjust"
+ fi
+
+ if [[ ${SRM} == "yes" ]] ; then
+ myopts="${myopts} --srm"
+ fi
+ if [[ ${ARC} == "arc" ]] ; then
+ myopts="${myopts} --arc"
+ fi
+ myopts="${myopts} ${CLOCK_OPTS}"
+
+ # Make sure user isn't using rc.conf anymore.
+ if grep -qs ^CLOCK= /etc/rc.conf ; then
+ ewarn "CLOCK should not be set in /etc/rc.conf but in /etc/conf.d/clock"
+ fi
+}
+
+start() {
+ local myopts=""
+ local myadj=""
+ local TBLURB="" fakeit=0
+ local errstr=""
+ local readonly="no"
+ local ret=0
+
+ if ! touch /etc/adjtime 2>/dev/null ; then
+ readonly="yes"
+ elif [[ ! -s /etc/adjtime ]] ; then
+ echo "0.0 0 0.0" > /etc/adjtime
+ fi
+
+ setupopts
+
+ if [[ ${fakeit} -ne 1 && ! -e /dev/rtc ]] ; then
+ local x
+ einfon "Waiting for /dev/rtc to appear"
+ for x in $(seq 10) ; do
+ if [[ ! -e /dev/rtc ]] ; then
+ echo -n "."
+ sleep 1
+ else
+ echo
+ fi
+ done
+ fi
+
+ ebegin "Setting system clock to hardware clock [${TBLURB}]"
+ if [[ ${fakeit} -eq 1 ]] ; then
+ ret=0
+
+ elif [[ -x /sbin/hwclock ]] ; then
+ # Since hwclock always exit's with a 0, need to check its output.
+ errstr=$(/sbin/hwclock ${myadj} ${myopts} 2>&1 >/dev/null)
+ errstr="${errstr}$(/sbin/hwclock --hctosys ${myopts} 2>&1 >/dev/null)"
+
+ if [[ -n ${errstr} ]] ; then
+ ewarn "${errstr}"
+ ret=1
+ else
+ ret=0
+ fi
+ errstr="Failed to set system clock to hardware clock"
+ else
+ ret=1
+ errstr="/sbin/hwclock not found"
+ fi
+ eend ${ret} "${errstr}"
+}
+
+stop() {
+ # Don't tweak the hardware clock on LiveCD halt.
+ [[ -n ${CDBOOT} ]] && return 0
+
+ [[ ${CLOCK_SYSTOHC} != "yes" ]] && return 0
+
+ local myopts=""
+ local TBLURB=""
+ local errstr=""
+ local ret=0
+
+ setupopts
+
+ ebegin "Syncing system clock to hardware clock [${TBLURB}]"
+ if [[ ${fakeit} -eq 1 ]] ; then
+ ret=0
+
+ elif [[ -x /sbin/hwclock ]] ; then
+ errstr=$(/sbin/hwclock --systohc ${myopts} 2>&1 >/dev/null)
+
+ if [[ -n ${errstr} ]] ; then
+ ret=1
+ else
+ ret=0
+ fi
+ errstr="Failed to sync clocks"
+ else
+ ret=1
+ errstr="/sbin/hwclock not found"
+ fi
+ eend ${ret} "${errstr}"
+}
+
+save() {
+ CLOCK_SYSTOHC="yes"
+ stop
+}
+
+
+# vim:ts=4
diff --git a/init.d/consolefont b/init.d/consolefont
new file mode 100755
index 0000000..35daa11
--- /dev/null
+++ b/init.d/consolefont
@@ -0,0 +1,68 @@
+#!/sbin/runscript
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ need localmount
+ need keymaps # sets up terminal encoding scheme
+ after hotplug
+}
+
+start() {
+ if is_uml_sys ; then
+ ebegin "Setting user font"
+ eend 0
+ return 0
+ elif [[ -z ${CONSOLEFONT} ]] ; then
+ ebegin "Using the default console font"
+ eend 0
+ return 0
+ fi
+
+ local x=
+ local param=
+ local sf_param=
+ local retval=1
+
+ # Get additional parameters
+ if [[ -n ${CONSOLETRANSLATION} ]] ; then
+ param="-m ${CONSOLETRANSLATION}"
+ fi
+
+ # Set the console font
+ local errmsg=""
+ ebegin "Setting user font"
+ if [[ -x /bin/setfont ]] ; then
+ # We patched setfont to have --tty support ...
+ if [[ -n $(setfont --help 2>&1 | grep -e '--tty') || \
+ -n $(setfont --help 2>&1 | grep -e '-C') ]]
+ then
+ if [[ -n $(setfont --help 2>&1 | grep -e '--tty') ]] ; then
+ sf_param="--tty="
+ else
+ sf_param="-C "
+ fi
+ local ttydev=
+ [[ -d /dev/vc ]] \
+ && ttydev=/dev/vc/ \
+ || ttydev=/dev/tty
+
+ for x in $(seq 1 "${RC_TTY_NUMBER}") ; do
+ /bin/setfont ${CONSOLEFONT} ${param} \
+ ${sf_param}/${ttydev}${x} > /dev/null
+ retval=$?
+ done
+ else
+ /bin/setfont ${CONSOLEFONT} ${param} > /dev/null
+ retval=$?
+ fi
+ errmsg="Failed to set user font"
+ else
+ retval=1
+ errmsg="/bin/setfont not found"
+ fi
+ eend ${retval} "${errmsg}"
+}
+
+
+# vim:ts=4
diff --git a/init.d/domainname b/init.d/domainname
new file mode 100755
index 0000000..aa5fbc7
--- /dev/null
+++ b/init.d/domainname
@@ -0,0 +1,60 @@
+#!/sbin/runscript
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ need checkroot hostname
+ before bootmisc
+}
+
+checkconfig_nis() {
+ if [[ -f /etc/nisdomainname ]] ; then
+ ewarn "You should stop using /etc/nisdomainname and use /etc/conf.d/domainname"
+ export NISDOMAIN=$(</etc/nisdomainname)
+ return 0
+ fi
+ [[ -n ${NISDOMAIN} ]]
+}
+
+checkconfig_dns() {
+ if [[ -f /etc/dnsdomainname ]] ; then
+ ewarn "You should stop using /etc/dnsdomainname and use /etc/conf.d/domainname"
+ export DNSDOMAIN=$(</etc/dnsdomainname)
+ fi
+ [[ -z ${DNSDOMAIN} ]] && return 1
+
+ if ! touch /etc/resolv.conf 2> /dev/null ; then
+ ewarn "Unable to set domain in resolv.conf (ro root?)"
+ return 1
+ else
+ return 0
+ fi
+}
+
+start() {
+ local retval=0
+ local retval2=0
+
+ if checkconfig_nis ; then
+ ebegin "Setting NIS domainname to ${NISDOMAIN}"
+ /bin/domainname "${NISDOMAIN}"
+ retval=$?
+ eend ${retval} "Failed to set the NIS domainname"
+ fi
+
+ if checkconfig_dns ; then
+ ebegin "Setting DNS domainname to ${DNSDOMAIN}"
+ resolv=$(grep -v '^[[:space:]]*domain' /etc/resolv.conf)
+ [[ ${OVERRIDE} == "1" ]] \
+ && resolv="${resolv}"$'\n'"domain ${DNSDOMAIN}" \
+ || resolv="domain ${DNSDOMAIN}"$'\n'"${resolv}"
+ echo "${resolv}" > /etc/resolv.conf
+ retval2=$?
+ eend ${retval2} "Failed to set the DNS domainname"
+ fi
+
+ return $((retval + retval2))
+}
+
+
+# vim:ts=4
diff --git a/init.d/halt.sh b/init.d/halt.sh
new file mode 100755
index 0000000..1d7a670
--- /dev/null
+++ b/init.d/halt.sh
@@ -0,0 +1,242 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# Check to see if this is a livecd, if it is read the commandline
+# this mainly makes sure $CDBOOT is defined if it's a livecd
+[[ -f /sbin/livecd-functions.sh ]] && \
+ source /sbin/livecd-functions.sh && \
+ livecd_read_commandline
+
+# Reset pam_console permissions if we are actually using it
+if [[ -x /sbin/pam_console_apply && ! -c /dev/.devfsd && \
+ -n $(grep -v -e '^[[:space:]]*#' /etc/pam.d/* | grep 'pam_console') ]]; then
+ /sbin/pam_console_apply -r
+fi
+
+# We need to properly terminate devfsd to save the permissions
+if [[ -n $(ps --no-heading -C 'devfsd') ]]; then
+ ebegin "Stopping devfsd"
+ killall -15 devfsd &>/dev/null
+ eend $?
+elif [[ ! -e /dev/.devfsd && -e /dev/.udev && -z ${CDBOOT} && \
+ ${RC_DEVICE_TARBALL} == "yes" ]] && \
+ touch /lib/udev-state/devices.tar.bz2 2>/dev/null
+then
+ ebegin "Saving device nodes"
+ # Handle our temp files
+ devices_udev=$(mktemp /tmp/devices.udev.XXXXXX)
+ devices_real=$(mktemp /tmp/devices.real.XXXXXX)
+ devices_totar=$(mktemp /tmp/devices.totar.XXXXXX)
+ device_tarball=$(mktemp /tmp/devices-XXXXXX)
+
+ if [[ -z ${devices_udev} || -z ${devices_real} || \
+ -z ${device_tarball} ]]; then
+ eend 1 "Could not create temporary files!"
+ else
+ cd /dev
+ # Find all devices
+ find . -xdev -type b -or -type c -or -type l | cut -d/ -f2- > \
+ "${devices_real}"
+ # Figure out what udev created
+ eval $(grep '^[[:space:]]*udev_db=' /etc/udev/udev.conf)
+ if [[ -d ${udev_db} ]]; then
+ # New udev_db is clear text ...
+ udevinfo=$(cat "${udev_db}"/*)
+ else
+ # Old one is not ...
+ udevinfo=$(udevinfo -d)
+ fi
+ # This basically strips 'S:' and 'N:' from the db output, and then
+ # print all the nodes/symlinks udev created ...
+ echo "${udevinfo}" | gawk '
+ /^(N|S):.+/ {
+ sub(/^(N|S):/, "")
+ split($0, nodes)
+ for (x in nodes)
+ print nodes[x]
+ }' > "${devices_udev}"
+ # These ones we also do not want in there
+ for x in MAKEDEV core fd initctl pts shm stderr stdin stdout; do
+ echo "${x}" >> "${devices_udev}"
+ done
+ fgrep -x -v -f "${devices_udev}" < "${devices_real}" > "${devices_totar}"
+ # Now only tarball those not created by udev if we have any
+ if [[ -s ${devices_totar} ]]; then
+ try tar --one-file-system -jcpf "${device_tarball}" -T "${devices_totar}"
+ try mv -f "${device_tarball}" /lib/udev-state/devices.tar.bz2
+ try rm -f "${devices_udev}" "${devices_real}"
+ else
+ rm -f /lib/udev-state/devices.tar.bz2
+ fi
+ eend 0
+ fi
+fi
+
+# Try to unmount all tmpfs filesystems not in use, else a deadlock may
+# occure, bug #13599.
+umount -at tmpfs &>/dev/null
+
+if [[ -n $(swapon -s 2>/dev/null) ]]; then
+ ebegin "Deactivating swap"
+ swapoff -a
+ eend $?
+fi
+
+# Write a reboot record to /var/log/wtmp before unmounting
+
+halt -w &>/dev/null
+
+# Unmounting should use /proc/mounts and work with/without devfsd running
+
+# Credits for next function to unmount loop devices, goes to:
+#
+# Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org>
+# Modified for RHS Linux by Damien Neil
+#
+#
+# Unmount file systems, killing processes if we have to.
+# Unmount loopback stuff first
+# Use `umount -d` to detach the loopback device
+
+# Remove loopback devices started by dm-crypt
+
+remaining=$(awk '!/^#/ && $1 ~ /^\/dev\/loop/ && $2 != "/" {print $2}' /proc/mounts | \
+ sort -r | grep -v '/newroot' | grep -v '/mnt/livecd')
+[[ -n ${remaining} ]] && {
+ sig=
+ retry=3
+
+ while [[ -n ${remaining} && ${retry} -gt 0 ]]; do
+ if [[ ${retry} -lt 3 ]]; then
+ ebegin "Unmounting loopback filesystems (retry)"
+ umount -d ${remaining} &>/dev/null
+ eend $? "Failed to unmount filesystems this retry"
+ else
+ ebegin "Unmounting loopback filesystems"
+ umount -d ${remaining} &>/dev/null
+ eend $? "Failed to unmount filesystems"
+ fi
+
+ remaining=$(awk '!/^#/ && $1 ~ /^\/dev\/loop/ && $2 != "/" {print $2}' /proc/mounts | \
+ sort -r | grep -v '/newroot' | grep -v '/mnt/livecd')
+ [[ -z ${remaining} ]] && break
+
+ /bin/fuser -k -m ${sig} ${remaining} &>/dev/null
+ sleep 5
+ retry=$((${retry} - 1))
+ sig=-9
+ done
+}
+
+# Try to unmount all filesystems (no /proc,tmpfs,devfs,etc).
+# This is needed to make sure we dont have a mounted filesystem
+# on a LVM volume when shutting LVM down ...
+ebegin "Unmounting filesystems"
+unmounts=$( \
+ awk '{ \
+ if (($3 !~ /^(proc|devpts|sysfs|devfs|tmpfs|usb(dev)?fs)$/) && \
+ ($1 != "none") && \
+ ($1 !~ /^(rootfs|\/dev\/root)$/) && \
+ ($2 != "/")) \
+ print $2 }' /proc/mounts | sort -ur)
+for x in ${unmounts}; do
+ # Do not umount these if we are booting off a livecd
+ if [[ -n ${CDBOOT} ]] && \
+ [[ ${x} == "/mnt/cdrom" || ${x} == "/mnt/livecd" ]] ; then
+ continue
+ fi
+
+ x=${x//\\040/ }
+ if ! umount "${x}" &>/dev/null; then
+ # Kill processes still using this mount
+ /bin/fuser -k -m -9 "${x}" &>/dev/null
+ sleep 2
+ # Now try to unmount it again ...
+ umount -f -r "${x}" &>/dev/null
+ fi
+done
+eend 0
+
+# Try to remove any dm-crypt mappings
+stop_addon dm-crypt
+
+# Stop LVM, etc
+stop_volumes
+
+# This is a function because its used twice below
+ups_kill_power() {
+ local UPS_CTL UPS_POWERDOWN
+ if [[ -f /etc/killpower ]] ; then
+ UPS_CTL=/sbin/upsdrvctl
+ UPS_POWERDOWN="${UPS_CTL} shutdown"
+ elif [[ -f /etc/apcupsd/powerfail ]] ; then
+ UPS_CTL=/etc/apcupsd/apccontrol
+ UPS_POWERDOWN="${UPS_CTL} killpower"
+ else
+ return 0
+ fi
+ if [[ -x ${UPS_CTL} ]] ; then
+ ewarn "Signalling ups driver(s) to kill the load!"
+ ${UPS_POWERDOWN}
+ ewarn "Halt system and wait for the UPS to kill our power"
+ /sbin/halt -id
+ while [ 1 ]; do sleep 60; done
+ fi
+}
+
+mount_readonly() {
+ local x=
+ local retval=0
+ local cmd=$1
+
+ # Get better results with a sync and sleep
+ sync; sync
+ sleep 1
+
+ for x in $(awk '$1 != "none" { print $2 }' /proc/mounts | sort -ur) ; do
+ x=${x//\\040/ }
+ if [[ ${cmd} == "u" ]]; then
+ umount -n -r "${x}"
+ else
+ mount -n -o remount,ro "${x}" &>/dev/null
+ fi
+ retval=$((${retval} + $?))
+ done
+ [[ ${retval} -ne 0 ]] && killall5 -9 &>/dev/null
+
+ return ${retval}
+}
+
+# Since we use `mount` in mount_readonly(), but we parse /proc/mounts, we
+# have to make sure our /etc/mtab and /proc/mounts agree
+cp /proc/mounts /etc/mtab &>/dev/null
+ebegin "Remounting remaining filesystems readonly"
+mount_worked=0
+if ! mount_readonly ; then
+ if ! mount_readonly ; then
+ # If these things really don't want to remount ro, then
+ # let's try to force them to unmount
+ if ! mount_readonly u ; then
+ mount_worked=1
+ fi
+ fi
+fi
+eend ${mount_worked}
+if [[ ${mount_worked} -eq 1 ]]; then
+ ups_kill_power
+ /sbin/sulogin -t 10 /dev/console
+fi
+
+# Inform if there is a forced or skipped fsck
+if [[ -f /fastboot ]]; then
+ echo
+ ewarn "Fsck will be skipped on next startup"
+elif [[ -f /forcefsck ]]; then
+ echo
+ ewarn "A full fsck will be forced on next startup"
+fi
+
+ups_kill_power
+
+
+# vim:ts=4
diff --git a/init.d/hostname b/init.d/hostname
new file mode 100755
index 0000000..7d10dd8
--- /dev/null
+++ b/init.d/hostname
@@ -0,0 +1,39 @@
+#!/sbin/runscript
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ need checkroot
+}
+
+start() {
+ local myhost=$(/bin/hostname 2>/dev/null)
+ local retval=0
+
+ # If the hostname is already set via the kernel, and /etc/hostname
+ # isn't setup, then we shouldn't go reseting the configuration #38172.
+ if [[ -z ${myhost} ]] || [[ ${myhost} == "(none)" ]] ; then
+ myhost="localhost"
+ fi
+
+ if [[ -f /etc/hostname ]] ; then
+ ewarn "You should stop using /etc/hostname and use /etc/conf.d/hostname"
+ myhost=$(</etc/hostname)
+ else
+ myhost=${HOSTNAME}
+ fi
+
+ ebegin "Setting hostname to ${myhost}"
+ /bin/hostname "${myhost}"
+ retval=$?
+ eend ${retval} "Failed to set the hostname"
+
+ if [[ ${retval} -eq 0 ]] ; then
+ # setup $HOSTNAME, ignore errors in case /etc is readonly.
+ echo "HOSTNAME=\"${myhost}\"" 2>/dev/null > /etc/env.d/01hostname
+ fi
+
+ return ${retval}
+}
+
+# vim:ts=4
diff --git a/init.d/keymaps b/init.d/keymaps
new file mode 100755
index 0000000..255abd2
--- /dev/null
+++ b/init.d/keymaps
@@ -0,0 +1,79 @@
+#!/sbin/runscript
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ need localmount
+}
+
+checkconfig() {
+ if [[ -z ${KEYMAP} ]] ; then
+ eerror "You need to setup KEYMAP in /etc/conf.d/keymaps first"
+ return 1
+ fi
+
+ # Make sure user isn't using rc.conf anymore
+ if grep -qs ^KEYMAP= /etc/rc.conf ; then
+ ewarn "KEYMAP should not be set in /etc/rc.conf but in /etc/conf.d/keymaps"
+ fi
+}
+
+start() {
+ if is_uml_sys ; then
+ ebegin "Loading key mappings"
+ eend 0
+ return 0
+ fi
+
+ local WINDOWKEYS_KEYMAP=
+
+ checkconfig || return 1
+
+ # Force linux keycodes for PPC.
+ if [[ -f /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes ]] ; then
+ echo 1 > /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes
+ fi
+
+ # Turn on unicode if user wants it
+ if [[ ${UNICODE} == "yes" ]] ; then
+ /usr/bin/kbd_mode -u
+ fi
+
+ ebegin "Loading key mappings"
+ if [[ -x /bin/loadkeys ]] ; then
+ [[ ${SET_WINDOWKEYS} == "yes" ]] && WINDOWKEYS_KEYMAP="windowkeys"
+ /bin/loadkeys -q ${WINDOWKEYS_KEYMAP} ${KEYMAP} \
+ ${EXTENDED_KEYMAPS} > /dev/null
+ eend $? "Error loading key mappings"
+ else
+ eend 1 "/bin/loadkeys not found"
+ return 1
+ fi
+
+ # Set terminal encoding to either ASCII or UNICODE.
+ # See utf-8(7) for more information.
+ local termencoding="" termmsg=""
+ if [[ ${UNICODE} == "yes" ]] ; then
+ local dumpkey_opts=""
+ [[ -n ${DUMPKEYS_CHARSET} ]] && dumpkey_opts="-c ${DUMPKEYS_CHARSET}"
+
+ dumpkeys ${dumpkey_opts} | loadkeys --unicode
+ termencoding=$'\033%G'
+ termmsg="UTF-8"
+ else
+ termencoding=$'\033(K'
+ termmsg="ASCII"
+ fi
+ local n ttydev=""
+ [[ -d /dev/vc ]] \
+ && ttydev=/dev/vc/ \
+ || ttydev=/dev/tty
+ ebegin "Setting terminal encoding to ${termmsg}"
+ for n in $(seq 1 "${RC_TTY_NUMBER}") ; do
+ echo -n -e ${termencoding} > ${ttydev}${n}
+ done
+ eend 0
+}
+
+
+# vim:ts=4
diff --git a/init.d/local b/init.d/local
new file mode 100755
index 0000000..b729e9d
--- /dev/null
+++ b/init.d/local
@@ -0,0 +1,34 @@
+#!/sbin/runscript
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ after *
+}
+
+start() {
+ ebegin "Starting local"
+
+ # Add any misc programs that should be started
+ # to /etc/conf.d/local.start
+ if [[ -e /etc/conf.d/local.start ]] ; then
+ source /etc/conf.d/local.start
+ fi
+
+ eend $? "Failed to start local"
+}
+
+stop() {
+ ebegin "Stopping local"
+
+ # Add any misc programs that should be stopped
+ # to /etc/conf.d/local.stop
+ if [[ -e /etc/conf.d/local.stop ]] ; then
+ source /etc/conf.d/local.stop
+ fi
+
+ eend $? "Failed to stop local"
+}
+
+
+# vim:ts=4
diff --git a/init.d/localmount b/init.d/localmount
new file mode 100755
index 0000000..fc49539
--- /dev/null
+++ b/init.d/localmount
@@ -0,0 +1,47 @@
+#!/sbin/runscript
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ need checkfs
+}
+
+start() {
+ # Mount local filesystems in /etc/fstab.
+ ebegin "Mounting local filesystems"
+ mount -at noproc,noshm,no${NET_FS_LIST// /,no} >/dev/null
+ eend $? "Some local filesystem failed to mount"
+
+ # Make sure we insert usbcore if its a module
+ if [[ -f /proc/modules && ! -d /proc/bus/usb ]] ; then
+ # >/dev/null to hide errors from non-USB users
+ modprobe usbcore &> /dev/null
+ fi
+
+ # Check what USB fs the kernel support. Currently
+ # 2.5+ kernels, and later 2.4 kernels have 'usbfs',
+ # while older kernels have 'usbdevfs'.
+ local usbfs=$(grep -Fow usbfs /proc/filesystems ||
+ grep -Fow usbdevfs /proc/filesystems)
+
+ if [[ -n ${usbfs} ]] && \
+ [[ -e /proc/bus/usb && ! -e /proc/bus/usb/devices ]]
+ then
+ ebegin "Mounting USB device filesystem (${usbfs})"
+ usbgid=$(awk -F: '/^usb:/{print $3; exit}' /etc/group)
+ mount -t ${usbfs} usbfs /proc/bus/usb \
+ ${usbgid:+-o devmode=0664,devgid=${usbgid}}
+ eend $? "Failed to mount USB device filesystem"
+ fi
+
+ # Swap on loopback devices, and other weirdnesses
+ ebegin "Activating (possibly) more swap"
+ /sbin/swapon -a
+ eend $?
+
+ # Start dm-crypt mappings, if any
+ start_addon dm-crypt
+}
+
+
+# vim:ts=4
diff --git a/init.d/modules b/init.d/modules
new file mode 100755
index 0000000..38e0f44
--- /dev/null
+++ b/init.d/modules
@@ -0,0 +1,122 @@
+#!/sbin/runscript
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ need checkroot hostname
+ use isapnp
+}
+
+load_modules() {
+ local x=
+ local i=0
+ local retval=0
+ local modules=
+ local modargs=
+ local modcount=0
+ local config="$1"
+
+ [[ -z ${config} || ! -r ${config} ]] && return 0
+
+ # Loop over every line in $config
+ eval $(awk '
+ BEGIN {
+ COUNT = 0 # Make sure COUNT is set
+ }
+
+ $0 !~ /(^[[:space:]]*(#|$))/ {
+ if (MODULES == "")
+ MODULES = $1
+ else
+ MODULES = MODULES " " $1
+
+ # Not the greatest method to remove $1 from $0, but it works
+ sub(/^[[:space:]]*[^[:space:]]*[[:space:]]*/, "")
+ # Trim trailing comments on the line
+ sub(/#.*$/, "")
+ ARGS[COUNT] = $0
+ COUNT++
+ }
+
+ END {
+ # 'eval' will make sure these are set to proper bash variables
+ print "modcount=" COUNT
+ print "modules=\"" MODULES "\""
+ for (x = 0;x < COUNT;x++)
+ print "modargs[" x "]=\"" ARGS[x] "\""
+ }
+ ' "${config}")
+
+ if [[ ${modcount} -gt 0 ]]; then
+ einfo "Using ${config} as config:"
+
+ for x in ${modules}; do
+ ebegin " Loading module ${x}"
+ modprobe -q ${x} ${modargs[${i}]} &>/dev/null
+ retval=$?
+ eend ${retval} " Failed to load ${x}"
+
+ i=$((i+1))
+ [[ ${retval} -eq 0 ]] || modcount=$((modcount-1))
+ done
+
+ einfo "Autoloaded ${modcount} module(s)"
+ fi
+
+ return 0
+}
+
+start() {
+ local KV=$(uname -r)
+ local KV_MAJOR=$(KV_major "${KV}")
+ local KV_MINOR=$(KV_minor "${KV}")
+ local KV_MICRO=$(KV_micro "${KV}")
+
+ # Should not fail if kernel do not have module
+ # support compiled in ...
+ [[ -f /proc/modules ]] || return 0
+
+ # Make sure depmod from modutils do not whine, but do not bother if
+ # we are on a 2.6 kernel without modprobe.old
+ if [[ -z "${CDBOOT}" ]] && [[ ! -e /etc/modules.conf ]] && \
+ [[ $(get_KV) -lt $(KV_to_int '2.5.48') || -x /sbin/modprobe.old ]]
+ then
+ echo '### This file is automatically generated by modules-update' \
+ > /etc/modules.conf 2>/dev/null
+ [[ ! -f /etc/modules.conf ]] && \
+ ewarn "Cannot update /etc/modules.conf!"
+ fi
+
+ # Only do this if we have modules.conf or a 2.6 kernel
+ if [[ -z "${CDBOOT}" ]] && \
+ [[ -f /etc/modules.conf || $(get_KV) -ge $(KV_to_int '2.5.48') ]]
+ then
+ /sbin/modules-update
+ fi
+
+ local autoload=""
+ if [[ -f /etc/modules.autoload && ! -L /etc/modules.autoload ]]; then
+ autoload=/etc/modules.autoload
+ else
+ local x
+ for x in "${KV}" ${KV_MAJOR}.${KV_MINOR}.${KV_MICRO} ${KV_MAJOR}.${KV_MINOR} ; do
+ if [[ -f /etc/modules.autoload.d/kernel-"${x}" ]] ; then
+ autoload="/etc/modules.autoload.d/kernel-${x}"
+ break
+ fi
+ done
+ fi
+ [[ -n ${autoload} ]] && load_modules "${autoload}"
+
+ #
+ # Just in case a sysadmin prefers generic symbolic links in
+ # /lib/modules/boot for boot time modules we will load these modules
+ #
+ [[ -n $(modprobe -l -t boot) ]] && modprobe -a -t boot \* &>/dev/null
+
+ # Above test clobbers the return
+ return 0
+}
+
+
+# vim:ts=4
diff --git a/init.d/net.eth0 b/init.d/net.eth0
new file mode 120000
index 0000000..3843c79
--- /dev/null
+++ b/init.d/net.eth0
@@ -0,0 +1 @@
+net.lo \ No newline at end of file
diff --git a/init.d/netmount b/init.d/netmount
new file mode 100755
index 0000000..104bfd8
--- /dev/null
+++ b/init.d/netmount
@@ -0,0 +1,93 @@
+#!/sbin/runscript
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ local myneed="net"
+ local myuse=""
+
+ # Only have Portmap as a dependency if there is a nfs mount in fstab
+ # that should be mounted at boot time. Also filter out comments.
+ local nfsmounts=$(awk '!/^#/ && ($3=="nfs" || $3=="nfs4") && $4 !~ /noauto/ { print $0 }' /etc/fstab)
+
+ if [ -n "${nfsmounts}" ]
+ then
+ myneed="${myneed} portmap"
+ myuse="${myuse} nfs nfsmount"
+ fi
+
+ need ${myneed}
+ use ${myuse}
+}
+
+start() {
+ local rcfilesystems=""
+
+ # Only try to mount NFS filesystems if portmap was started.
+ # This is to fix "hang" problems for new users who do not
+ # add portmap to the default runlevel.
+ if [ -L "${svcdir}/started/portmap" ]
+ then
+ rcfilesystems="${NET_FS_LIST// /,}" # convert to comma-separated
+ else
+ rcfilesystems=" ${NET_FS_LIST} "
+ rcfilesystems=${rcfilesystems// nfs /} # remove nfs
+ rcfilesystems=${rcfilesystems// nfs4 /} # remove nfs4
+ rcfilesystems=${rcfilesystems# } # remove front and
+ rcfilesystems=${rcfilesystems% } # back spaces
+ rcfilesystems=${rcfilesystems// /,} # convert to comma-separated
+ fi
+
+ ebegin "Mounting network filesystems"
+ mount -at ${rcfilesystems} >/dev/null
+
+ if [ "$?" -ne 0 ]
+ then
+ ewend 1 "Could not mount all network filesystems!"
+ else
+ eend 0
+ fi
+
+ return 0
+}
+
+stop() {
+ local ret
+ ebegin "Unmounting network filesystems"
+ [ -z "$(umount -art ${NET_FS_LIST// /,} 2>&1)" ]
+ ret=$?
+ eend ${ret} "Failed to simply unmount filesystems"
+ [ ${ret} -eq 0 ] && return 0
+
+ # `umount -a` will fail if the filesystems are in use.
+ # Here we use fuser to kill off processes that are using
+ # the filesystems so that we can unmount properly.
+ # We will gradually use harsher kill signals so that the
+ # processes know we aren't screwing around here ;).
+ declare -a siglist=( "TERM" "KILL" "KILL" )
+ local retry=0
+ local remaining="go"
+
+ while [ -n "${remaining}" -a ${retry} -lt 3 ]
+ do
+ # Populate $remaining with a newline-delimited list of network
+ # filesystems. Mount points have spaces swapped for '\040' (see
+ # fstab(5)) so we have to translate them back to spaces.
+ remaining="$(awk '$3 ~ /'${NET_FS_LIST// /|}'/ { if ($2 != "/") print $2 }' /proc/mounts | sort -r)"
+ # Since we have to worry about the spaces being quoted properly,
+ # we'll use `set --` and then "$@" to get the correct result.
+ IFS=$'\n'
+ set -- ${remaining//\\040/ }
+ unset IFS
+ [ -z "${remaining}" ] && break
+
+ # try to unmount again
+ ebegin $'\t'"Unmounting network filesystems (retry #$((retry+1)))"
+ /bin/fuser -k -${siglist[$((retry++))]} -m "$@" &>/dev/null
+ sleep 5
+ umount "$@" &>/dev/null
+ eend $? $'\t'"Failed to unmount filesystems"
+ done
+}
+
+# vim:ts=4
diff --git a/init.d/numlock b/init.d/numlock
new file mode 100755
index 0000000..22654f0
--- /dev/null
+++ b/init.d/numlock
@@ -0,0 +1,34 @@
+#!/sbin/runscript
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ need localmount
+}
+
+start() {
+ ebegin "Enabling numlock on ttys"
+ local dev
+ [[ -d /dev/vc ]] \
+ && dev=/dev/vc/ \
+ || dev=/dev/tty
+ for tty in $(seq 1 "${RC_TTY_NUMBER}") ; do
+ setleds -D +num < ${dev}${tty} &> /dev/null
+ done
+ eend $? "Failed to enable numlock"
+}
+
+stop() {
+ ebegin "Disabling numlock on ttys"
+ local dev
+ [[ -d /dev/vc ]] \
+ && dev=/dev/vc/ \
+ || dev=/dev/tty
+ for tty in $(seq 1 "${RC_TTY_NUMBER}") ; do
+ setleds -D -num < ${dev}${tty} &> /dev/null
+ done
+ eend $? "Failed to disable numlock"
+}
+
+
+# vim:ts=4
diff --git a/init.d/reboot.sh b/init.d/reboot.sh
new file mode 100755
index 0000000..fb67439
--- /dev/null
+++ b/init.d/reboot.sh
@@ -0,0 +1,8 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+/sbin/reboot -idp
+
+# hmm, if the above failed, that's kind of odd ...
+# so let's force a reboot
+/sbin/reboot -f
diff --git a/init.d/rmnologin b/init.d/rmnologin
new file mode 100755
index 0000000..559b660
--- /dev/null
+++ b/init.d/rmnologin
@@ -0,0 +1,16 @@
+#!/sbin/runscript
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ need localmount
+}
+
+start() {
+ if [[ -f /etc/nologin.boot ]] ; then
+ rm -f /etc/nologin /etc/nologin.boot &> /dev/null
+ fi
+}
+
+
+# vim:ts=4
diff --git a/init.d/shutdown.sh b/init.d/shutdown.sh
new file mode 100755
index 0000000..4672211
--- /dev/null
+++ b/init.d/shutdown.sh
@@ -0,0 +1,8 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+/sbin/halt -ihdp
+
+# hmm, if the above failed, that's kind of odd ...
+# so let's force a halt
+/sbin/halt -f
diff --git a/init.d/urandom b/init.d/urandom
new file mode 100755
index 0000000..368130d
--- /dev/null
+++ b/init.d/urandom
@@ -0,0 +1,37 @@
+#!/sbin/runscript
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ need localmount
+}
+
+start() {
+ [[ -c /dev/urandom ]] || return
+ if [[ -f /var/run/random-seed ]] ; then
+ cat /var/run/random-seed > /dev/urandom
+ fi
+ if ! rm -f /var/run/random-seed &> /dev/null ; then
+ ewarn "Skipping /var/run/random-seed initialization (ro root?)"
+ return 0
+ fi
+ ebegin "Initializing random number generator"
+ umask 077
+ dd if=/dev/urandom of=/var/run/random-seed count=1 &> /dev/null
+ eend $? "Error initializing random number generator"
+ umask 022
+}
+
+stop() {
+ [[ -n ${CDBOOT} ]] && return 0
+
+ ebegin "Saving random seed"
+ # Carry a random seed from shut-down to start-up;
+ # see documentation in linux/drivers/char/random.c
+ umask 077
+ dd if=/dev/urandom of=/var/run/random-seed count=1 &> /dev/null
+ eend $? "Failed to save random seed"
+}
+
+
+# vim:ts=4
diff --git a/lib/rcscripts/net.modules.d/adsl b/lib/rcscripts/net.modules.d/adsl
new file mode 100644
index 0000000..87bf6ab
--- /dev/null
+++ b/lib/rcscripts/net.modules.d/adsl
@@ -0,0 +1,101 @@
+#!/bin/bash
+# Copyright (c) 2004-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# Contributed by Roy Marples (uberlord@gentoo.org)
+
+# char* adsl_provides(void)
+#
+# Returns a string to change module definition for starting up
+adsl_provides() {
+ echo "adsl"
+}
+
+# void adsl_depend(void)
+#
+# Sets up the dependancies for the module
+adsl_depend() {
+ after interface
+ before dhcp
+}
+
+# bool adsl_check_installed(void)
+#
+# Returns 1 if rp-pppoe is installed, otherwise 0
+adsl_check_installed() {
+ [[ -x /usr/sbin/adsl-start ]] && return 0
+ ${1:-false} && eerror "For ADSL support, emerge net-dialup/rp-pppoe"
+ return 1
+}
+
+# bool adsl_check_depends(void)
+#
+# Checks to see if we have the needed functions
+adsl_check_depends() {
+ return 0
+}
+
+# bool adsl_setup_vars(char *iface)
+#
+# Checks to see if the ADSL script has been created or not
+adsl_setup_vars() {
+ local iface="$1"
+
+ # Decide which configuration to use. Hopefully there is an
+ # interface-specific one
+ cfgfile="/etc/ppp/pppoe-${iface}.conf"
+ [[ -f ${cfgfile} ]] || cfgfile="/etc/ppp/pppoe.conf"
+
+ if [[ ! -f ${cfgfile} ]]; then
+ eerror "no pppoe.conf file found!"
+ eerror "Please run adsl-setup to create one"
+ return 1
+ fi
+
+ return 0
+}
+
+# bool adsl_start(char *iface)
+#
+# Start ADSL on an interface by calling adsl-start
+#
+# Returns 0 (true) when successful, non-zero otherwise
+adsl_start() {
+ local iface="$1" user ifvar=$( bash_variable "$1" ) cfgfile
+
+ adsl_setup_vars "${iface}" || return 1
+
+ # Might or might not be set in conf.d/net
+ eval user=\"\$\{adsl_user_${ifvar}\}\"
+
+ # Start ADSL with the cfgfile, but override ETH and PIDFILE
+ einfo "Starting ADSL for ${iface}"
+ /usr/sbin/adsl-start <(cat "${cfgfile}"; \
+ echo "ETH=${iface}"; \
+ echo "PIDFILE=/var/run/adsl-${iface}.pid"; \
+ [[ -n ${user} ]] && echo "USER=${user}") \
+ >/dev/null
+ eend $?
+}
+
+# bool adsl_stop(char *iface)
+#
+# Stop ADSL on an interface by calling adsl-stop
+# Returns 0 when there is no ADSL to stop or we stop ADSL successfully
+# Otherwise 1
+adsl_stop() {
+ local iface="$1" cfgfile
+
+ adsl_check_installed || return 0
+ [[ ! -f "/var/run/adsl-${iface}.pid" ]] && return 0
+
+ adsl_setup_vars "${iface}" || return 0
+
+ einfo "Stopping ADSL for ${iface}"
+ /usr/sbin/adsl-stop <(cat "${cfgfile}"; \
+ echo "ETH=${iface}"; echo "PIDFILE=/var/run/adsl-${iface}.pid") \
+ >/dev/null
+ eend $?
+}
+
+# vim:ts=4
diff --git a/lib/rcscripts/net.modules.d/apipa b/lib/rcscripts/net.modules.d/apipa
new file mode 100644
index 0000000..cd61ebb
--- /dev/null
+++ b/lib/rcscripts/net.modules.d/apipa
@@ -0,0 +1,105 @@
+#!/bin/bash
+# Copyright (c) 2004-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# Contributed by Roy Marples (uberlord@gentoo.org)
+
+# char* apipa_provides(void)
+#
+# Returns a string to change module definition for starting up
+apipa_provides() {
+ echo "apipa"
+}
+
+# void apipa_depend(void)
+#
+# Sets up the dependancies for the module
+apipa_depend() {
+ after system dhcp vlan
+}
+
+# bool apipa_check_installed(void)
+#
+# Returns 1 if ifenslave is installed, otherwise 0
+apipa_check_installed() {
+ [[ -x /sbin/arping || -x /usr/sbin/arping2 ]] && return 0
+ if ${1:-false}; then
+ eerror "For Automatic Private IP Addressing (APIPA) support"
+ eerror "emerge net-misc/iputils or net-analyzer/arping"
+ fi
+ return 1
+}
+
+# bool apipa_check_depends(void)
+#
+# Checks to see if we have the needed functions
+apipa_check_depends() {
+ local f
+
+ for f in interface_exists interface_up; do
+ [[ $( type -t "${f}" ) == "function" ]] && continue
+ eerror "apipa: missing required function ${f}\n"
+ return 1
+ done
+
+ return 0
+}
+
+# bool address_exists(char *interface, char *address)
+#
+# Returns 0 if the address on the interface responds to an arping
+# 1 if not - packets defaults to 1
+# If neither arping (net-misc/iputils) or arping2 (net-analyzer/arping)
+# is installed then we return 1
+address_exists() {
+ local iface="$1" address="${2%%/*}" i
+
+ # We only handle IPv4 addresses
+ [[ ${address} != *.*.*.* ]] && return 1
+
+ # We need to bring the interface up to test
+ interface_up "${iface}"
+
+ if [[ -x /sbin/arping ]]; then
+ /sbin/arping -q -c 2 -w 3 -D -f -I "${iface}" "${address}" \
+ &>/dev/null || return 0
+ elif [[ -x /usr/sbin/arping2 ]]; then
+ for (( i=0; i<3; i++ )); do
+ /usr/sbin/arping2 -0 -c 1 -i "${iface}" "${address}" \
+ &>/dev/null && return 0
+ done
+ fi
+ return 1
+}
+
+# bool apipa_start(char *iface)
+#
+# Tries to locate an address in the 169.254.0.0 netmask 169.254.255.255 range
+apipa_start() {
+ local iface="$1" i1 i2 addr i=0
+
+ interface_exists "${iface}" true || return 1
+
+ ebegin "Searching for free addresses"
+ interface_up "${iface}"
+
+ while [[ ${i} -lt 64516 ]]; do
+ (( i1=${RANDOM}%255 ))
+ (( i2=${RANDOM}%255 ))
+
+ addr="169.254.${i1}.${i2}"
+ if ! address_exists "${iface}" "${addr}" ; then
+ config[config_counter]="${addr}/16 broadcast 169.254.255.255"
+ (( config_counter-- ))
+ eend 0
+ return 0
+ fi
+
+ (( i++ ))
+ done
+
+ eend 1 "No free address found!"
+ return 1
+}
+
+# vim:ts=4
diff --git a/lib/rcscripts/net.modules.d/bonding b/lib/rcscripts/net.modules.d/bonding
new file mode 100644
index 0000000..68df44a
--- /dev/null
+++ b/lib/rcscripts/net.modules.d/bonding
@@ -0,0 +1,125 @@
+#!/bin/bash
+# Copyright (c) 2004-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# Contributed by Roy Marples (uberlord@gentoo.org)
+
+# char* bonding_provides(void)
+#
+# Returns a string to change module definition for starting up
+bonding_provides() {
+ echo "bonding"
+}
+
+# void bonding_depend(void)
+#
+# Sets up the dependancies for the module
+bonding_depend() {
+ after interface
+ before vlan dhcp apipa
+}
+
+# bool bonding_check_installed(void)
+#
+# Returns 1 if ifenslave is installed, otherwise 0
+bonding_check_installed() {
+ [[ -x /sbin/ifenslave ]] && return 0
+ ${1:-false} && eerror "For link aggregation (bonding) support, emerge net-misc/ifenslave"
+ return 1
+}
+
+# bool bonding_check_depends(void)
+#
+# Checks to see if we have the needed functions
+bonding_check_depends() {
+ local f
+
+ for f in interface_exists interface_up interface_down interface_del_addresses; do
+ [[ $( type -t "${f}" ) == "function" ]] && continue
+ eerror "bonding: missing required function ${f}\n"
+ return 1
+ done
+
+ return 0
+}
+
+# bool bonding_post_start(char *iface)
+#
+# Bonds the interface
+bonding_pre_start() {
+ local iface="$1" slaves s ifvar=$( bash_variable "$1" )
+
+ eval slaves=\"\$\{slaves_${ifvar}\[@\]\}\"
+ [[ -z ${slaves} ]] && return 0
+
+ interface_exists "${iface}" true || return 1
+
+ if [[ ! -f "/proc/net/bonding/${iface}" ]]; then
+ eerror "${iface} is not capable of bonding"
+ return 1
+ fi
+
+ ebegin "Adding slaves to ${iface}"
+ eindent
+ einfo "${slaves}"
+
+ # Check that our slaves exist
+ for s in ${slaves}; do
+ interface_exists "${s}" && continue
+ ewarn "interface ${s} does not exist"
+ return 1
+ done
+
+ # Must force the slaves to a particular state before adding them
+ for s in ${slaves}; do
+ interface_del_addresses "${s}"
+ interface_up "${s}"
+ done
+
+ # now force the master to up
+ interface_up "${iface}"
+
+ # finally add in slaves
+ eoutdent
+ /sbin/ifenslave "${iface}" ${slaves} >/dev/null
+ eend $?
+
+ return 0 #important
+}
+
+# bool bonding_pre_stop(void)
+# Unbonds bonded interfaces
+#
+# Always returns 0 (true)
+bonding_pre_stop() {
+ local iface="$1" slaves s
+
+ bonding_check_installed || return 0
+
+ # return silently if this is not a bonding interface
+ [[ ! -f "/proc/net/bonding/${iface}" ]] && return 0
+
+ # don't trust the config, get the active list instead
+ slaves=$( sed -n -e 's/^Slave Interface: //p' "/proc/net/bonding/${iface}" )
+ [[ -z ${slaves} ]] && return 0
+
+ # remove all slaves
+ ebegin "Removing slaves from ${iface}"
+ eindent
+ einfo "${slaves}"
+ eoutdent
+ /sbin/ifenslave -d "${iface}" ${slaves} &>${devnull}
+
+ # reset all slaves
+ for s in ${slaves}; do
+ if interface_exists "${s}" ; then
+ interface_del_addresses "${s}"
+ interface_down "${s}"
+ fi
+ done
+
+ eend 0
+ return 0
+}
+
+# vim:ts=4
diff --git a/lib/rcscripts/net.modules.d/bridge b/lib/rcscripts/net.modules.d/bridge
new file mode 100644
index 0000000..612ca5b
--- /dev/null
+++ b/lib/rcscripts/net.modules.d/bridge
@@ -0,0 +1,227 @@
+#!/bin/bash
+# Copyright (c) 2004-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# Contributed by Roy Marples (uberlord@gentoo.org)
+
+# Fix any potential localisation problems
+# Note that LC_ALL trumps LC_anything_else according to locale(7)
+brctl() {
+ LC_ALL=C /sbin/brctl "$@"
+}
+
+# char* bridge_provides(void)
+#
+# Returns a string to change module definition for starting up
+bridge_provides() {
+ echo "bridge"
+}
+
+# void bridge_depend(void)
+#
+# Sets up the dependancies for the module
+bridge_depend() {
+ after interface tuntap
+ before dhcp apipa
+}
+
+# bool bridge_check_installed(void)
+#
+# Returns 1 if bridge is installed, otherwise 0
+bridge_check_installed() {
+ [[ -x /sbin/brctl ]] && return 0
+ ${1:-false} && eerror "For bridge support, emerge net-misc/bridge-utils"
+ return 1
+}
+
+# bool bridge_check_depends(void)
+#
+# Checks to see if we have the needed functions
+bridge_check_depends() {
+ local f
+
+ for f in interface_down interface_del_addresses interface_set_flag; do
+ [[ $( type -t "${f}" ) == "function" ]] && continue
+ eerror "bridge: missing required function ${f}\n"
+ return 1
+ done
+
+ return 0
+}
+
+# char* bridge_get_vars(char *interface)
+#
+# Returns a string spaced with possible user set
+# configuration variables
+bridge_get_vars() {
+ echo "bridge_$1 brctl_$1"
+}
+
+# char* bridge_get_ports(char *interface)
+#
+# Returns the interfaces added to the given bridge
+bridge_get_ports() {
+ brctl show 2>/dev/null \
+ | sed -n -e '/^'"$1"'/,/^\S/ { /^\('"$1"'\|\t\)/s/^.*\t//p }'
+}
+
+# char* bridge_get_bridge(char *interface)
+#
+# Returns the bridge interface of the given interface
+bridge_get_bridge() {
+ local x=$( brctl show 2>/dev/null \
+ | sed -e '1 {d}; /^[^ ]/ { N }; /.*'"$1"'.*/ {s/^\([^ \t]\+\).*/\1/p}; d' )
+
+ local -a a=( ${x} )
+ if [[ ${#a[@]} == "1" ]]; then
+ echo "${x}"
+ elif [[ $1 == "${a[3]}" ]]; then
+ echo "${a[0]}"
+ fi
+}
+
+# bool bridge_exists(char *interface)
+#
+# Returns 0 if the bridge exists, otherwise 1
+bridge_exists() {
+ brctl show 2>/dev/null | grep -q "^$1"
+}
+
+# bool bridge_create(char *interface)
+#
+# Creates the bridge - no ports are added here though
+# Returns 0 on success otherwise 1
+bridge_create() {
+ local iface="$1" ifvar=$( bash_variable "$1" ) x i
+ local -a opts
+
+ ebegin "Creating bridge ${iface}"
+ x=$( brctl addbr "${iface}" 2>&1 )
+ if [[ -n ${x} ]]; then
+ if [[ ${x} == "br_add_bridge: Package not installed" ]]; then
+ eend 1 "Bridging (802.1d) support is not present in this kernel"
+ else
+ eend 1 "${x}"
+ fi
+ return 1
+ fi
+
+ eval opts=( \"\$\{brctl_${ifvar}\[@\]\}\" )
+ for (( i=0; i<${#opts[@]}; i++ )); do
+ x="${opts[i]/ / ${iface} }"
+ [[ ${x} == "${opts[i]}" ]] && x="${x} ${iface}"
+ x=$( brctl ${x} 2>&1 1>/dev/null )
+ [[ -n ${x} ]] && ewarn "${x}"
+ done
+ eend 0
+}
+
+# bool bridge_add_port(char *interface, char *port)
+#
+# Adds the port to the bridge
+bridge_add_port() {
+ local iface="$1" port="$2" e
+
+ interface_set_flag "${port}" promisc true
+ interface_up "${port}"
+ e=$( brctl addif "${iface}" "${port}" 2>&1 )
+ if [[ -n ${e} ]]; then
+ interface_set_flag "${port}" promisc false
+ echo "${e}" >&2
+ return 1
+ fi
+ return 0
+}
+
+# bool bridge_delete_port(char *interface, char *port)
+#
+# Deletes a port from a bridge
+bridge_delete_port() {
+ interface_set_flag "$2" promisc false
+ brctl delif "$1" "$2"
+}
+
+# bool bridge_start(char *iface)
+#
+# set up bridge
+# This can also be called by non-bridges so that the bridge can be created
+# dynamically
+bridge_pre_start() {
+ local iface="$1" ports briface i ifvar=$( bash_variable "$1" ) opts
+ eval ports=\"\$\{bridge_${ifvar}\[@\]\}\"
+ eval briface=\"\$\{bridge_add_${ifvar}\}\"
+ eval opts=\"\$\{brctl_${ifvar}\}\"
+
+ [[ -z ${ports} && -z ${briface} && -z ${opts} ]] && return 0
+
+ # Destroy the bridge if it exists
+ [[ -n ${ports} ]] && bridge_stop "${iface}"
+
+ # Allow ourselves to add to the bridge
+ if [[ -z ${ports} && -n ${briface} ]]; then
+ ports="${iface}"
+ iface="${briface}"
+ fi
+
+ # Create the bridge if needed
+ bridge_exists "${iface}" || bridge_create "${iface}"
+
+ if [[ -n ${ports} ]]; then
+ einfo "Adding ports to ${iface}"
+ eindent
+
+ for i in ${ports}; do
+ interface_exists "${i}" && continue
+ eerror "interface ${i} does not exist"
+ return 1
+ done
+
+ for i in ${ports}; do
+ ebegin "${i}"
+ bridge_add_port "${iface}" "${i}"
+ eend $? || return 1
+ done
+ eoutdent
+ fi
+
+ return 0
+}
+
+# bool bridge_stop(char *iface)
+#
+# Removes the device
+# returns 0
+bridge_stop() {
+ bridge_check_installed || return 0
+
+ local iface="$1" ports i deletebridge=false extra=""
+
+ if bridge_exists "${iface}" ; then
+ ebegin "Destroying bridge ${iface}"
+ interface_down "${iface}"
+ ports=$( bridge_get_ports "${iface}" )
+ deletebridge=true
+ eindent
+ else
+ # Work out if we're added to a bridge for removal or not
+ ports="${iface}"
+ iface=$( bridge_get_bridge "${iface}" )
+ [[ -z ${iface} ]] && return 0
+ extra=" from ${iface}"
+ fi
+
+ for i in ${ports}; do
+ ebegin "Removing port ${i}${extra}"
+ bridge_delete_port "${iface}" "${i}"
+ eend $?
+ done
+
+ if ${deletebridge} ; then
+ eoutdent
+ brctl delbr "${iface}" &>/dev/null
+ eend 0
+ fi
+ return 0
+}
+
+# vim:ts=4
diff --git a/lib/rcscripts/net.modules.d/dhclient b/lib/rcscripts/net.modules.d/dhclient
new file mode 100644
index 0000000..6d31321
--- /dev/null
+++ b/lib/rcscripts/net.modules.d/dhclient
@@ -0,0 +1,196 @@
+#!/bin/bash
+# Copyright (c) 2004-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# Contributed by Roy Marples (uberlord@gentoo.org)
+
+# Fix any potential localisation problems
+# Note that LC_ALL trumps LC_anything_else according to locale(7)
+dhclient() {
+ LC_ALL=C /sbin/dhclient "$@"
+}
+
+# char* dhclient_provides(void)
+#
+# Returns a string to change module definition for starting up
+dhclient_provides() {
+ echo "dhcp"
+}
+
+# void dhclient_depend(void)
+#
+# Sets up the dependancies for the module
+dhclient_depend() {
+ after interface
+}
+
+# bool dhclient_check_installed(void)
+#
+# Returns 1 if dhclient is installed, otherwise 0
+dhclient_check_installed() {
+ [[ -x /sbin/dhclient ]] && return 0
+ ${1:-false} && eerror "For DHCP (dhclient) support, emerge net-misc/dhcp"
+ return 1
+}
+
+# bool dhclient_check_depends(void)
+#
+# Checks to see if we have the needed functions
+dhclient_check_depends() {
+ local f
+
+ for f in interface_exists interface_get_address; do
+ [[ $( type -t "${f}" ) == "function" ]] && continue
+ eerror "dhclient: missing required function ${f}\n"
+ return 1
+ done
+
+ return 0
+}
+
+# char* dhclient_get_vars(char *interface)
+#
+# Returns a string spaced with possible user set
+# configuration variables
+dhclient_get_vars() {
+ echo "dhclient_$1 dhcp_$1"
+}
+
+# bool dhclient_stop(char *iface)
+#
+# Stop dhclient on an interface
+# Always returns 0
+dhclient_stop() {
+ local iface="$1" d
+ local pidfile="/var/run/dhclient-${iface}.pid"
+
+ dhclient_check_installed || return 0
+ [[ ! -f ${pidfile} ]] && return 0
+
+ # We check for a dhclient process first as if we attempt to release
+ # an interface for which dhclient has obtained an IP in the past
+ # it causes a "RELEASE" event anyway.
+ local pid=$( < "${pidfile}" )
+
+ local ifvar=$( bash_variable "${iface}" )
+ eval d=\" \$\{dhcp_${ifvar}\} \"
+ [[ ${d} == " " ]] && d=" ${dhcp} "
+
+ ebegin "Stopping dhclient on ${iface}"
+ if [[ ${d} == *" release "* ]]; then
+ local r=$( dhclient -q -r -pf "${pidfile}" \
+ -sf "${MODULES_DIR}/helpers.d/dhclient-wrapper" "${iface}" )
+ [[ ${r} == "deconfig" ]]
+ eend $? "dhclient returned a ${r}"
+ [[ -f "/var/cache/dhcp-${iface}.lease" ]] \
+ && rm -f "/var/cache/dhcp-${iface}.lease"
+ else
+ kill -s TERM "${pid}" 2>/dev/null
+ clean_pidfile "${pidfile}"
+ eend 0
+ fi
+
+ return 0
+}
+
+# bool dhclient_start(char *iface)
+#
+# Start DHCP on an interface by calling dhclient $iface $options
+#
+# Returns 0 (true) when a DHCP address is obtained, otherwise 1
+dhclient_start() {
+ local iface="$1" opts ifvar=$( bash_variable "$1" )
+ local pidfile="/var/run/dhclient-${iface}.pid" edit=""
+ local cffile="/etc/dhcp/dhclient.conf"
+ local d
+
+ interface_exists "${iface}" true || return 1
+
+ eval edit=\"\$\{dhclient_edit_config_${ifvar}\}\"
+ [[ -z ${edit} ]] && eval edit="${dhclient_edit_config:-no}"
+ if [[ ${edit} == "yes" || ${edit} == "true" ]]; then
+ edit=true
+ else
+ edit=false
+ fi
+
+ # Load our options
+ eval opts=\" \$\{dhclient_${ifvar}\} \"
+
+ # Work out our cffile
+ x="${opts##* -cf }"
+ if [[ ${x} != "${opts}" ]]; then
+ x="${x%% *}"
+ if [[ -n ${x} ]]; then
+ cffile="${x}"
+ opts="${opts//-cf ${cffile}/}"
+ fi
+ fi
+ opts="${opts} -cf ${cffile}"
+
+ # Ensure that the cffile does not contain any script lines
+ # as that will stop our helpers from running
+ if [[ -e ${cffile} ]] ; then
+ if grep -q "^[ \t]*script " "${cffile}" 2>/dev/null ; then
+ if ${edit} ; then
+ sed -i '/^[ \t]*script /d' "${cffile}" || return 1
+ else
+ eerror "You have to remove the script parameter from ${cffile}"
+ return 1
+ fi
+ fi
+ else
+ ${edit} && touch "${cffile}" 2>/dev/null
+ fi
+
+ eval d=\" \$\{dhcp_${ifvar}\} \"
+ [[ ${d} == " " ]] && d=" ${dhcp} "
+
+ # Send our hostname by editing cffile
+ if ${edit} && [[ -e ${cffile} && ${d} != *" nosendhost "* ]] ; then
+ local hostname=$( hostname )
+ if [[ ${hostname} != "(none)" && ${hostname} != "localhost" ]]; then
+ sed -i '/^[ \t]*send[ \t]*host-name[ \t]*/d' "${cffile}"
+ if [[ -s ${cffile} ]]; then
+ sed -i '1 isend host-name "'"${hostname}"'";' "${cffile}"
+ else
+ echo "send host-name \"${hostname}\";" > "${cffile}"
+ fi
+ fi
+ fi
+
+ # Bring up DHCP for this interface (or alias)
+ ebegin "Running dhclient"
+
+ # Stop dhclient if it's already running
+ dhclient_stop "${iface}"
+
+ if [[ ${background} == "yes" ]]; then
+ eval dhclient ${opts} -pf "${pidfile}" -q \
+ -sf "${MODULES_DIR}/helpers.d/dhclient-wrapper" \
+ "${iface}" &>/dev/null &
+ eend 0
+ go_background
+ fi
+
+ local x=$( eval dhclient ${opts} -1 -pf "${pidfile}" \
+ -sf "${MODULES_DIR}/helpers.d/dhclient-wrapper" -q "${iface}" 2>&1 )
+ # We just check the last 5 letters
+ [[ ${x:${#x} - 5:5} == "bound" ]]
+ if [[ $? != "0" ]]; then
+ echo "${x}"
+ # We need to kill the process if we fail
+ [[ -e ${pidfile} ]] && kill -s TERM $( < "${pidfile}" ) 2>/dev/null
+ eend 1
+ return 1
+ fi
+ eend 0
+
+ # DHCP succeeded, show address retrieved
+ local addr=$( interface_get_address "${iface}" )
+ einfo "${iface} received address ${addr}"
+
+ return 0
+}
+
+# vim:ts=4
diff --git a/lib/rcscripts/net.modules.d/dhcpcd b/lib/rcscripts/net.modules.d/dhcpcd
new file mode 100644
index 0000000..25e3069
--- /dev/null
+++ b/lib/rcscripts/net.modules.d/dhcpcd
@@ -0,0 +1,166 @@
+#!/bin/bash
+# Copyright (c) 2004-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# Contributed by Roy Marples (uberlord@gentoo.org)
+
+# Fix any potential localisation problems
+# Note that LC_ALL trumps LC_anything_else according to locale(7)
+dhcpcd() {
+ LC_ALL=C /sbin/dhcpcd "$@"
+}
+
+# char* dhcpcd_provides(void)
+#
+# Returns a string to change module definition for starting up
+dhcpcd_provides() {
+ echo "dhcp"
+}
+
+# void dhcpcd_depend(void)
+#
+# Sets up the dependancies for the module
+dhcpcd_depend() {
+ after interface
+}
+
+# bool dhcpcd_check_installed(void)
+#
+# Returns 1 if dhcpcd is installed, otherwise 0
+dhcpcd_check_installed() {
+ if [[ -x /sbin/dhcpcd ]]; then
+ if dhcpcd -h 2>&1 | grep -q "etcDir" ; then
+ return 0
+ else
+ ${1:-false} && eerror "We require dhcpcd-1.3.22_p4-r12 or newer"
+ return 1
+ fi
+ fi
+
+ ${1:-false} && eerror "For DHCP (dhcpcd) support, emerge net-misc/dhcpcd"
+ return 1
+}
+
+# bool dhcpcd_check_depends(void)
+#
+# Checks to see if we have the needed functions
+dhcpcd_check_depends() {
+ local f
+
+ for f in interface_exists interface_get_address; do
+ [[ $( type -t "${f}" ) == "function" ]] && continue
+ eerror "dhcpcd: missing required function ${f}\n"
+ return 1
+ done
+
+ return 0
+}
+
+# char* dhcpcd_get_vars(char *interface)
+#
+# Returns a string spaced with possible user set
+# configuration variables
+dhcpcd_get_vars() {
+ echo "dhcpcd_$1 dhcp_$1"
+}
+
+# bool dhcpcd_stop(char *iface)
+#
+# Stop DHCP on an interface by calling dhcpcd -z $iface
+#
+# Returns 0 (true) when a DHCP address dropped
+# otherwise return 1
+dhcpcd_stop() {
+ local iface=$1 count signal pidfile="/var/run/dhcpcd-$1.pid" d
+
+ dhcpcd_check_installed || return 0
+
+ [[ ! -f ${pidfile} ]] && return 0
+
+ ebegin "Stopping dhcpcd on ${iface}"
+ local pid=$( < "${pidfile}" )
+
+ local ifvar=$( bash_variable "${iface}" )
+ eval d=\" \$\{dhcp_${ifvar}\} \"
+ [[ ${d} == " " ]] && d=" ${dhcp} "
+
+ if [[ ${d} == *" release "* ]]; then
+ signal="HUP"
+ else
+ signal="TERM"
+ fi
+
+ kill -s "${signal}" "${pid}" &>/dev/null
+ process_finished "${pid}" dhcpcd
+ eend $? "timed out"
+ return $?
+}
+
+# bool dhcpcd_start(char *iface)
+#
+# Start DHCP on an interface by calling dhcpcd $iface $options
+#
+# Returns 0 (true) when a DHCP address is obtained, otherwise 1
+dhcpcd_start() {
+ local iface="$1" opts hostname pidfile="/var/run/dhcpcd-$1.pid"
+ local ifvar=$( bash_variable "${iface}" ) metric d
+
+ interface_exists "${iface}" true || return 1
+
+ # Get our options
+ eval opts=\" \$\{dhcpcd_${ifvar}\} \"
+
+ # Map some generic options to dhcpcd
+ eval d=\" \$\{dhcp_${ifvar}\} \"
+ [[ ${d} == " " ]] && d=" ${dhcp} "
+ [[ ${d} == *" nodns "* ]] && opts="${opts} -R"
+ [[ ${d} == *" nontp "* ]] && opts="${opts} -N"
+ [[ ${d} == *" nonis "* ]] && opts="${opts} -Y"
+ [[ ${d} == *" nogateway "* ]] && opts="${opts} -G"
+
+ # We transmit the hostname by default
+ if [[ ${d} != *" nosendhost "* && ${opts} != *" -h "* ]]; then
+ hostname=$( hostname )
+ [[ -n ${hostname} && ${hostname} != "(none)" \
+ && ${hostname} != "localhost" ]] \
+ && opts="-h \"${hostname}\" ${opts}"
+ fi
+
+ # Stop dhcpcd from bringing the interface down when we exit
+ opts="${opts} -o"
+
+ # Add our route metric
+ eval metric=\"\$\{metric_${ifvar}\}\"
+ [[ -n ${metric} ]] && opts="${opts} -m ${metric}"
+
+ # Instruct dhcpcd to use our wrapper
+ opts="${opts} -c \"/lib/rcscripts/net.modules.d/helpers.d/dhcpcd-wrapper\""
+
+ # Instruct dhcpcd to create it's files in our state dir
+ opts="${opts} -e \"${statedir}/${iface}\""
+
+ # Bring up DHCP for this interface (or alias)
+ ebegin "Running dhcpcd"
+
+ # Halt any existing dhcpcd process
+ dhcpcd_stop "${iface}"
+
+ [[ ! -d "${statedir}/${iface}" ]] && mkdir -m 0755 -p "${statedir}/${iface}"
+
+ if [[ ${background} == "yes" ]]; then
+ eval dhcpcd ${opts} ${iface} &
+ eend 0
+ go_background
+ fi
+
+ eval dhcpcd ${opts} ${iface}
+ eend $? || return 1
+
+ # DHCP succeeded, show address retrieved
+ local addr=$( interface_get_address "${iface}" )
+ einfo "${iface} received address ${addr}"
+
+ return 0
+}
+
+# vim:ts=4
diff --git a/lib/rcscripts/net.modules.d/essidnet b/lib/rcscripts/net.modules.d/essidnet
new file mode 100644
index 0000000..967776b
--- /dev/null
+++ b/lib/rcscripts/net.modules.d/essidnet
@@ -0,0 +1,79 @@
+#!/bin/bash
+# Copyright (c) 2004-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# Contributed by Roy Marples (uberlord@gentoo.org)
+# Many thanks to all the people in the Gentoo forums for their ideas and
+# motivation for me to make this and keep on improving it
+
+# Load our config if it exists
+[[ -f $(add_suffix "/etc/conf.d/wireless" ) ]] \
+&& source $(add_suffix "/etc/conf.d/wireless" )
+
+# void essidnet_depend(void)
+#
+# Sets up the dependancies for the module
+essidnet_depend() {
+ before interface
+ after wireless
+ installed wireless
+}
+
+# bool essidnet_check_installed(void)
+#
+# Always returns 0 as we are "installed" by wireless in the depend function
+essidnet_check_installed() {
+ return 0
+}
+
+# char* essidnet_provides(void)
+#
+# Returns a string to change module definition for starting up
+essidnet_provides() {
+ echo "essidnet"
+}
+
+# bool essidnet_check_depends(void)
+#
+# Checks to see if we have the needed functions
+essidnet_check_depends() {
+ local f
+
+ for f in wireless_check_extensions wireless_get_essid wireless_get_ap_mac_address; do
+ [[ $( type -t "${f}" ) == "function" ]] && continue
+ eerror "essidnet: missing required function ${f}\n"
+ return 1
+ done
+
+ return 0
+}
+
+# bool essidnet_start(char *iface)
+#
+# All interfaces and module scripts expose modulename_get_vars
+# which returns a space seperated list of user configuration variables
+# We can override each variable here from a given ESSID or the MAC
+# of the AP connected to. MAC configuration takes precedence
+# Always returns 0
+essidnet_pre_start() {
+ local iface="$1"
+
+ wireless_check_extensions "${iface}" || return 0
+
+ local mac=$( wireless_get_ap_mac_address "${iface}" )
+ local ESSID=$( wireless_get_essid "${iface}" )
+ local essid=$( bash_variable ${ESSID} )
+ mac="${mac//:/}"
+
+ vebegin "Configuring ${iface} for ESSID \"${ESSID//\\\\/\\\\}\"" 2>/dev/null
+ configure_variables "${iface}" "${essid}" "${mac}"
+
+ # Backwards compat for old gateway var
+ eval x=\"\$\{gateway_${essid}\}\"
+ [[ -n ${x} ]] && gateway="${iface}/${x}"
+
+ veend 0 2>/dev/null
+ return 0
+}
+
+# vim:ts=4
diff --git a/lib/rcscripts/net.modules.d/helpers.d/dhclient-wrapper b/lib/rcscripts/net.modules.d/helpers.d/dhclient-wrapper
new file mode 100755
index 0000000..075229d
--- /dev/null
+++ b/lib/rcscripts/net.modules.d/helpers.d/dhclient-wrapper
@@ -0,0 +1,45 @@
+#!/bin/bash
+# Copyright (c) 2004-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# Contributed by Roy Marples (uberlord@gentoo.org)
+
+# Instead of writing new functions for dhclient, we simply map their variables
+# over to udhcpc style ones and call those scripts!
+
+case "${reason}" in
+ BOUND|REBOOT|REBIND) action="bound" ;;
+ RENEW) action="renew" ;;
+ RELEASE|PREINIT|FAIL|EXPIRE|TIMEOUT) action="deconfig" ;;
+ MEDIUM) exit 0 ;;
+esac
+
+if [[ -z ${action} ]]; then
+ echo "dhclient sent an unknown action ${reason}!" >&2
+ exit 1
+fi
+
+export ip="${new_ip_address}"
+export subnet="${new_subnet_mask}"
+export broadcast="${new_broadcast_address}"
+export routers="${new_routers}"
+
+export hostname="${new_host_name}"
+
+export dns_domain_${interface}="${new_domain_name}"
+export dns_servers_${interface}="${new_domain_name_servers}"
+
+export ntp_servers_${interface}="${new_domain_name_servers}"
+
+export nis_domain_${interface}="${new_nis_domain}"
+export nis_servers_${interface}="${new_nis_servers}"
+
+/lib/rcscripts/net.modules.d/helpers.d/dhcp "${action}"
+result="$?"
+
+[[ -e /etc/dhcp/dhclient-exit-hooks ]] \
+&& ( . /etc/dhcp/dhclient-exit-hooks )
+
+exit "${result}"
+
+# vim:ts=4
diff --git a/lib/rcscripts/net.modules.d/helpers.d/dhcp b/lib/rcscripts/net.modules.d/helpers.d/dhcp
new file mode 100755
index 0000000..3996c1a
--- /dev/null
+++ b/lib/rcscripts/net.modules.d/helpers.d/dhcp
@@ -0,0 +1,130 @@
+#!/bin/bash
+# Copyright (c) 2004-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# Contributed by Roy Marples (uberlord@gentoo.org)
+
+action="$1"
+service="net.${interface}"
+
+. /lib/rcscripts/net.modules.d/helpers.d/module-loader
+
+# Bring the interface up
+interface_is_up "${interface}" || interface_up "${interface}"
+
+case "${action}" in
+ bound|renew)
+ # We handle these actions below
+ ;;
+ deconfig)
+ # Just remove IPv4 / inet addresses
+ interface_del_addresses "${interface}" true
+ if service_starting "${service}" || service_started "${service}" ; then
+ mark_service_inactive "net.${interface}"
+ fi
+ remove_state "${interface}"
+ if [[ ${RC_AUTO_INTERFACE} == "yes" ]]; then
+ best_interface=$( select_best_interface )
+ apply_state "${best_interface}"
+ fi
+ echo "${action}"
+ exit 0
+ ;;
+ nak)
+ echo "${action}"
+ exit 0
+ ;;
+ leasefail)
+ if service_starting "${service}" || service_started "${service}" ; then
+ mark_service_inactive "net.${interface}"
+ fi
+ echo "${action}"
+ exit 0
+ ;;
+ *)
+ echo "${action}"
+ echo "We don't handle that action" >&2
+ exit 1
+ ;;
+esac
+
+# Map MAC address variables to interface variables
+macnet_pre_start "${interface}" 1>/dev/null
+
+# Map wireless ESSID variables to interface variables
+if [[ -n ${wireless_module} ]]; then
+ if wireless_check_extensions "${interface}" ; then
+ essidnet_pre_start "${interface}" 1>/dev/null
+ fi
+fi
+
+# Calculate the metric for our routes
+ifvar=$( bash_variable "${interface}" )
+eval metric=\"\$\{metric_${ifvar}\}\"
+if [[ -z ${metric} ]]; then
+ if [[ ${RC_AUTO_INTERFACE} == "yes" ]]; then
+ metric=$( calculate_metric "${interface}" )
+ else
+ metric="0"
+ fi
+ eval metric_${ifvar}="${metric}"
+fi
+
+
+eval d=\" \$\{dhcp_${ifvar}\} \"
+[[ ${d} == " " ]] && d=" ${dhcp} "
+
+# Configure our IP address
+ip="${ip// }"
+subnet="${subnet// }"
+cidr=$( netmask2cidr "${subnet}" )
+broadcast="${broadcast// }"
+[[ -n ${broadcast} ]] && broadcast="broadcast ${broadcast}"
+
+# If we don't have our address then we flush it and then add our new one
+curip=$( interface_get_address "${interface}" )
+if [[ ${curip} != "${ip}/${cidr}" ]] ; then
+ # Just remove IPv4 / inet addresses
+ interface_del_addresses "${interface}" true
+ interface_add_address "${interface}" "${ip}/${cidr}" "${broadcast}"
+fi
+
+# Store the address in a cache for future usage
+echo "${ip}" > "/var/cache/dhcp-${interface}.lease"
+chmod 600 "/var/cache/dhcp-${interface}.lease"
+
+# Configure our default route - we only have 1 default route
+if [[ ${d} != *" nogateway "* ]]; then
+ for r in ${routers}; do
+ interface_default_route "${interface}" "${r}" "${metric:-0}" && break
+ done
+fi
+
+# Configure our hostname - but only if we need it
+if [[ -n ${hostname} ]]; then
+ x=$( /bin/hostname )
+ [[ ${x} == "(none)" || ${x} == "localhost" ]] && /bin/hostname "${hostname}"
+fi
+
+[[ ! -d "${statedir}/${interface}" ]] \
+&& mkdir -m 0755 -p "${statedir}/${interface}"
+
+# Only setup the information we're told to
+# By default that's everything
+[[ ${d} != *" nodns "* ]] && system_dns "${interface}"
+[[ ${d} != *" nontp "* ]] && system_ntp "${interface}"
+[[ ${d} != *" nonis "* ]] && system_nis "${interface}"
+
+if [[ ${RC_AUTO_INTERFACE} == "yes" ]]; then
+ best_interface=$( select_best_interface )
+ apply_state "${best_interface}"
+else
+ apply_state "${interface}"
+fi
+
+! service_stopping "${service}" && mark_service_started "${service}"
+
+echo "${action}"
+exit 0
+
+# vim:ts=4
diff --git a/lib/rcscripts/net.modules.d/helpers.d/dhcp-state b/lib/rcscripts/net.modules.d/helpers.d/dhcp-state
new file mode 100644
index 0000000..8bc2681
--- /dev/null
+++ b/lib/rcscripts/net.modules.d/helpers.d/dhcp-state
@@ -0,0 +1,31 @@
+#!/bin/bash
+# Copyright (c) 2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# Contributed by Roy Marples (uberlord@gentoo.org)
+
+MODULES_DIR="/lib/rcscripts/net.modules.d"
+. /lib/rcscripts/sh/rc-services.sh
+. "${MODULES_DIR}/helpers.d/functions"
+conf=$(add_suffix "/etc/conf.d/net")
+[[ -e ${conf} ]] && source "${conf}"
+
+service="net.${interface}"
+
+if [[ ${action} != "up" ]]; then
+ if service_starting "${service}" || service_started "${service}" ; then
+ mark_service_inactive "${service}"
+ fi
+ remove_state "${interface}" false
+else
+ ! service_stopping "${service}" && mark_service_started "${service}"
+fi
+
+if [[ ${RC_AUTO_INTERFACE} == "yes" ]]; then
+ best_interface=$( select_best_interface )
+ apply_state "${best_interface}"
+elif [[ ${action} == "up" ]]; then
+ apply_state "${interface}"
+fi
+
+# vim:ts=4
diff --git a/lib/rcscripts/net.modules.d/helpers.d/dhcpcd-wrapper b/lib/rcscripts/net.modules.d/helpers.d/dhcpcd-wrapper
new file mode 100755
index 0000000..5aa1c53
--- /dev/null
+++ b/lib/rcscripts/net.modules.d/helpers.d/dhcpcd-wrapper
@@ -0,0 +1,48 @@
+#!/bin/bash
+# Copyright (c) 2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# Contributed by Roy Marples (uberlord@gentoo.org)
+
+interface="${1##*/dhcpcd-}"
+interface="${interface%%.info}"
+
+if [[ $2 != "up" && $2 != "new" ]]; then
+ action="down"
+else
+ action="up"
+fi
+
+. /lib/rcscripts/net.modules.d/helpers.d/module-loader
+
+if [[ ${action} == "up" ]]; then
+ # Map MAC address variables to interface variables
+ macnet_pre_start "${interface}" 1>/dev/null
+
+ # Map wireless ESSID variables to interface variables
+ if [[ -n ${wireless_module} ]]; then
+ if wireless_check_extensions "${interface}" ; then
+ essidnet_pre_start "${interface}" 1>/dev/null
+ fi
+ fi
+
+ # Add any search paths if we have any defined
+ ifvar=$( bash_variable "${interface}" )
+ eval d=\" \$\{dhcp_${ifvar}\} \"
+ [[ ${d} == " " ]] && d=" ${dhcp} "
+
+ if [[ ${d} != *" nodns "* ]]; then
+ eval search=\"\$\{dns_search_path_${ifvar}\}\"
+ if [[ -n ${search} ]]; then
+ resolv="${statedir}/${interface}/resolv.conf"
+ tmp="${revolv}.$$"
+ egrep -v "^[ \t]*(search|domain)[ \t]*" "${resolv}" > "${tmp}"
+ echo "search ${search}" >> "${tmp}"
+ mv "${tmp}" "${resolv}"
+ fi
+ fi
+fi
+
+. /lib/rcscripts/net.modules.d/helpers.d/dhcp-state
+
+# vim:ts=4
diff --git a/lib/rcscripts/net.modules.d/helpers.d/functions b/lib/rcscripts/net.modules.d/helpers.d/functions
new file mode 100644
index 0000000..f09d15d
--- /dev/null
+++ b/lib/rcscripts/net.modules.d/helpers.d/functions
@@ -0,0 +1,526 @@
+#!/bin/bash
+# Copyright (c) 2004-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# We will be loaded after conf.d/rc and conf.d/net so we can set a default
+# here.
+RC_AUTO_INTERFACE="${RC_AUTO_INTERFACE:-no}"
+
+netdir="/var/lib/net-scripts"
+statedir="${netdir}/state"
+
+# Contributed by Roy Marples (uberlord@gentoo.org)
+
+# char* interface_device(char *iface)
+#
+# Gets the base device of the interface
+# Can handle eth0:1 and eth0.1
+# Which returns eth0 in this case
+interface_device() {
+ local dev="${1%%.*}"
+ [[ ${dev} == "$1" ]] && dev="${1%%:*}"
+ echo "${dev}"
+}
+
+# char* interface_type(char* iface)
+#
+# Returns the base type of the interface
+# eth, ippp, etc
+interface_type() {
+ echo "${1%%[0-9]*}"
+}
+
+# void save_state(char *interface)
+#
+# Saves state information regarding the interface
+save_state() {
+ local iface="$1"
+ local d="${statedir}/${iface}"
+
+ [[ ! -d ${d} ]] && mkdir -m 0755 -p "${d}"
+ cp -a /etc/resolv.conf /etc/ntp.conf /etc/yp.conf "${d}" 2>/dev/null
+}
+
+# void remove_state(char *interface)
+#
+# Removes state information regarding the interface
+remove_state() {
+ local d="${statedir}/$1"
+
+ [[ -d ${d} ]] && rm -Rf "${d}"
+ [[ ! ${2:-true} ]] && mkdir -m 0755 -p "${d}"
+}
+
+# void apply_state(char *interface)
+#
+# Apply's state information about the interface to the system
+# If the files in the state dir are not links back to etc then
+# we create them if RC_AUTO_INTERFACE="yes"
+#
+apply_state() {
+ local iface="$1"
+
+ if [[ -z ${iface} ]]; then
+ iface=$( select_best_interface )
+ [[ -z ${iface} ]] && return
+ fi
+
+ local d="${statedir}/${iface}"
+ if [[ -d ${d} ]]; then
+ local files=$( ls "${d}" )
+ if [[ -n ${files} ]] ; then
+ if [[ ${RC_AUTO_INTERFACE} == "yes" ]]; then
+ cp -aR "${d}"/* "${netdir}"
+ local file
+ for file in ${files} ; do
+ # Skip .sv files
+ [[ ${file} == *".sv" ]] && contine
+ local link=$( readlink "/etc/${file}" 2>/dev/null )
+ if [[ ${link} != "${netdir}/${file}" ]]; then
+ [[ -e "/etc/${file}" ]] && rm -f "/etc/${file}"
+ ln -snf "${netdir}/${file}" "/etc/${file}"
+ fi
+ done
+ else
+ cp -ar "${d}"/* /etc
+ fi
+ fi
+ fi
+
+ [[ ${RC_AUTO_INTERFACE} == "yes" ]] && merge_configs
+}
+
+# char* order_interfaces(bool require_gateway)
+#
+# Lists the interfaces in route metric order that we have configured
+# (ie a state dir exists)
+# require_gateway defaults to false
+order_interfaces() {
+ local ifaces
+ if [[ ${1:-false} == "true" ]]; then
+ ifaces=$(awk '$2!="Gateway" { print $7, $1 }' /proc/net/route \
+ | sort -n | cut -d' ' -f2 | uniq)
+ else
+ ifaces=$(awk '$2=="00000000" { print $7, $1 }' /proc/net/route \
+ | sort -n | cut -d' ' -f2 )
+ fi
+ local i order
+ for i in ${ifaces}; do
+ [[ -d "${statedir}/${i}" ]] && order="${order}${i} "
+ done
+
+ echo "${order}"
+}
+
+# void merge_resolv()
+#
+# Merges the resolv.conf info from active interfaces
+merge_resolv() {
+ local -a ifaces=( $(order_interfaces) )
+ local i j f
+
+ # We only work for ifaces with a resolv.conf
+ j=${#ifaces[@]}
+ for (( i=0; i<j; i++ )); do
+ [[ ! -e "${statedir}/${ifaces[i]}/resolv.conf" ]] && unset ifaces[i]
+ done
+ ifaces=( "${ifaces[@]}" )
+
+ # No point merging unless there are two or more interfaces
+ [[ ${#ifaces[@]} -lt 2 ]] && return
+
+ veinfo "Merging resolv.conf from interfaces ${ifaces[@]}"
+
+ local -a search srvs
+ j=0
+ for (( i=0; i<${#ifaces[@]}; i++ )); do
+ f="${statedir}/${ifaces[i]}/resolv.conf"
+ srvs[i]=$( sed -n -e 's/^[ \t]*nameserver[ \t]*\([^#]\)/\1/p' "${f}" \
+ | sed 2q )
+ if [[ -z ${srvs[i]} ]]; then
+ unset srvs[i]
+ continue
+ fi
+
+ search[i]=$( sed -n -e 's/^[ \t]*\(domain\|search\)[ \t]*\([^#]\)/\2/p' \
+ "${f}" | sed -e '$!d' )
+
+ # No point in handling more than 3 interfaces due to libc limits
+ (( j++ ))
+ [[ ${j} -gt 2 ]] && break
+ done
+ srvs=( "${srvs[@]}" )
+ search=( ${search[@]} )
+
+ local new_srvs
+ j=0
+ # Add interface primary nameservers
+ for (( i=0;i<${#srvs[@]}; i++ )); do
+ local -a n=( ${srvs[i]} )
+ if [[ " ${new_srvs} " != *" ${n[0]} "* ]]; then
+ new_srvs="${new_srvs} ${n[0]}"
+ # libc can only handle 3 name servers
+ (( j++ ))
+ [[ ${j} -gt 2 ]] && break
+ fi
+ done
+
+ # Add interface secondary nameservers
+ if [[ ${j} -lt 3 ]]; then
+ for (( i=0;i<${#srvs[@]}; i++ )); do
+ local -a n=( ${srvs[i]} )
+ [[ -z ${n[1]} ]] && continue
+ if [[ " ${new_srvs} " != *" ${n[1]} "* ]]; then
+ new_srvs="${new_srvs} ${n[1]}"
+ # libc can only handle 3 name servers
+ (( j++ ))
+ [[ ${j} -gt 2 ]] && break
+ fi
+ done
+ fi
+
+ local new_search n_search=0
+ for i in ${search[@]}; do
+ if [[ " ${new_search} " != *" ${i} "* ]]; then
+ new_search="${new_search} ${i}"
+ # lib limits us to 6 search domains
+ (( n_search++ ))
+ [[ ${n_search} -gt 5 ]] && break
+ fi
+ done
+
+ # Now we create a new resolv.conf to use
+ local f="${netdir}/resolv.conf.$$"
+ echo "# Generated by net-scripts from interfaces ${ifaces[@]}" > "${f}"
+ chmod 644 "${f}"
+ for i in ${new_srvs[@]}; do
+ echo "nameserver ${i}" >> "${f}"
+ done
+ if [[ -n ${new_search} ]]; then
+ if [[ ${n_search} == "1" ]]; then
+ echo "domain${new_search}" >> "${f}"
+ else
+ echo "search${new_search}" >> "${f}"
+ fi
+ fi
+ mv "${f}" "${netdir}/resolv.conf"
+}
+
+
+# void merge_ntp()
+#
+# Merges the ntp.conf info from active interfaces
+merge_ntp() {
+ local -a ifaces=( $(order_interfaces) )
+ local i j f
+
+ # We only work for ifaces with a ntp.conf
+ j=${#ifaces[@]}
+ for (( i=0; i<j; i++ )); do
+ [[ ! -e "${statedir}/${ifaces[i]}/ntp.conf" ]] && unset ifaces[i]
+ done
+ ifaces=( "${ifaces[@]}" )
+
+ # No point merging unless there are two or more interfaces
+ [[ ${#ifaces[@]} -lt 2 ]] && return
+
+ veinfo "Merging ntp.conf from interfaces ${ifaces[@]}"
+
+ local srvs
+ for (( i=0; i<${#ifaces[@]}; i++ )); do
+ f="${statedir}/${ifaces[i]}/ntp.conf"
+ srvs="${srvs} $( sed -n -e 's/^[ \t]*server[ \t]*\([^#]\)/\1/p' "${f}" )"
+ done
+
+ # ntp does it's own preference list, so we just remove duplicates
+ sort_unique() {
+ set -- " ${@/%/\n}"
+ echo -e "$@" | sort -u
+ }
+
+ srvs=$( sort_unique ${srvs} )
+
+ f="${netdir}/ntp.conf.$$"
+ echo "# Generated by net-scripts for interfaces ${ifaces[@]}" > "${f}"
+ chmod 644 "${f}"
+
+ echo "restrict default noquery notrust nomodify" >> "${f}"
+ echo "restrict 127.0.0.1" >> "${f}"
+
+ for i in ${srvs}; do
+ echo "restrict ${i} nomodify notrap noquery" >> "${f}"
+ echo "server ${i}" >> "${f}"
+ done
+
+ echo "driftfile /var/lib/ntp/ntp.drift" >> "${f}"
+ echo "logfile /var/log/ntp.log" >> "${f}"
+
+ mv "${f}" "${netdir}/ntp.conf"
+}
+
+# void merge_configs()
+#
+# Merge config files together
+merge_configs() {
+ merge_resolv
+ merge_ntp
+}
+
+# char* select_best_interface()
+#
+# Selects the best interface to apply state information to
+# This is currently based on routing metrics
+select_best_interface() {
+ local -a ifs=( $(order_interfaces true) )
+
+ # We never select lo as the best interface
+ local x=" ${ifs[@]} "
+ ifs=( ${x// lo / } )
+
+ local iface
+ for iface in ${ifs[@]} ; do
+ if [[ -e "${statedir}/${iface}/resolv.conf" ]]; then
+ echo "${iface}"
+ return 0
+ fi
+ done
+
+ echo "${ifs[0]}"
+}
+
+# int calculate_metric(char *interface)
+#
+# Calculates the best metric for the interface
+# The Linux kernel does not use this at the moment, but we use it so that
+# default routes remain and we can work out the "best" interface
+calculate_metric() {
+ local iface="$1" exclude='$1!="Iface" && $1!="lo"'
+
+ # Have we already got a metric?
+ local m=$( awk '$1=="'${iface}'" && $2=="00000000" { print $7 }' \
+ /proc/net/route )
+ if [[ -n ${m} ]]; then
+ echo "${m}"
+ return 0
+ fi
+
+ local itype=$( interface_type "${iface}" ) x i
+
+ # If we're not a wireless device then exclude wireless from the
+ # routing table so we stay < 1000
+ if [[ -e /proc/net/wireless ]]; then
+ if ! grep -q "^[ \t]*${iface}:[ \t]" /proc/net/wireless ; then
+ local i=$( sed -n -e 's/^[ \t]*\(.*\):.*/\1/p' /proc/net/wireless )
+ for x in ${i} ; do
+ exclude="${exclude} && "'$1'"!=\"${x}\""
+ done
+ fi
+ fi
+
+ # Exclude ppp and ippp as well
+ local ix="ppp|ippp"
+ [[ ${itype} == "ppp" ]] && ix="ippp"
+ [[ ${itype} == "ippp" ]] && ix="ppp"
+ i=$( sed -n -e 's/^[ ]*\('${ix}'[0-9]*\):.*$/\1/p' /proc/net/dev )
+ for x in ${i} ; do
+ exclude="${exclude} && "'$1'"!=\"${x}\""
+ done
+
+ local m=$( awk "${exclude} { print "'$7'" }" /proc/net/route \
+ | sort -rn | head -n 1 | cut -d' ' -f2 )
+ m="${m:--1}"
+ (( m ++ ))
+
+ # If we're a wireless device then add 1000 so that wired interfaces take preference
+ if [[ -e /proc/net/wireless ]]; then
+ grep -q "^[ \t]*${iface}:[ \t]" /proc/net/wireless && (( m+= 1000 ))
+ fi
+
+ # If we're a ppp device then we add 2000 for ISDN, otherwise 3000
+ [[ ${itype} == "ippp" ]] && (( m+= 2000 ))
+ [[ ${itype} == "ppp" ]] && (( m+= 3000 ))
+
+ echo "${m}"
+}
+
+# int netmask2cidr(char *netmask)
+#
+# Returns the CIDR of a given netmask
+netmask2cidr() {
+ local binary="" i bin
+
+ for i in ${1//./ }; do
+ bin=""
+ while [[ ${i} != "0" ]]; do
+ bin=$[${i}%2]${bin}
+ (( i=i>>1 ))
+ done
+ binary="${binary}${bin}"
+ done
+ binary="${binary%%0*}"
+ echo "${#binary}"
+}
+
+# char* netmask2cidr(int cidr)
+#
+# Returns the netmask of a given CIDR
+cidr2netmask() {
+ local cidr="$1" netmask="" done=0 i sum=0 cur=128
+ local octets frac
+
+ (( octets=cidr/8 ))
+ (( frac=cidr%8 ))
+ while [[ octets -gt 0 ]]; do
+ netmask="${netmask}.255"
+ (( octets-- ))
+ (( done++ ))
+ done
+
+ if [[ ${done} -lt 4 ]]; then
+ for (( i=0; i<${frac}; i++ )); do
+ (( sum+=cur ))
+ (( cur/=2 ))
+ done
+ netmask="${netmask}.${sum}"
+ (( done++ ))
+
+ while [[ ${done} -lt 4 ]]; do
+ netmask="${netmask}.0"
+ (( done++ ))
+ done
+ fi
+
+ echo "${netmask:1}"
+}
+
+# char* ip_network(char *ip, char *netmask)
+#
+# Returns the network of the ip address
+# ip can be 192.168.0.51/24
+# or
+# ip can be 192.168.0.51 and netmask is 255.255.255.0
+ip_network() {
+ local ip="$1" mask="$2" i network x
+
+ # If we didn't get parameter 2 then assume we have a CIDR
+ if [[ -z ${mask} ]]; then
+ mask="${ip##*/}"
+ [[ -z ${mask} || ${mask} == ${ip} ]] && return 1
+ mask=$( cidr2netmask "${mask}" )
+ ip="${ip%%/*}"
+ fi
+
+ ip=( ${ip//./ } )
+ mask=( ${mask//./ } )
+
+ for (( i=0; i<4; i++ )); do
+ (( x=ip[i] & mask[i] ))
+ network="${network}${x}"
+ [[ ${i} -lt 3 ]] && network="${network}."
+ done
+
+ echo "${network}"
+}
+
+# bool clean_pidfile(char *file)
+#
+# Removes the given pidfile if the process is not running
+# Returns 1 if the process is still running otherwise 0
+clean_pidfile() {
+ local pidfile="$1"
+
+ [[ ! -f ${pidfile} ]] && return 0
+ local pid=$( < "${pidfile}" )
+
+ if [[ -n ${pid} ]]; then
+ local cmd="${pidfile##*/}"
+ cmd="${cmd%%-*}"
+ ps -p "${pid}" 2>/dev/null | grep -q "${cmd}" && return 1
+ fi
+
+ rm -f "${pidfile}"
+ return 0
+}
+
+# bool process_finished(int pid, char* cmd)
+#
+# We wait for 10 seconds until the command ${cmd}
+# stops running on the process ${pid}
+process_finished() {
+ local i pid="$1" cmd="$2" secs="${3:-9}"
+
+ for (( i=0; i<secs; i++ )); do
+ ps -p "${pid}" 2>/dev/null | grep -q "${cmd}" || return 0
+ sleep 1
+ done
+
+ return 1
+}
+
+# void function_wrap(char* source, char* target)
+#
+# wraps function calls - for example function_wrap(this, that)
+# maps function names this_* to that_*
+function_wrap() {
+ local i
+
+ [[ $( type -t "${2}_provides" ) == "function" ]] && return
+
+ for i in $( typeset -f | grep -o '^'"${1}"'_[^ ]*' ); do
+ eval "${2}${i#${1}}() { ${i} \"\$@\"; }"
+ done
+}
+
+# char[] * expand_parameters(char *cmd)
+#
+# Returns an array after expanding parameters. For example
+# "192.168.{1..3}.{1..3}/24 brd +"
+# will return
+# "192.168.1.1/24 brd +"
+# "192.168.1.2/24 brd +"
+# "192.168.1.3/24 brd +"
+# "192.168.2.1/24 brd +"
+# "192.168.2.2/24 brd +"
+# "192.168.2.3/24 brd +"
+# "192.168.3.1/24 brd +"
+# "192.168.3.2/24 brd +"
+# "192.168.3.3/24 brd +"
+expand_parameters() {
+ local x="$( eval echo ${@// /_} )"
+ local -a a=( ${x} )
+
+ a=( "${a[@]/#/\"}" )
+ a=( "${a[@]/%/\"}" )
+ echo "${a[*]//_/ }"
+}
+
+# void configure_variables(char *interface, char *option1, [char *option2])
+#
+# Maps configuration options from <variable>_<option> to <variable>_<iface>
+# option2 takes precedence over option1
+configure_variables() {
+ local iface="$1" option1="$2" option2="$3"
+
+ local mod func x i
+ local -a ivars ovars1 ovars2
+ local ifvar=$( bash_variable "${iface}" )
+
+ for mod in ${MODULES[@]}; do
+ func="${mod}_get_vars"
+ if [[ $( type -t ${func} ) == "function" ]]; then
+ ivars=( $( "${func}" "${ifvar}" ) )
+ ovars1=( $( "${func}" "${option1}" ) )
+ [[ -n ${option2} ]] && ovars2=( $( "${func}" "${option2}" ) )
+ for ((i = 0; i<${#ivars[@]}; i++)); do
+ x=""
+ [[ -n ${ovars2[i]} ]] && eval x=( \"\$\{${ovars2[i]}\[@\]\}\" )
+ [[ -z ${x} ]] && eval x=( \"\$\{${ovars1[i]}\[@\]\}\" )
+ [[ -n ${x} ]] && eval "${ivars[i]}=( "\"\$\{x\[@\]\}\"" )"
+ done
+ fi
+ done
+
+ return 0
+}
+
+# vim:ts=4
diff --git a/lib/rcscripts/net.modules.d/helpers.d/module-loader b/lib/rcscripts/net.modules.d/helpers.d/module-loader
new file mode 100644
index 0000000..f4f5f95
--- /dev/null
+++ b/lib/rcscripts/net.modules.d/helpers.d/module-loader
@@ -0,0 +1,47 @@
+#!/bin/bash
+# Copyright (c) 2004-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# Contributed by Roy Marples (uberlord@gentoo.org)
+
+[[ -z ${MODULES_DIR} ]] && MODULES_DIR="/lib/rcscripts/net.modules.d"
+. "${MODULES_DIR}/system"
+. /lib/rcscripts/sh/rc-services.sh
+. "${MODULES_DIR}/helpers.d/functions"
+conf=$(add_suffix "/etc/conf.d/net")
+[[ -e ${conf} ]] && source "${conf}"
+
+# Guess which interface module to load - we prefer iproute2
+if [[ -x /sbin/ip ]]; then
+ interface_module="iproute2"
+elif [[ -x /sbin/ifconfig ]]; then
+ interface_module="ifconfig"
+else
+ echo "Can't find a known interface module" >&2
+ exit 1
+fi
+
+# iwconfig is the best bet for wireless - we use wpa_supplicant
+# only if we need to
+if [[ -x /sbin/iwconfig ]]; then
+ wireless_module="iwconfig"
+elif [[ -x /sbin/wpa_supplicant \
+ && -S "/var/run/wpa_supplicant/${interface}" ]]; then
+ wireless_module="wpa_supplicant"
+fi
+
+MODULES=( "system" )
+
+# Load our modules
+. "${MODULES_DIR}/${interface_module}"
+function_wrap "${interface_module}" interface
+. "${MODULES_DIR}/macnet"
+. "${MODULES_DIR}/system"
+
+if [[ -n ${wireless_module} ]]; then
+ . "${MODULES_DIR}/${wireless_module}"
+ function_wrap "${wireless_module}" wireless
+ . "${MODULES_DIR}/essidnet"
+fi
+
+# vim:ts=4
diff --git a/lib/rcscripts/net.modules.d/helpers.d/pump-wrapper b/lib/rcscripts/net.modules.d/helpers.d/pump-wrapper
new file mode 100755
index 0000000..93566b5
--- /dev/null
+++ b/lib/rcscripts/net.modules.d/helpers.d/pump-wrapper
@@ -0,0 +1,14 @@
+#!/bin/bash
+# Copyright (c) 2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# Contributed by Roy Marples (uberlord@gentoo.org)
+
+[[ $1 == "renewal" ]] && exit 0
+
+action="$1"
+interface="$2"
+
+. /lib/rcscripts/net.modules.d/helpers.d/dhcp-state
+
+# vim:ts=4
diff --git a/lib/rcscripts/net.modules.d/helpers.d/udhcpc-wrapper b/lib/rcscripts/net.modules.d/helpers.d/udhcpc-wrapper
new file mode 100755
index 0000000..feb01e6
--- /dev/null
+++ b/lib/rcscripts/net.modules.d/helpers.d/udhcpc-wrapper
@@ -0,0 +1,20 @@
+#!/bin/sh
+# Copyright (c) 2004-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# Contributed by Roy Marples (uberlord@gentoo.org)
+
+# Map the dns, ntp and nis info so our system module can apply the setup
+
+export dns_domain_${interface}="${domain}"
+export dns_servers_${interface}="${dns}"
+export routers="${router}"
+
+export ntp_servers_${interface}="${ntpsrv}"
+
+export nis_domain_${interface}="${nisdomain}"
+export nis_servers_${interface}="${nissrv}"
+
+/lib/rcscripts/net.modules.d/helpers.d/dhcp "$@"
+
+# vim:ts=4
diff --git a/lib/rcscripts/net.modules.d/ifconfig b/lib/rcscripts/net.modules.d/ifconfig
new file mode 100644
index 0000000..0344647
--- /dev/null
+++ b/lib/rcscripts/net.modules.d/ifconfig
@@ -0,0 +1,435 @@
+#!/bin/bash
+# Copyright (c) 2004-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# Contributed by Roy Marples (uberlord@gentoo.org)
+
+# Fix any potential localisation problems
+# Note that LC_ALL trumps LC_anything_else according to locale(7)
+ifconfig() {
+ LC_ALL=C /sbin/ifconfig "$@"
+}
+
+ifconfig_tunnel() {
+ LC_ALL=C /sbin/iptunnel "$@"
+}
+
+route() {
+ LC_ALL=C /sbin/route "$@"
+}
+
+# void ifconfig_depend(void)
+#
+# Sets up the dependancies for the module
+ifconfig_depend() {
+ after macnet wireless
+}
+
+# bool ifconfig_check_installed(void)
+#
+# Returns 1 if ifconfig is installed, otherwise 0
+ifconfig_check_installed() {
+ [[ -x /sbin/ifconfig ]] && return 0
+ ${1:-false} && eerror "For ifconfig support, emerge sys-apps/net-tools"
+ return 1
+}
+
+# char* ifconfig_provides(void)
+#
+# Returns a string to change module definition for starting up
+ifconfig_provides() {
+ echo "interface"
+}
+
+# char* ifconfig_module(void)
+#
+# Returns the module name
+# This is needed by dhclient as we run different scripts
+# based on the interface
+ifconfig_module() {
+ echo "ifconfig"
+}
+
+# bool ifconfig_check_depends(void)
+#
+# Checks to see if we have the needed functions
+ifconfig_check_depends() {
+ return 0
+}
+
+# bool ifconfig_exists(char *interface, bool report)
+#
+# Returns 1 if the interface exists, otherwise 0
+ifconfig_exists() {
+ local e=$( ifconfig -a | grep -o "^$1" ) report="${2:-false}"
+ [[ -n ${e} ]] && return 0
+ ${report} && eerror "$1 does not exist"
+ return 1
+}
+
+# void ifconfig_up(char *iface)
+#
+# provides a generic interface for bringing interfaces up
+ifconfig_up() {
+ ifconfig "$1" up
+}
+
+# void ifconfig_down(char *iface)
+#
+# provides a generic interface for bringing interfaces down
+ifconfig_down() {
+ ifconfig "$1" down
+}
+
+# bool ifconfig_is_up(char *iface, bool withaddress)
+#
+# Returns 0 if the interface is up, otherwise 1
+# If withaddress is true then the interface has to have an IPv4 address
+# assigned as well
+ifconfig_is_up() {
+ local check="\<UP\>" addr="${2:-false}"
+ ${addr} && check="\<inet addr:.*${check}"
+ ifconfig "$1" | grep -Eq "${check}" && return 0
+ return 1
+}
+
+# void ifconfig_set_flag(char *iface, char *flag, bool enabled)
+#
+# Sets or disables the interface flag
+ifconfig_set_flag() {
+ local iface="$1" flag="$2" enable="$3"
+ ${enable} || flag="-${flag}"
+ ifconfig "${iface}" "${flag}"
+}
+
+# void ifconfig_get_address(char *interface)
+#
+# Fetch the address retrieved by DHCP. If successful, echoes the
+# address on stdout, otherwise echoes nothing.
+ifconfig_get_address() {
+ local -a x=( $( ifconfig "$1" \
+ | sed -n -e 's/.*inet addr:\([^ ]*\).*Mask:\([^ ]*\).*/\1 \2/p' ) )
+ x[1]=$( netmask2cidr "${x[1]}" )
+ echo "${x[0]}/${x[1]}"
+}
+
+# void ifconfig_get_mac_address(char *interface)
+#
+# Fetch the mac address assingned to the network card
+ifconfig_get_mac_address() {
+ ifconfig "$1" | sed -n -e 's/.*HWaddr .*\<\(..:..:..:..:..:..\)\>.*/\U\1/p'
+}
+
+# void ifconfig_set_mac_address(char *interface, char *mac)
+#
+# Assigned the mac address to the network card
+ifconfig_set_mac_address() {
+ ifconfig "$1" hw ether "$2"
+}
+
+# int ifconfig_set_name(char *interface, char *new_name)
+#
+# Renames the interface
+# This will not work if the interface is setup!
+ifconfig_set_name() {
+ [[ -z $2 ]] && return 1
+ local current="$1" new="$2"
+
+ local mac=$( ifconfig_get_mac_address "${current}" )
+ if [[ -z ${mac} ]]; then
+ eerror "${iface} does not have a MAC address"
+ return 1
+ fi
+
+ /sbin/nameif "${new}" "${mac}"
+}
+
+# void ifconfig_get_aliases_rev(char *interface)
+#
+# Fetch the list of aliases for an interface.
+# Outputs a space-separated list on stdout, in reverse order, for
+# example "eth0:2 eth0:1"
+ifconfig_get_aliases_rev() {
+ ifconfig | grep -o "^$1:[0-9]* " | tac
+}
+
+# bool ifconfig_del_addresses(char *interface, bool onlyinet)
+#
+# Remove addresses from interface. Returns 0 (true) if there
+# were addresses to remove (whether successful or not). Returns 1
+# (false) if there were no addresses to remove.
+# If onlyinet is true then we only delete IPv4 / inet addresses
+ifconfig_del_addresses() {
+ local iface="$1" i onlyinet="${2:-false}"
+ # We don't remove addresses from aliases
+ [[ ${iface} == *:* ]] && return 0
+
+ # If the interface doesn't exist, don't try and delete
+ ifconfig_exists "${iface}" || return 0
+
+ # iproute2 can add many addresses to an iface unlike ifconfig ...
+ # iproute2 added addresses cause problems for ifconfig
+ # as we delete an address, a new one appears, so we have to
+ # keep polling
+ while ifconfig "${iface}" | grep -q -m1 -o 'inet addr:[^ ]*' ; do
+ ifconfig "${iface}" 0.0.0.0 || break
+ done
+
+ # Remove IPv6 addresses
+ if ! ${onlyinet} ; then
+ for i in $( ifconfig "${iface}" \
+ | sed -n -e 's/^.*inet6 addr: \([^ ]*\) Scope:[^L].*/\1/p' ) ; do
+ /sbin/ifconfig "${iface}" inet6 del "${i}"
+ done
+ fi
+ return 0
+}
+
+# char* ifconfig_get_vars(char *interface)
+#
+# Returns a string spaced with possible user set
+# configuration variables
+ifconfig_get_vars() {
+ echo "config_$1 routes_$1 fallback_$1 metric_$1 ifconfig_$1 \
+ ifconfig_fallback_$1 routes_$1 inet6_$1 iface_$1 alias_$1 \
+ broadcast_$1 netmask_$1"
+ # The depreciated gateway var has to be handled by
+ # each module if needed
+}
+
+# bool ifconfig_get_old_config(char *iface)
+#
+# Returns config and config_fallback for the given interface
+ifconfig_get_old_config() {
+ local iface="$1" ifvar=$( bash_variable "$1" ) i inet6
+
+ eval config=( \"\$\{ifconfig_${ifvar}\[@\]\}\" )
+ eval config_fallback=( \"\$\{ifconfig_fallback_${ifvar}\[@\]\}\" )
+ eval inet6=( \"\$\{inet6_${ifvar}\[@\]\}\" )
+
+ # BACKWARD COMPATIBILITY: populate the config_IFACE array
+ # if iface_IFACE is set (fex. iface_eth0 instead of ifconfig_eth0)
+ eval i=\"\$\{iface_${ifvar}\}\"
+ if [[ -n ${i} && -z ${config} ]]; then
+ # Make sure these get evaluated as arrays
+ local -a aliases broadcasts netmasks
+
+ # Start with the primary interface
+ config=( "${i}" )
+
+ # ..then add aliases
+ eval aliases=( \$\{alias_${ifvar}\} )
+ eval broadcasts=( \$\{broadcast_${ifvar}\} )
+ eval netmasks=( \$\{netmask_${ifvar}\} )
+ for (( i=0; i<${#aliases[@]}; i++ )); do
+ config[i+1]="${aliases[i]} ${broadcasts[i]:+broadcast ${broadcasts[i]}} ${netmasks[i]:+netmask ${netmasks[i]}}"
+ done
+ fi
+
+ # BACKWARD COMPATIBILITY: check for space-separated inet6 addresses
+ [[ ${#inet6[@]} == 1 && ${inet6} == *' '* ]] && inet6=( ${inet6} )
+
+ # Add inet6 addresses to our config if required
+ [[ -n ${inet6} ]] && config=( "${config[@]}" "${inet6[@]}" )
+
+ return 0
+}
+
+# bool ifconfig_iface_stop(char *interface)
+#
+# Do final shutdown for an interface or alias.
+#
+# Returns 0 (true) when successful, non-zero (false) on failure
+ifconfig_iface_stop() {
+ # If an alias is already down, then "ifconfig eth0:1 down"
+ # will try to bring it up with an address of "down" which
+ # fails. Do some double-checking before returning error
+ # status
+ ifconfig_is_up "$1" || return 0
+ ifconfig_down "$1" && return 0
+
+ # It is sometimes impossible to transition an alias from the
+ # UP state... particularly if the alias has no address. So
+ # ignore the failure, which should be okay since the entire
+ # interface will be shut down eventually.
+ [[ $1 == *:* ]] && return 0
+ return 1
+}
+
+# bool ifconfig_pre_start(char *interface)
+#
+# Runs any pre_start stuff on our interface - just the MTU atm
+# We set MTU twice as it may be needed for DHCP - a dhcp client could
+# change it in error, so we set MTU in post start too
+ifconfig_pre_start() {
+ local iface="$1"
+
+ interface_exists "${iface}" || return 0
+
+ local ifvar=$( bash_variable "$1" ) mtu
+
+ # MTU support
+ eval mtu=\"\$\{mtu_${ifvar}\}\"
+ [[ -n ${mtu} ]] && ifconfig "${iface}" mtu "${mtu}"
+
+ return 0
+}
+
+
+# bool ifconfig_post_start(char *iface)
+#
+# Bring up iface using ifconfig utilities, called from iface_start
+#
+# Returns 0 (true) when successful on the primary interface, non-zero
+# (false) when the primary interface fails. Aliases are allowed to
+# fail, the routine should still return success to indicate that
+# net.eth0 was successful
+ifconfig_post_start() {
+ local iface="$1" ifvar=$( bash_variable "$1" ) routes x metric mtu cidr
+ eval metric=\"\$\{metric_${ifvar}\}\"
+
+ # Make sure interface is marked UP
+ ifconfig_up "${iface}"
+
+ # MTU support
+ eval mtu=\"\$\{mtu_${ifvar}\}\"
+ [[ -n ${mtu} ]] && ifconfig "${iface}" mtu "${mtu}"
+
+ eval routes=( \"\$\{routes_${ifvar}\[@\]\}\" )
+
+ # BACKWARD COMPATIBILITY: set the default gateway
+ if [[ ${gateway} == "${iface}/"* ]]; then
+ # We don't add the old gateway if one has been set in routes_IFACE
+ local gw=true
+ for x in "${routes[@]}"; do
+ [[ ${x} != *"default gw"* ]] && continue
+ gw=false
+ break
+ done
+ ${gw} && routes=( "${routes[@]}" "default gw ${gateway#*/}" )
+ fi
+
+ [[ -z ${routes} ]] && return 0
+
+ # Add routes for this interface, might even include default gw
+ einfo "Adding routes"
+ eindent
+ for x in "${routes[@]}"; do
+ ebegin "${x}"
+
+ # Support iproute2 style routes
+ x="${x//via/gw} "
+ x="${x//scope * / }"
+
+ # Assume we're a net device unless told otherwise
+ [[ " ${x} " != *" -net "* && " ${x} " != *" -host "* ]] && x="-net ${x}"
+
+ # Support adding IPv6 addresses easily
+ [[ ${x} == *:* && ${x} != *"-A inet6"* ]] && x="-A inet6 ${x}"
+
+ # Add a metric if we don't have one
+ [[ ${x} != *" metric "* ]] && x="${x} metric ${metric}"
+
+ route add ${x} dev "${iface}"
+ eend $?
+ done
+ eoutdent
+
+ return 0
+}
+
+# bool ifconfig_add_address(char *iface, char *options ...)
+#
+# Adds the given address to the interface
+ifconfig_add_address() {
+ local iface="$1" i=0 r e
+
+ ifconfig_exists "${iface}" true || return 1
+
+ # Extract the config
+ local -a config=( "$@" )
+ config=( ${config[@]:1} )
+
+ if [[ ${config[0]} == *:* ]]; then
+ # Support IPv6 - nice and simple
+ config[0]="inet6 add ${config[0]}"
+ else
+ # IPv4 is tricky - ifconfig requires an aliased device
+ # for multiple addresses
+ if ifconfig "${iface}" | grep -Eq "\<inet addr:.*" ; then
+ # Get the last alias made for the interface and add 1 to it
+ i=$( ifconfig | tac | grep -m 1 -o "^${iface}:[0-9]*" \
+ | sed -n -e 's/'"${iface}"'://p' )
+ i="${i:-0}"
+ (( i++ ))
+ iface="${iface}:${i}"
+ fi
+
+ # ifconfig doesn't like CIDR addresses
+ local ip="${config[0]%%/*}" cidr="${config[0]##*/}" netmask
+ if [[ -n ${cidr} && ${cidr} != "${ip}" ]]; then
+ netmask=$( cidr2netmask "${cidr}" )
+ config[0]="${ip} netmask ${netmask}"
+ fi
+
+ # Support iproute2 style config where possible
+ r="${config[@]}"
+ config=( ${r//brd +/} )
+ config=( "${config[@]//brd/broadcast}" )
+ config=( "${config[@]//peer/pointtopoint}" )
+ fi
+
+ # Ensure that the interface is up so we can add IPv6 addresses
+ interface_up "${iface}"
+
+ # Some kernels like to apply lo with an address when they are brought up
+ if [[ ${iface} == "lo" && ${config[@]} == "127.0.0.1 netmask 255.0.0.0 broadcast 127.255.255.255" ]]; then
+ ifconfig "${iface}" 0.0.0.0
+ fi
+
+ ifconfig "${iface}" ${config[@]}
+ r="$?"
+ [[ ${r} != "0" ]] && return ${r}
+
+ local metric ifvar=$( bash_variable "${iface}" )
+ # Remove the newly added route and replace with our metric
+ eval metric=\"\$\{metric_${ifvar}\}\"
+ [[ ${metric} == "0" || ${RC_AUTO_INTERFACE} != "yes" ]] && return ${r}
+
+ if [[ -z ${netmask} ]]; then
+ for (( i=1; i<${#config[@]}-1; i++ )); do
+ if [[ ${config[i]} == "netmask" ]]; then
+ netmask="${config[i+1]}"
+ cidr=$( netmask2cidr "${netmask}" )
+ break
+ fi
+ done
+ [[ -z ${netmask} ]] && return ${r}
+ fi
+
+ local network=$( ip_network "${ip}" "${netmask}" )
+
+ if route del -net "${network}/${cidr}" metric 0 dev "${iface}" \
+ 2>/dev/null ; then
+ route add -net "${network}/${cidr}" metric "${metric}" dev "${iface}"
+ fi
+
+ return ${r}
+}
+
+# void ifconfig_default_route(char* interface, char* gateway_ip, int metric)
+#
+# Force default route to the specified gateway
+ifconfig_default_route() {
+ local metric="${3:-0}"
+
+ # Delete any existing default routes
+ while true ; do
+ route del default metric "${metric}" dev "$1" 2>/dev/null || break
+ done
+
+ # Then we add our route
+ route add default gw "$2" metric "${metric}" dev "$1"
+}
+
+# vim:ts=4
diff --git a/lib/rcscripts/net.modules.d/ipppd b/lib/rcscripts/net.modules.d/ipppd
new file mode 100644
index 0000000..8f5fc37
--- /dev/null
+++ b/lib/rcscripts/net.modules.d/ipppd
@@ -0,0 +1,103 @@
+#!/bin/bash
+# Copyright (c) 2004-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# Contributed by Roy Marples (uberlord@gentoo.org)
+
+# char* ipppd_provides(void)
+#
+# Returns a string to change module definition for starting up
+ipppd_provides() {
+ echo "isdn"
+}
+
+# void ipppd_depend(void)
+#
+# Sets up the dependancies for the module
+ipppd_depend() {
+ after macnet
+ before interface
+}
+
+# bool ipppd_check_installed(void)
+#
+# Returns 1 if isnd4k-utils is installed, otherwise 0
+ipppd_check_installed() {
+ [[ -x /usr/sbin/ipppd ]] && return 0
+ ${1:-false} && eerror "For ISDN (ipppd) support, emerge net-dialup/isdn4k-utils"
+ return 1
+}
+
+# bool ipppd_check_depends(void)
+#
+# Checks to see if we have the needed functions
+ipppd_check_depends() {
+ local f
+
+ for f in interface_exists interface_type clean_pidfile; do
+ [[ $( type -t "${f}" ) == "function" ]] && continue
+ eerror "ipppd: missing required function ${f}\n"
+ return 1
+ done
+
+ return 0
+}
+
+# bool ipppd_start(char *iface)
+#
+# Start isdn on an interface
+#
+# Returns 0 (true) when successful, non-zero otherwise
+ipppd_pre_start() {
+ local iface="$1" opts itype=$( interface_type "$1" )
+ local pidfile="/var/run/ipppd-${iface}.pid"
+
+ # Check that we are a valid isdn interface
+ [[ ${itype} != "ippp" && ${itype} != "isdn" ]] && return 0
+
+ # Check that the interface exists
+ interface_exists "${iface}" true || return 1
+
+ if ! clean_pidfile "${pidfile}" ; then
+ ewarn "ipppd is already running on ${iface}"
+ eend 0
+ return 0
+ fi
+
+ local ifvar=$( bash_variable "${iface}" )
+ # Might or might not be set in conf.d/net
+ eval opts=\"\$\{ipppd_${ifvar}\}\"
+
+ einfo "Starting ipppd for ${iface}"
+ /usr/sbin/ipppd "${opts}" pidfile "${pidfile}" \
+ file "/etc/ppp/options.${iface}" >/dev/null
+ eend $? || return $?
+
+ return 0
+}
+
+# bool ipppd_stop(char *iface)
+#
+# Stop isdn on an interface
+# Returns 0 (true) when successful, non-zero otherwise
+ipppd_stop() {
+ local iface="$1" pidfile="/var/run/ipppd-$1.pid"
+
+ ipppd_check_installed || return 0
+ [[ ! -f ${pidfile} ]] && return 0
+
+ clean_pidfile "${pidfile}" && return 0
+ local pid=$( < "${pidfile}" ) r=0
+
+ einfo "Stopping ipppd for ${iface}"
+ kill -s TERM "${pid}"
+ if ! process_finished "${pid}" ipppd 10 ; then
+ kill -s KILL "${pid}"
+ process_finished "${pid}" ipppd 10 || r=1
+ fi
+
+ eend ${r}
+ return ${r}
+}
+
+# vim:ts=4
diff --git a/lib/rcscripts/net.modules.d/iproute2 b/lib/rcscripts/net.modules.d/iproute2
new file mode 100644
index 0000000..06a8f27
--- /dev/null
+++ b/lib/rcscripts/net.modules.d/iproute2
@@ -0,0 +1,376 @@
+#!/bin/bash
+# Copyright (c) 2004-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# Contributed by Roy Marples (uberlord@gentoo.org)
+
+# Fix any potential localisation problems
+# Note that LC_ALL trumps LC_anything_else according to locale(7)
+ip() {
+ LC_ALL=C /sbin/ip "$@"
+}
+
+iproute2_tunnel() {
+ LC_ALL=C /sbin/ip tunnel "$@"
+}
+
+# void iproute2_depend(void)
+#
+# Sets up the dependancies for the module
+iproute2_depend() {
+ after macnet wireless
+}
+
+# bool iproute2_check_installed(void)
+#
+# Returns 1 if iproute2 is installed, otherwise 0
+iproute2_check_installed() {
+ local report="${1:-false}" installed="0"
+ if [[ ! -x /sbin/ip ]]; then
+ installed="1"
+ ${report} && eerror "For iproute2 support, emerge sys-apps/iproute2"
+ fi
+ if [[ ! -e /proc/net/netlink ]]; then
+ installed="1"
+ ${report} && eerror "iproute2 requires NetLink enabled in the kernel"
+ fi
+ return "${installed}"
+}
+
+# char* iproute2_provides(void)
+#
+# Returns a string to change module definition for starting up
+iproute2_provides() {
+ echo "interface"
+}
+
+# char* iproute2_module(void)
+#
+# Returns the module name
+# This is needed by dhclient as we run different scripts
+# based on the interface
+iproute2_module() {
+ echo "iproute2"
+}
+
+# bool iproute2_check_depends(void)
+#
+# Checks to see if we have the needed functions
+iproute2_check_depends() {
+ local f
+
+ for f in interface_device; do
+ [[ $( type -t "${f}" ) == "function" ]] && continue
+ eerror "iproute2: missing required function ${f}\n"
+ return 1
+ done
+
+ return 0
+}
+
+# bool iproute2_exists(char *interface, bool report)
+#
+# Returns 1 if the interface exists, otherwise 0
+iproute2_exists() {
+ local e=$( ip addr show label "$1" ) report="${2:-false}"
+ [[ -n ${e} ]] && return 0
+
+ ${report} && eerror "$1 does not exist"
+ return 1
+}
+
+# void iproute2_up(char *interface)
+#
+# provides a generic interface for bringing interfaces up
+iproute2_up() {
+ ip link set up dev "$1"
+}
+
+# void iproute2_down(char *interface)
+#
+# provides a generic interface for bringing interfaces up
+iproute2_down() {
+ ip link set down dev "$1"
+}
+
+# bool ifproute2_is_up(char *iface, bool withaddress)
+#
+# Returns 0 if the interface is up, otherwise 1
+# If withaddress is true then the interface has to have an IPv4 address
+# assigned as well
+iproute2_is_up() {
+ local check="\<UP\>" addr="${2:-false}"
+ ${addr} && check="${check}.*inet "
+ ip addr show "$1" | grep -Eq "${check}" && return 0
+ return 1
+}
+
+# void iproute2_set_flag(char *iface, char *flag, bool enabled)
+#
+# Sets or disables the interface flag
+iproute2_set_flag() {
+ local enable="$3" opt="on"
+ ${enable} || opt="off"
+ ip link set "$1" "$2" "${opt}"
+}
+
+# void iproute2_get_address(char *interface)
+#
+# Fetch the address retrieved by DHCP. If successful, echoes the
+# address on stdout, otherwise echoes nothing.
+iproute2_get_address() {
+ ip -family inet addr show "$1" \
+ | sed -n -e 's/.*inet \([^ ]*\).*/\1/p'
+}
+
+# void iproute2_get_mac_address(char *interface)
+#
+# Fetch the mac address assingned to the network card
+iproute2_get_mac_address() {
+ ip link show "$1" \
+ | sed -n -e 's/^.*\<\(..:..:..:..:..:..\)\>.*/\U\1/p'
+}
+
+# void iproute2_set_mac_address(char *interface, char *mac)
+#
+# Assigned the mac address to the network card
+iproute2_set_mac_address() {
+ ip link set address "$2" dev "$1"
+}
+
+# int iproute2_set_name(char *interface, char *new_name)
+#
+# Renames the interface
+# This will not work if the interface is setup!
+iproute2_set_name() {
+ ip link set name "$2" dev "$1"
+}
+
+# void iproute2_get_aliases_rev(char *interface)
+#
+# Fetch the list of aliases for an interface.
+# Outputs a space-separated list on stdout, in reverse order, for
+# example "eth0:2 eth0:1"
+iproute2_get_aliases_rev() {
+ local iface=$( interface_device "$1" )
+ ip addr show dev "${iface}" | grep -o "${iface}:[0-9].*" | tac
+}
+
+# bool iproute2_del_addresses(char *interface, bool onlyinet)
+#
+# Remove addresses from interface.
+# If onlyinet is true, then we only remove IPv4 / inet addresses.
+iproute2_del_addresses() {
+ local pre=""
+ ${2:-false} && pre="-f inet"
+ ip ${pre} addr flush label "$1" scope global &>/dev/null
+ ip ${pre} addr flush label "$1" scope host &>/dev/null
+ return 0
+}
+
+# char* iproute2_get_vars(char *interface)
+#
+# Returns a string spaced with possible user set
+# configuration variables
+iproute2_get_vars() {
+ echo "config_$1 routes_$1 fallback_$1 metric_$1 ipaddr_$1 ipaddr_fallback_$1 iproute_$1 inet6_$1"
+}
+
+# bool iproute2_get_old_config(char *iface)
+#
+# Returns config and config_fallback for the given interface
+iproute2_get_old_config() {
+ local ifvar=$( bash_variable "$1" ) inet6
+
+ # iproute2-style config vars
+ eval config=( \"\$\{ipaddr_${ifvar}\[@\]\}\" )
+ eval config_fallback=( \"\$\{ipaddr_fallback_${ifvar}\[@\]\}\" )
+ eval inet6=( \"\$\{inet6_${ifvar}\[@\]\}\" )
+
+ # BACKWARD COMPATIBILITY: check for space-separated inet6 addresses
+ [[ ${#inet6[@]} == "1" && ${inet6} == *" "* ]] && inet6=( ${inet6} )
+
+ # Add inet6 addresses to our config if required
+ [[ -n ${inet6} ]] && config=( "${config[@]}" "${inet6[@]}" )
+
+ # Support old style iface_xxx syntax
+ [[ -z ${config} && $(type -t ifconfig_get_old_config) == "function" ]] \
+ && ifconfig_get_old_config "${iface}"
+
+ return 0
+}
+
+# bool iproute2_iface_stop(char *interface)
+#
+# Do final shutdown for an interface or alias.
+#
+# Returns 0 (true) when successful, non-zero (false) on failure
+iproute2_iface_stop() {
+ local label="$1" iface=$( interface_device "$1" )
+
+ # Shut down the link if this isn't an alias or vlan
+ if [[ ${label} == "${iface}" ]]; then
+ iproute2_down "${iface}"
+ return $?
+ fi
+ return 0
+}
+
+# bool iproute2_add_address(char *interface, char *options ...)
+#
+# Adds an the specified address to the interface
+# returns 0 on success and non-zero on failure
+iproute2_add_address() {
+ local iface="$1" x
+
+ iproute2_exists "${iface}" true || return 1
+
+ # Extract the config
+ local -a config=( "$@" )
+ config=( ${config[@]:1} )
+
+ # Convert an ifconfig line to iproute2
+ local n="${#config[@]}"
+ for (( x=0; x<n; x++ )); do
+ case "${config[x]}" in
+ netmask)
+ config[0]="${config[0]}/$( netmask2cidr ${config[x+1]} )"
+ unset config[x] config[x+1]
+ ;;
+ mtu)
+ ip link set mtu "${config[x+1]}" dev "${iface}"
+ unset config[x] config[x+1]
+ ;;
+ esac
+ done
+ config=( "${config[@]//pointtopoint/peer}" )
+
+ # Always scope lo addresses as host unless specified otherwise
+ [[ ${iface} == "lo" && " ${config[@]} " != *" scope "* ]] \
+ && config=( "${config[@]}" "scope host" )
+
+ # IPv4 specifics
+ if [[ ${config[@]} == *.*.*.* ]]; then
+ # Work out a broadcast if none supplied
+ [[ ${config[@]} != *" brd "* && ${config[@]} != *" broadcast "* ]] \
+ && config=( "${config[@]}" "brd +" )
+ fi
+
+ # Ensure that the interface is up so we can add IPv6 addresses
+ interface_up "${iface}"
+
+ # Some kernels like to apply lo with an address when they are brought up
+ if [[ ${iface} == "lo" \
+ && ${config[@]} == "127.0.0.1/8 brd 127.255.255.255 scope host" ]]; then
+ ip addr del dev "${iface}" 127.0.0.1/8 2>/dev/null
+ fi
+
+ ip addr add dev "${iface}" ${config[@]}
+ local r="$?"
+ [[ ${r} != "0" ]] && return "${r}"
+
+ local metric ifvar=$( bash_variable "${iface}" )
+ # Remove the newly added route and replace with our metric
+ eval metric=\"\$\{metric_${ifvar}\}\"
+ [[ ${metric} == "0" || ${RC_AUTO_INTERFACE} != "yes" ]] && return "${r}"
+
+ local network=$( ip_network "${config[0]}" )
+ [[ -z ${network} ]] && return "${r}"
+
+ local cidr="${config[0]##*/}"
+ if ip route del "${network}/${cidr}" metric 0 dev "${iface}" \
+ 2>/dev/null ; then
+ ip route add "${network}/${cidr}" metric "${metric}" dev "${iface}"
+ fi
+
+ return "${r}"
+}
+
+# bool iproute2_pre_start(char *interface)
+#
+# Runs any pre_start stuff on our interface - just the MTU atm
+# We set MTU twice as it may be needed for DHCP - a dhcp client could
+# change it in error, so we set MTU in post start too
+iproute2_pre_start() {
+ local iface="$1"
+
+ interface_exists "${iface}" || return 0
+
+ local ifvar=$( bash_variable "$1" ) mtu
+
+ # MTU support
+ eval mtu=\"\$\{mtu_${ifvar}\}\"
+ [[ -n ${mtu} ]] && ip link set mtu "${mtu}" dev "${iface}"
+
+ return 0
+}
+
+# bool iproute2_post_start(char *interface)
+#
+# Runs any post_start stuff on our interface and adds routes
+# Always returns 0
+iproute2_post_start() {
+ local iface="$1" ifvar=$( bash_variable "$1" ) routes metric mtu x netmask
+
+ # Make sure interface is marked UP
+ iproute2_up "${iface}"
+
+ # MTU support
+ eval mtu=\"\$\{mtu_${ifvar}\}\"
+ [[ -n ${mtu} ]] && ip link set mtu "${mtu}" dev "${iface}"
+
+ eval routes=( \"\$\{routes_${ifvar}\[@\]\}\" )
+ eval metric=\"\$\{metric_${ifvar}\:-0}\"
+
+ # Test for old style ipaddr variable
+ if [[ -z ${routes} ]]; then
+ eval routes=( \"\$\{iproute_${ifvar}\[@\]\}\" )
+ fi
+
+ [[ -z ${routes} ]] && return 0
+
+ # Set routes with ip route -- this might also include default route
+ einfo "Adding routes"
+ eindent
+ for x in "${routes[@]}"; do
+ ebegin "${x}"
+
+ # Support net-tools routing too
+ x="${x//gw/via}"
+ x="${x//-A inet6}"
+ x="${x//-net}"
+ [[ " ${x} " == *" -host "* ]] && x="${x//-host} scope host"
+
+ # Attempt to support net-tools route netmask option
+ netmask="${x##* netmask }"
+ if [[ -n ${netmask} && ${x} != "${netmask}" ]]; then
+ netmask="${netmask%% *}"
+ x="${x// netmask ${netmask} / }"
+ local -a a=( ${x} )
+ a[0]="${a[0]}/$( netmask2cidr ${netmask} )"
+ x="${a[@]}"
+ fi
+
+ # Add a metric if we don't have one
+ [[ " ${x} " != *" metric "* ]] && x="${x} metric ${metric}"
+
+ ip route append ${x} dev "${iface}"
+ eend $?
+ done
+ eoutdent
+
+ return 0
+}
+
+# void iproute2_default_route(char* interface, char* gateway_ip, int metric)
+#
+# Force default route to the specified gateway, optionally on
+# the given interface
+iproute2_default_route() {
+ local metric="${3:-0}"
+
+ ip route change default via "$2" metric "${metric}" dev "$1" 2>/dev/null \
+ || ip route append default via "$2" metric "${metric}" dev "$1" 2>/dev/null
+}
+
+# vim:ts=4
diff --git a/lib/rcscripts/net.modules.d/iptunnel b/lib/rcscripts/net.modules.d/iptunnel
new file mode 100644
index 0000000..f547a99
--- /dev/null
+++ b/lib/rcscripts/net.modules.d/iptunnel
@@ -0,0 +1,84 @@
+#!/bin/bash
+# Copyright (c) 2004-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# Contributed by Roy Marples (uberlord@gentoo.org)
+
+# char* iptunnel_provides(void)
+#
+# Returns a string to change module definition for starting up
+iptunnel_provides() {
+ echo "iptunnel"
+}
+
+# void iptunnel_depend(void)
+#
+# Sets up the dependancies for the module
+iptunnel_depend() {
+ after wireless
+ before interface
+}
+
+# bool iptunnel_check_installed(void)
+#
+# Tunnelling is provided by the interface
+iptunnel_check_installed() {
+ return 0
+}
+
+# bool iptunnel_check_depends(void)
+#
+# Checks to see if we have the needed functions
+iptunnel_check_depends() {
+ local f
+
+ for f in interface_exists interface_tunnel; do
+ [[ $( type -t "${f}" ) == "function" ]] && continue
+ eerror "iptunnel: missing required function ${f}\n"
+ return 1
+ done
+
+ return 0
+}
+
+# char* iptunnel_get_vars(char *interface)
+#
+# Returns a string spaced with possible user set
+# configuration variables
+iptunnel_get_vars() {
+ echo "iptunnel_$1"
+}
+
+# bool iptunnel_pre_start(char *iface)
+#
+# Create the device, give it the right perms
+iptunnel_pre_start() {
+ local iface="$1" opts ifvar=$( bash_variable "$1" )
+
+ # Get our options
+ eval opts=\"\$\{iptunnel_${ifvar}\}\"
+ [[ -z ${opts} ]] && return 0
+
+ ebegin "Creating tunnel ${iface}"
+ interface_tunnel add "${iface}" ${opts}
+ eend "$?"
+ return "$?"
+
+}
+
+# bool iptunnel_stop(char *iface)
+#
+# Removes the device
+iptunnel_stop() {
+ local iface="$1"
+
+ interface_exists "${iface}" || return 0
+ [[ -z $( interface_tunnel show "${iface}" 2>/dev/null ) ]] && return 0
+
+ ebegin "Destroying tunnel ${iface}"
+ interface_tunnel del "${iface}"
+ eend "$?"
+ return "$?"
+}
+
+# vim:ts=4
diff --git a/lib/rcscripts/net.modules.d/iwconfig b/lib/rcscripts/net.modules.d/iwconfig
new file mode 100644
index 0000000..9401c9f
--- /dev/null
+++ b/lib/rcscripts/net.modules.d/iwconfig
@@ -0,0 +1,923 @@
+#!/bin/bash
+# Copyright (c) 2004-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# Contributed by Roy Marples (uberlord@gentoo.org)
+# Many thanks to all the people in the Gentoo forums for their ideas and
+# motivation for me to make this and keep on improving it
+
+# Fix any potential localisation problems
+# Note that LC_ALL trumps LC_anything_else according to locale(7)
+iwconfig() {
+ LC_ALL=C /sbin/iwconfig "$@"
+}
+iwgetid() {
+ LC_ALL=C /sbin/iwgetid "$@"
+}
+iwlist() {
+ LC_ALL=C /sbin/iwlist "$@"
+}
+iwpriv() {
+ LC_ALL=C /sbin/iwpriv "$@"
+}
+
+# void iwconfig_depend(void)
+#
+# Sets up the dependancies for the module
+iwconfig_depend() {
+ before interface
+}
+
+# bool iwconfig_check_installed(void)
+#
+# Returns 1 if wireless-tools is installed, otherwise 0
+iwconfig_check_installed() {
+ [[ -x /sbin/iwconfig ]] && return 0
+ ${1:-false} && eerror "For Wireless (802.11) support, emerge net-wireless/wireless-tools"
+ return 1
+}
+
+# char* iwconfig_provides(void)
+#
+# Returns a string to change module definition for starting up
+iwconfig_provides() {
+ echo "wireless"
+}
+
+# bool iwconfig_check_depends(void)
+#
+# Checks to see if we have the needed functions
+iwconfig_check_depends() {
+ local f
+
+ for f in interface_up interface_down interface_exists; do
+ [[ $( type -t "${f}" ) == "function" ]] && continue
+ eerror "iwconfig: missing required function ${f}\n"
+ return 1
+ done
+
+ return 0
+}
+
+# bool iwconfig_check_extensions(char *interface)
+#
+# Checks to see if wireless extensions are enabled on the interface
+iwconfig_check_extensions() {
+ grep -q "^[ \t]*$1:[ \t]" /proc/net/wireless
+}
+
+# char* iwconfig_get_wep_status(char *interface)
+#
+# Echos a string showing whether WEP is enabled or disabled
+# for the given interface
+iwconfig_get_wep_status() {
+ local key=$( iwconfig "$1" | grep -i -o "Encryption key:[0-9,A-F]" )
+ local mode status="disabled"
+
+ if [[ -n ${key} ]]; then
+ status="enabled"
+ mode=" - $( iwconfig "$1" | sed -n -e 's/^.*Security mode:\(.*[^ ]\).*/\1/p' )"
+ fi
+
+ echo "(WEP ${status}${mode})"
+}
+
+# char* iwconfig_get_essid(char *iface)
+#
+# Gets the current ESSID of the iface
+iwconfig_get_essid() {
+ local i essid
+
+ for (( i=0; i<5; i++ )); do
+ essid=$( iwgetid "$1" 2>/dev/null | sed -n -e 's/^.*ESSID:"\(.*\)"$/\1/p' )
+ if [[ -n ${essid} ]]; then
+ echo "${essid}"
+ return 0
+ fi
+ sleep 1
+ done
+
+ return 1
+}
+
+# char* iwconfig_get_ap_mac_address(char *interface)
+#
+# Returns the MAC address of the Access Point
+# the interface is connected to
+iwconfig_get_ap_mac_address() {
+ iwgetid --ap "$1" | sed -n -e 's/^.*Cell: .*\<\(..:..:..:..:..:..\)\>.*/\U\1/p'
+}
+
+# char* iwconfig_get_mode(char *interface)
+#
+# Returns the wireless mode in lower case
+iwconfig_get_mode() {
+ iwgetid --mode "$1" | sed -n -e 's/^.*Mode:\(.*\)/\L\1/p'
+}
+
+# char* iwconfig_get_type(char *interface)
+#
+# Returns the type of interface - the IEEE part
+iwconfig_get_type() {
+ iwconfig "$1" | sed -n -e 's/^'"$1"' *\([^ ]* [^ ]*\).*/\1/p'
+}
+
+# void iwconfig_report(char *interface)
+#
+# Output how our wireless interface has been configured
+iwconfig_report() {
+ local iface="$1" essid mac m="to"
+
+ essid=$( iwconfig_get_essid "${iface}" )
+
+ local wep_status=$( iwconfig_get_wep_status "${iface}" )
+ local channel=$( iwgetid --channel "${iface}" 2>/dev/null | cut -d: -f2 )
+ [[ -n ${channel} ]] && channel="on channel ${channel} "
+
+ essid="${essid//\\\\/\\\\}"
+ local mode=$( iwconfig_get_mode "${iface}" )
+ if [[ ${mode} == "master" ]]; then
+ m="as"
+ else
+ mac=$( iwconfig_get_ap_mac_address "${iface}" )
+ [[ -n ${mac} ]] && mac=" at ${mac}"
+ fi
+
+ eindent
+ einfo "${iface} connected ${m} \"${essid}\"${mac}"
+ einfo "in ${mode} mode ${channel}${wep_status}"
+ eoutdent
+}
+
+# char* iwconfig_get_wep_key(char *mac_address)
+#
+# Returns the configured WEP key for the given mac address
+# or the given ESSID. The mac address setting takes precendence
+iwconfig_get_wep_key() {
+ local mac="$1" key
+ eval key=\"\${mac_key_${mac//:/}\}\"
+ [[ -z ${key} ]] && eval key=\"\${key_${ESSIDVAR}\}\"
+ echo "${key:-off}"
+}
+
+# void iwconfig_user_config(char *iface)
+#
+# Applies the user configuration to the interface
+iwconfig_user_config() {
+ local iface="$1" conf ifvar=$( bash_variable "$1" )
+
+ # Apply the user configuration
+ eval conf=\"\$\{iwconfig_${ifvar}\}\"
+ if [[ -n ${conf} ]]; then
+ if ! eval iwconfig "${iface}" ${conf} ; then
+ ewarn "${iface} does not support the following configuration commands"
+ ewarn " \"${conf}\""
+ fi
+ fi
+
+ eval conf=\"\$\{iwpriv_${ifvar}\}\"
+ if [[ -n ${conf} ]]; then
+ if ! eval iwpriv "${iface}" ${conf} ; then
+ ewarn "${iface} does not support the following private ioctls"
+ ewarn " \"${conf}\""
+ fi
+ fi
+}
+
+# bool iwconfig_setup_specific(char *iface)
+#
+# Sets up our wireless interface to operate in ad-hoc or master mode
+iwconfig_setup_specific() {
+ local iface="$1" mode="$2" channel key dessid
+ local ifvar=$( bash_variable "$1" )
+
+ if [[ -z ${ESSID} ]]; then
+ eerror "${iface} requires an ESSID to be set to operate in ${mode} mode"
+ eerror "adjust the essid_${iface} setting in /etc/conf.d/wireless"
+ return 1
+ fi
+ dessid="${ESSID//\\\\/\\\\}"
+ ESSIDVAR=$( bash_variable "${ESSID}" )
+
+ # We only change the mode if it's not the same
+ local cur_mode=$( iwconfig_get_mode "${iface}" )
+ if [[ ${cur_mode} != "${mode}" ]]; then
+ if ! iwconfig "${iface}" mode "${mode}" ; then
+ eerror "${iface} does not support setting the mode to \"${mode}\""
+ return 1
+ fi
+ fi
+
+ key=$( iwconfig_get_wep_key )
+ if ! eval iwconfig "${iface}" key ${key} ; then
+ if [[ ${key} != "off" ]]; then
+ ewarn "${iface} does not support setting keys"
+ ewarn "or the parameter \"mac_key_${ESSIDVAR}\" or \"key_${ESSIDVAR}\" is incorrect"
+ fi
+ fi
+
+ if ! iwconfig "${iface}" essid "${ESSID}" ; then
+ eerror "${iface} does not support setting ESSID to \"${dessid}\""
+ return 1
+ fi
+ iwconfig "${iface}" nick "${ESSID}" 2>/dev/null
+
+ eval channel=\"\$\{channel_${ifvar}\}\"
+ # We default the channel to 3
+ channel=${channel:-3}
+
+ if ! iwconfig "${iface}" channel "${channel}" ; then
+ ewarn "${iface} does not support setting the channel to \"${channel}\""
+ return 1
+ fi
+
+ iwconfig_user_config "${iface}"
+ iwconfig_report "${iface}"
+
+ if ${IN_BACKGROUND}; then
+ mark_service_inactive "net.${iface}"
+ export IN_BACKGROUND
+ /etc/init.d/net.${iface} start &
+ exit 0
+ fi
+
+ return 0
+}
+
+# bool iwconfig_associate_mac(char *iface)
+#
+# Returns true if the AP MAC address is valid or not
+iwconfig_associate_mac() {
+ # Checks if a MAC address has been assigned
+ local mac=$( iwconfig_get_ap_mac_address "$1" ) i
+ local -a invalid_macs=(
+ "00:00:00:00:00:00"
+ "44:44:44:44:44:44"
+ "FF:00:00:00:00:00"
+ "FF:FF:FF:FF:FF:FF"
+ )
+
+ [[ -z ${mac} ]] && return 1
+ for i in "${invalid_macs[@]}"; do
+ [[ ${mac} == "${i}" ]] && return 1
+ done
+ return 0
+}
+
+# bool iwconfig_associate_quality(char *iface)
+#
+# Returns true if the link quality is not 0 or 0.
+iwconfig_associate_quality() {
+ local quality=$( \
+ sed -n -e 's/^.*'"$1"': *[0-9]* *\([0-9]*\).*/\1/p' \
+ /proc/net/wireless
+ )
+ [[ ${quality} != "0" ]]
+ return "$?"
+}
+
+# bool iwconfig_test_associated(char *iface)
+#
+# Returns true if the interface has associated with an Access Point
+iwconfig_test_associated() {
+ local iface="$1" ttype ifvar=$( bash_variable "$1" )
+ # Some drivers don't set MAC to a bogus value when assocation is lost/fails
+ # whereas they do set link quality to 0
+
+ ttype=$( eval echo \"\$\{associate_test_${ifvar}\:-mac}\" | tr '[:upper:]' '[:lower:]' )
+ if [[ ${ttype} != "mac" && ${ttype} != "quality" && ${ttype} != "all" ]]; then
+ ewarn " associate_test_${iface} is not set to mac, quality or all"
+ ewarn " defaulting to \"mac\""
+ test="mac"
+ fi
+
+ case "${ttype}" in
+ mac) iwconfig_associate_mac "${iface}" && return 0 ;;
+ quality) iwconfig_associate_quality "${iface}" && return 0 ;;
+ all) iwconfig_associate_mac "${iface}" \
+ && iwconfig_associate_quality "${iface}" && return 0 ;;
+ esac
+
+ return 1
+}
+
+# bool iwconfig_wait_for_association(char *iface)
+#
+# Waits for a configured ammount of time until
+# we are assocaited with an Access Point
+iwconfig_wait_for_association() {
+ local iface="$1" i=0 timeout ifvar=$( bash_variable "$1" )
+ eval timeout=\"\$\{associate_timeout_${ifvar}\}\"
+ [[ -z ${timeout} ]] && eval timeout=\"\$\{sleep_associate_${ifvar}\:-10\}\"
+
+ [[ ${timeout} == "0" ]] \
+ && vewarn "WARNING: infinite timeout set for association on ${iface}"
+
+ while true; do
+ iwconfig_test_associated "${iface}" && return 0
+ sleep 1
+ [[ ${timeout} == "0" ]] && continue
+ (( i++ ))
+ [[ ${i} == "${timeout}" || ${i} -gt ${timeout} ]] && break
+ done
+ return 1
+}
+
+# bool iwconfig_associate(char *interface, char *mac_address, char *wep_required)
+#
+# Tries to associate the interface with an Access Point
+# If we scanned the Access Point we know if we need WEP to associate or not
+# and if we have a WEP key for the ESSID or not
+# so we can fail gracefully without even trying to connect
+iwconfig_associate() {
+ local iface="$1" mode="${2:-managed}"
+ local mac="$3" wep_required="$4" w="(WEP Disabled)"
+ local dessid="${ESSID//\\\\/\\\\}" key
+ wep_required="${wep_required:-off}"
+
+ iwconfig "${iface}" mode "${mode}" 2>/dev/null
+ if [[ ${ESSID} == "any" ]]; then
+ iwconfig "${iface}" ap any 2>/dev/null
+ dessid="any"
+ unset ESSIDVAR
+ else
+ ESSIDVAR=$( bash_variable "${ESSID}" )
+ key=$( iwconfig_get_wep_key "${mac}" )
+ if [[ ${wep_required} == "yes" && ${key} == "off" ]]; then
+ vewarn "WEP key is not set for \"${dessid}\" - not connecting"
+ return 1
+ fi
+ if [[ ${wep_required} == "no" && ${key} != "off" ]]; then
+ key="off"
+ vewarn "\"${dessid}\" is not WEP enabled - ignoring setting"
+ fi
+
+ if ! eval iwconfig "${iface}" key ${key} ; then
+ if [[ ${key} != "off" ]]; then
+ ewarn "${iface} does not support setting keys"
+ ewarn "or the parameter \"mac_key_${ESSIDVAR}\" or \"key_${ESSIDVAR}\" is incorrect"
+ return 1
+ fi
+ fi
+ [[ ${key} != "off" ]] && w=$( iwconfig_get_wep_status "${iface}" )
+ fi
+
+ if ! iwconfig "${iface}" essid "${ESSID}" ; then
+ if [[ ${ESSID} != "any" ]]; then
+ ewarn "${iface} does not support setting ESSID to \"${dessid}\""
+ fi
+ fi
+ iwconfig "${iface}" nick "${ESSID}" 2>/dev/null
+
+ vebegin "Connecting to \"${dessid}\" ${w}"
+
+ if [[ ${ESSID} != "any" && $( type -t preassociate ) == "function" ]]; then
+ veinfo "Running preassociate function"
+ eindent
+ ( preassociate "${iface}" )
+ e="$?"
+ eoutdent
+ if [[ ${e} != 0 ]]; then
+ veend 1 "preassociate \"${dessid}\" on ${iface} failed"
+ return 1
+ fi
+ fi
+
+ if ! iwconfig_wait_for_association "${iface}" ; then
+ veend 1
+ return 1
+ fi
+ veend 0
+
+ if [[ ${ESSID} == "any" ]]; then
+ ESSID=$( iwconfig_get_essid "${iface}" )
+ iwconfig_associate "${iface}"
+ return $?
+ fi
+
+ iwconfig_user_config "${iface}"
+ iwconfig_report "${iface}"
+
+ if [[ $( type -t postassociate ) == "function" ]]; then
+ veinfo "Running postassociate function"
+ eindent
+ ( postassociate "${iface}" )
+ eoutdent
+ fi
+
+ if ${IN_BACKGROUND}; then
+ mark_service_started "net.${iface}"
+ mark_service_inactive "net.${iface}"
+ export IN_BACKGROUND
+ /etc/init.d/net.${iface} start &
+ exit 0
+ fi
+
+ return 0
+}
+
+# bool iwconfig_scan(char *iface)
+#
+# Fills 3 arrays with information from a wireless scan
+iwconfig_scan() {
+ local iface="$1" mode x ifvar=$( bash_variable "$1" )
+
+ # First, we may need to change mode to scan in
+ mode=$( eval echo \"\$\{scan_mode_${ifvar}\}\" | tr '[:upper:]' '[:lower:]' )
+ if [[ -n ${mode} ]]; then
+ if ! iwconfig "${iface}" mode "${mode}" ; then
+ ewarn "${iface} does not support setting the mode to \"${mode}\""
+ fi
+ fi
+
+ # Next we set any private driver ioctls needed
+ eval x=\"\$\{iwpriv_scan_pre_${ifvar}\}\"
+ if [[ -n ${x} ]]; then
+ if ! eval iwpriv "${iface}" ${x} ; then
+ ewarn "${iface} does not support the following private ioctls" \
+ ewarn " \"${x}\""
+ fi
+ fi
+
+ # Set the essid to any. This is required for scanning
+ iwconfig "${iface}" essid any
+
+ veinfo "Scanning for access points"
+
+ # Sleep if required
+ eval x=\"\$\{sleep_scan_${ifvar}\}\"
+ [[ -n ${x} ]] && sleep "${x}"
+
+ local error=true i=-1 line
+ local -a mac essid enc qual mode
+
+ while read line; do
+ error=false
+ case "${line}" in
+ *Address:*)
+ (( i++ ))
+ mac[i]=$( echo "${line#*: }" | tr '[:lower:]' '[:upper:]' )
+ ;;
+ *ESSID:*)
+ essid[i]="${line#*\"}"
+ essid[i]="${essid[i]%*\"}"
+ ;;
+ *Mode:*)
+ mode[i]=$(echo "${line#*:}" | tr '[:upper:]' '[:lower:]' )
+ [[ ${mode[i]} == "master" ]] && mode[i]="managed"
+ ;;
+ *'Encryption key:'*)
+ enc[i]="${line#*:}"
+ ;;
+ *Quality*)
+ qual[i]="${line#*:}"
+ qual[i]="${qual[i]%/*}"
+ qual[i]="${qual[i]//[![:digit:]]/}"
+ qual[i]="${qual[i]:-0}"
+ ;;
+ esac
+ done < <( iwlist "${iface}" scan 2>/dev/null )
+
+ if ${error}; then
+ ewarn "${iface} does not support scanning"
+ eval x=\"\$\{adhoc_essid_${ifvar}\}\"
+ [[ -n ${x} ]] && return 0
+ if [[ -n ${preferred_aps} ]]; then
+ [[ ${associate_order} == "forcepreferred" \
+ || ${associate_order} == "forcepreferredonly" ]] && return 0
+ fi
+ eerror "You either need to set a preferred_aps list in /etc/conf.d/wireless"
+ eerror " preferred_aps=( \"ESSID1\" \"ESSID2\" )"
+ eerror " and set associate_order_${iface}=\"forcepreferred\""
+ eerror " or set associate_order_${iface}=\"forcepreferredonly\""
+ eerror "or hardcode the ESSID to \"any\" and let the driver find an Access Point"
+ eerror " essid_${iface}=\"any\""
+ eerror "or configure defaulting to Ad-Hoc when Managed fails"
+ eerror " adhoc_essid_${iface}=\"WLAN\""
+ eerror "or hardcode the ESSID against the interface (not recommended)"
+ eerror " essid_${iface}=\"ESSID\""
+ return 1
+ fi
+
+ # We may need to unset the previous private driver ioctls
+ eval x=\"\$\{iwpriv_scan_post_${ifvar}\}\"
+ if [[ -n ${x} ]]; then
+ if ! eval iwpriv "${iface}" ${x} ; then
+ ewarn "${iface} does not support the following private ioctls" \
+ ewarn " \"${x}\""
+ fi
+ fi
+
+ # Change back mode if needed
+ x=$( eval echo \"\$\{mode_${ifvar}\:-managed}\" | tr '[:upper:]' '[:lower:]' )
+ [[ ${mode} != "${x}" ]] && iwconfig "${iface}" mode "${x}"
+
+ for (( i=0; i<${#mac[@]}; i++ )); do
+ # Don't like ad-hoc nodes by default
+ [[ ${mode[i]} == "ad-hoc" ]] && (( qual[i]-=10000 ))
+ sortline="${sortline}${qual[i]} ${i}\n"
+ done
+
+ sortline=( $( echo -e "${sortline}" | sort -nr ) )
+
+ for (( i=0; i<${#mac[@]}; i++ )); do
+ (( x=(i * 2) + 1 ))
+ mac_APs[i]="${mac[${sortline[x]}]}"
+ essid_APs[i]="${essid[${sortline[x]}]}"
+ mode_APs[i]="${mode[${sortline[x]}]}"
+ enc_APs[i]="${enc[${sortline[x]}]}"
+ done
+
+ return 0
+}
+
+# void iwconfig_scan_report(void)
+#
+# Report the results of the scan and re-map any ESSIDs if they
+# have been configured for the MAC address found
+iwconfig_scan_report() {
+ local i k m remove
+ local -a u
+
+ [[ -z ${mac_APs} ]] && ewarn " no access points found"
+
+ # We need to do the for loop like this so we can
+ # dynamically remove from the array
+ eindent
+ for ((i=0; i<${#mac_APs[@]}; i++)); do
+ k=""
+ [[ ${enc_APs[i]} == "yes" ]] && k="(WEP required)"
+
+ if [[ -z ${essid_APs[i]} ]]; then
+ veinfo "Found ${mac_APs[i]} ${k}"
+ else
+ veinfo "Found \"${essid_APs[i]//\\\\/\\\\}\" at ${mac_APs[i]} ${k}"
+ fi
+
+ eindent
+
+ eval m=\"\$\{mac_essid_${mac_APs[i]//:/}\}\"
+ if [[ -n ${m} ]]; then
+ essid_APs[i]="${m}"
+ veinfo "mapping to \"${m//\\\\/\\\\}\""
+ fi
+
+ remove=false
+ # If we don't know the essid then we cannot connect to them
+ # so we remove them from our array
+ if [[ -z ${essid_APs[i]} ]]; then
+ remove=true
+ else
+ for k in "${blacklist_aps[@]}"; do
+ if [[ ${k} == "${essid_APs[i]}" ]]; then
+ vewarn "\"${k//\\\\/\\\\}\" has been blacklisted - not connecting"
+ remove=true
+ break
+ fi
+ done
+ fi
+
+ eoutdent
+
+ ${remove} && u=( "${u[@]}" "${i}" )
+ done
+
+ eoutdent
+
+ # Now we remove any duplicates
+ for ((i=0; i < ${#essid_APs[@]} - 1; i++)); do
+ for ((j=${i} + 1; j <${#essid_APs[@]}; j++)); do
+ [[ ${essid_APs[i]} == "${essid_APs[j]}" ]] && u=( "${u[@]}" "${j}" )
+ done
+ done
+
+ for i in ${u[@]}; do
+ unset essid_APs[i]
+ unset mode_APs[i]
+ unset mac_APs[i]
+ unset enc_APs[i]
+ done
+
+ # We need to squash our arrays so indexes work again
+ essid_APs=( "${essid_APs[@]}" )
+ mode_APs=( "${mode_APs[@]}" )
+ mac_APs=( "${mac_APs[@]}" )
+ enc_APs=( "${enc_APs[@]}" )
+}
+
+# bool iwconfig_force_preferred(char *iface)
+#
+# Forces the preferred_aps list to associate in order
+# but only if they were not picked up by our scan
+iwconfig_force_preferred() {
+ local iface=$1 essid i
+
+ [[ -z ${preferred_aps} ]] && return 1
+
+ ewarn "Trying to force preferred in case they are hidden"
+ for essid in "${preferred_aps[@]}"; do
+ local found_AP=false
+ for ((i = 0; i < ${#mac_APs[@]}; i++)); do
+ if [[ ${essid} == "${essid_APs[i]}" ]]; then
+ found_AP=true
+ break
+ fi
+ done
+ if ! ${found_AP} ; then
+ ESSID="${essid}"
+ iwconfig_associate "${iface}" && return 0
+ fi
+ done
+
+ ewarn "Failed to associate with any preferred access points on ${iface}"
+ return 1
+}
+
+# bool iwconfig_connect_preferred(char *iface)
+#
+# Connects to preferred_aps in order if they were picked up
+# by our scan
+iwconfig_connect_preferred() {
+ local iface="$1" essid i
+
+ for essid in "${preferred_aps[@]}"; do
+ for ((i=0; i<${#essid_APs[@]}; i++)); do
+ if [[ ${essid} == "${essid_APs[i]}" ]]; then
+ ESSID="${essid}"
+ iwconfig_associate "${iface}" "${mode_APs[i]}" "${mac_APs[i]}" \
+ "${enc_APs[i]}" && return 0
+ break
+ fi
+ done
+ done
+
+ return 1
+}
+
+# bool iwconfig_connect_not_preferred(char *iface)
+#
+# Connects to any AP's found that are not in
+# our preferred list
+iwconfig_connect_not_preferred() {
+ local iface=$1 i ap has_preferred
+
+ for ((i=0; i<${#mac_APs[@]}; i++)); do
+ has_preferred=false
+ for ap in "${preferred_aps[@]}"; do
+ if [[ ${ap} == "${essid_APs[i]}" ]]; then
+ has_preferred=true
+ break
+ fi
+ done
+ if ! ${has_preferred} ; then
+ ESSID="${essid_APs[i]}"
+ iwconfig_associate "${iface}" "${mode_APs[i]}" "${mac_APs[i]}" \
+ "${enc_APs[i]}" && return 0
+ fi
+ done
+
+ return 1
+}
+
+# void iwconfig_defaults(char *iface)
+#
+# Apply some sane defaults to the wireless interface
+# incase the user already applied some changes
+iwconfig_defaults() {
+ local iface="$1"
+
+ # Set some defaults
+ iwconfig "${iface}" rate auto &>/dev/null
+ iwconfig "${iface}" rts off &>/dev/null
+ iwconfig "${iface}" frag off &>/dev/null
+ iwconfig "${iface}" power off &>/dev/null
+ iwconfig "${iface}" txpower auto &>/dev/null
+ iwconfig "${iface}" key [1] off &>/dev/null
+ iwconfig "${iface}" mode managed &>/dev/null
+}
+
+# void iwconfig_strip_associated(char *iface)
+#
+# We check to see which ifaces have associated AP's except for the iface
+# given and remove those AP's from the scan list
+# We also remove from the preferred list
+iwconfig_strip_associated() {
+ local iface="$1" e a j
+ local essid=$( iwconfig_get_essid "${iface}" )
+ local -a ifaces=( $( iwconfig 2>/dev/null | grep -o "^\w*" ) )
+
+ for i in "${ifaces[@]}"; do
+ [[ ${i} == ${iface} ]] && continue
+ interface_is_up "${i}" || continue
+ iwconfig_test_associated "${i}" || continue
+ e=$( iwconfig_get_essid "${i}" )
+ u=()
+ for ((j=0; j<${#mac_APs[@]}; j++)); do
+ if [[ ${essid_APs[j]} == "${e}" ]]; then
+ ewarn "${e} has already been associated with ${i}"
+ unset essid_APs[j]
+ unset mode_Aps[j]
+ unset mac_APs[j]
+ unset enc_APs[j]
+ # We need to squash our arrays so that indexes work
+ essid_APs=( "${essid_APs[@]}" )
+ mode_APs=( "${mode_APs[@]}" )
+ mac_APs=( "${mac_APs[@]}" )
+ enc_APs=( "${enc_APs[@]}" )
+ break
+ fi
+ done
+ for ((j=0; j<${#preferred_aps[@]}; j++)); do
+ if [[ ${preferred_aps[j]} == "${e}" ]]; then
+ unset preferred_aps[j]
+ preferred_aps=( "${preferred_aps[@]}" )
+ break
+ fi
+ done
+ done
+}
+
+# bool iwconfig_configure(char *iface)
+#
+# The main startup code
+# First we bring the interface up, apply defaults, apply user configuration
+# Then we test to see if ad-hoc mode has been requested and branch if needed
+# Then we scan for access points and try to connect to them in a predetermined order
+# Once we're connected we show a report and then configure any interface
+# variables for the ESSID
+iwconfig_configure() {
+ local iface="$1" test x e ifvar=$( bash_variable "$1" )
+ local -a essid_APs mac_APs mode_APs enc_APs
+
+ iwconfig_defaults "${iface}"
+ iwconfig_user_config "${iface}"
+
+ eval ESSID=\"\$\{essid_${ifvar}\}\"
+
+ # Setup ad-hoc mode?
+ x=$( eval echo \"\$\{mode_${ifvar}:-managed\}\" | tr '[:upper:]' '[:lower:]' )
+ if [[ ${x} == "ad-hoc" || ${x} == "master" ]]; then
+ iwconfig_setup_specific "${iface}" "${x}"
+ return $?
+ fi
+
+ if [[ ${x} != "managed" && ${x} != "auto" ]]; then
+ eerror "Only managed, ad-hoc, master and auto modes are supported"
+ return 1
+ fi
+
+ # We only change the mode if it's not the same as some drivers
+ # only do managed and throw an error changing to managed
+ local cur_mode=$( iwconfig_get_mode "${iface}" )
+ if [[ ${cur_mode} != "${x}" ]]; then
+ if ! iwconfig "${iface}" mode "${x}" ; then
+ eerror "${iface} does not support setting the mode to \"${x}\""
+ return 1
+ fi
+ fi
+
+ # These arrays hold the results of our scan
+ local -a mac_APs essid_APs enc_APs
+
+ # Has an ESSID been forced?
+ if [[ -n ${ESSID} ]]; then
+ iwconfig_associate "${iface}" && return 0
+ [[ ${ESSID} == "any" ]] && iwconfig_force_preferred "${iface}" && return 0
+
+ eval ESSID=\"\$\{adhoc_essid_${ifvar}\}\"
+ if [[ -n ${ESSID} ]]; then
+ iwconfig_setup_specific "${iface}" ad-hoc
+ return $?
+ fi
+ return 1
+ fi
+
+ # Do we have a preferred Access Point list specific to the interface?
+ eval x=( \"\$\{preferred_aps_${ifvar}\[@\]\}\" )
+ [[ -n ${x} ]] && preferred_aps=( "${x[@]}" )
+
+ # Do we have a blacklist Access Point list specific to the interface?
+ eval x=( \"\$\{blacklist_aps_${ifvar}\[@\]\}\" )
+ [[ -n ${e} ]] && blacklist_aps=( "${x[@]}" )
+
+ # Are we forcing preferred only?
+ eval x=\"\$\{associate_order_${ifvar}\}\"
+ [[ -n ${x} ]] && associate_order="${x}"
+ associate_order=$( echo "${associate_order:-any}" | tr '[:upper:]' '[:lower:]' )
+
+ if [[ ${associate_order} == "forcepreferredonly" ]]; then
+ iwconfig_force_preferred "${iface}" && return 0
+ else
+ iwconfig_scan "${iface}" || return 1
+ iwconfig_scan_report
+
+ # Strip AP's from the list that have already been associated with
+ # other wireless cards in the system if requested
+ eval x=\"\$\{unique_ap_${ifvar}\}\"
+ [[ -n ${x} ]] && unique_ap="${x}"
+ unique_ap=$( echo "${unique_ap:-no}" | tr '[:upper:]' '[:lower:]' )
+ [[ ${unique_ap} != "no" ]] && iwconfig_strip_associated "${iface}"
+
+ iwconfig_connect_preferred "${iface}" && return 0
+ [[ ${associate_order} == "forcepreferred" ]] \
+ && iwconfig_force_preferred "${iface}" && return 0
+ [[ ${associate_order} == "any" || ${associate_order} == "forceany" ]] \
+ && iwconfig_connect_not_preferred "${iface}" && return 0
+ fi
+
+ e="associate with"
+ [[ -z ${mac_APs} ]] && e="find"
+ [[ ${preferred_only} == "force" || ${preferred_aps} == "forceonly" ]] \
+ && e="force"
+ e="Couldn't ${e} any access points on ${iface}"
+
+ eval ESSID=\"\$\{adhoc_essid_${ifvar}\}\"
+ if [[ -n ${ESSID} ]]; then
+ ewarn "${e}"
+ iwconfig_setup_specific "${iface}" ad-hoc
+ return $?
+ fi
+
+ if ${IN_BACKGROUND}; then
+ export IN_BACKGROUND
+ /etc/init.d/net.${iface} stop &
+ exit 0
+ fi
+
+ eerror "${e}"
+ return 1
+}
+
+# bool iwconfig_pre_start(char *iface)
+#
+# Start entry point
+# First we check if wireless extensions exist on the interface
+# If they are then we configue wireless
+iwconfig_pre_start() {
+ local iface="$1" r=0
+
+ # We don't configure wireless if we're being called from
+ # the background
+ ${IN_BACKGROUND} && return 0
+
+ save_options "ESSID" ""
+ interface_exists "${iface}" || return 0
+
+ # We need to bring the interface up, as some cards do not register
+ # in /proc/wireless until they are brought up.
+ interface_up "${iface}"
+
+ if ! iwconfig_check_extensions "${iface}" ; then
+ veinfo "Wireless extensions not found for ${iface}"
+ return 0
+ fi
+
+ # Check for rf_kill - only ipw supports this at present, but other
+ # cards may in the future.
+ if [[ -e "/sys/class/net/${iface}/device/rf_kill" ]]; then
+ if [[ $( < "/sys/class/net/${iface}/device/rf_kill" ) != 0 ]]; then
+ eerror "Wireless radio has been killed for interface ${iface}"
+ return 1
+ fi
+ fi
+
+ einfo "Configuring wireless network for ${iface}"
+
+ # Are we a proper IEEE device?
+ # Most devices reutrn IEEE 802.11b/g - but intel cards return IEEE in lower case
+ # and RA cards return RAPCI or similar which really sucks :(
+ # For the time being, we will test prism54 not loading firmware which reports
+ # NOT READY!
+ x=$( iwconfig_get_type "${iface}" )
+ if [[ ${x} == "NOT READY!" ]]; then
+ eerror "Looks like there was a probem loading the firmware for ${iface}"
+ return 1
+ fi
+
+ # Setup IFS incase parent script has modified it
+ local IFS=$' '$'\n'$'\t'
+
+ if [[ ${background} == "yes" ]]; then
+ IN_BACKGROUND=true
+ iwconfig_configure "${iface}" &>/dev/null \
+ && save_options "ESSID" "${ESSID}" \
+ || iwconfig_defaults "${iface}" \
+ && interface_down "${iface}" \
+ && mark_service_stopped "net.${iface}" \
+ &
+ go_background
+ fi
+
+ if iwconfig_configure "${iface}" ; then
+ save_options "ESSID" "${ESSID}"
+ return 0
+ fi
+
+ eerror "Failed to configure wireless for ${iface}"
+ iwconfig_defaults "${iface}"
+ unset ESSID ESSIDVAR
+ interface_down "${iface}"
+ return 1
+}
+
+# vim:ts=4
diff --git a/lib/rcscripts/net.modules.d/macchanger b/lib/rcscripts/net.modules.d/macchanger
new file mode 100644
index 0000000..7cc2c5b
--- /dev/null
+++ b/lib/rcscripts/net.modules.d/macchanger
@@ -0,0 +1,126 @@
+#!/bin/bash
+# Copyright (c) 2004-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# Contributed by Roy Marples (uberlord@gentoo.org)
+
+# char* macchanger_provides(void)
+#
+# Returns a string to change module definition for starting up
+macchanger_provides() {
+ echo "macchanger"
+}
+
+# void macchanger_depend(void)
+#
+# Sets up the dependancies for the module
+macchanger_depend() {
+ before macnet
+}
+
+# bool macchanger_check_installed(void)
+#
+# macchanger is always installed as an interface can change to a specific
+# mac address, and an interface is always installed
+macchanger_check_installed() {
+ return 0
+}
+
+# bool macchanger_check_depends(void)
+#
+# Checks to see if we have the needed functions
+macchanger_check_depends() {
+ local f
+
+ for f in interface_get_mac_address interface_set_mac_address; do
+ [[ $( type -t "${f}" ) == "function" ]] && continue
+ eerror "macchanger: missing required function ${f}\n"
+ return 1
+ done
+
+ return 0
+}
+
+# bool macchanger_pre_start(char *iface)
+#
+# Configures the MAC address for iface
+macchanger_pre_start() {
+ # We don't change MAC addresses from background
+ ${IN_BACKGROUND} && return 0
+
+ local iface="$1" mac opts ifvar=$( bash_variable "$1" )
+
+ eval mac=\"\$\{mac_${ifvar}\}\"
+ [[ -z ${mac} ]] && return 0
+
+ interface_exists "${iface}" true || return 1
+
+ ebegin "Changing MAC address of ${iface}"
+
+ mac=$( echo "${mac}" | tr '[:upper:]' '[:lower:]' )
+ case "${mac}" in
+ # specific mac-addr, i wish there were a shorter way to specify this
+ [0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f])
+ # We don't need macchanger to change to a specific mac address
+ interface_set_mac_address "${iface}" "${mac}"
+ eend "$?"
+ if [[ $? == "0" ]]; then
+ mac=$( interface_get_mac_address "${iface}" )
+ eindent
+ einfo "changed to ${mac}"
+ eoutdent
+ return 0
+ fi
+ ;;
+
+ # increment MAC address, default macchanger behavior
+ increment) opts="${opts}" ;;
+
+ # randomize just the ending bytes
+ random-ending) opts="${opts} -e" ;;
+
+ # keep the same kind of physical layer (eg fibre, copper)
+ random-samekind) opts="${opts} -a" ;;
+
+ # randomize to any known vendor of any physical layer type
+ random-anykind) opts="${opts} -A" ;;
+
+ # fully random bytes
+ random-full) opts="${opts} -r" ;;
+
+ # default case is just to pass on all the options
+ *) opts="${opts} ${mac}" ;;
+ esac
+
+ if [[ ! -x /sbin/macchanger ]]; then
+ eerror "For changing MAC addresses, emerge net-analyzer/macchanger"
+ return 1
+ fi
+
+ # The interface needs to be up for macchanger to work most of the time
+ interface_down "${iface}"
+
+ mac=$( /sbin/macchanger ${opts} "${iface}" \
+ | sed -n -e 's/^Faked MAC:.*\<\(..:..:..:..:..:..\)\>.*/\U\1/p' )
+
+ # Sometimes the interface needs to be up ....
+ if [[ -z ${mac} ]]; then
+ interface_up "${iface}"
+ mac=$( /sbin/macchanger ${opts} "${iface}" \
+ | sed -n -e 's/^Faked MAC:.*\<\(..:..:..:..:..:..\)\>.*/\U\1/p' )
+ fi
+
+ if [[ -z ${mac} ]]; then
+ eend 1 "Failed to set MAC address"
+ return 1
+ fi
+
+ eend 0
+ eindent
+ einfo "changed to ${mac}"
+ eoutdent
+
+ return 0 #important
+}
+
+# vim:ts=4
diff --git a/lib/rcscripts/net.modules.d/macnet b/lib/rcscripts/net.modules.d/macnet
new file mode 100644
index 0000000..3ab8cd1
--- /dev/null
+++ b/lib/rcscripts/net.modules.d/macnet
@@ -0,0 +1,72 @@
+#!/bin/bash
+# Copyright (c) 2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# Contributed by Roy Marples (uberlord@gentoo.org)
+# Many thanks to all the people in the Gentoo forums for their ideas and
+# motivation for me to make this and keep on improving it
+
+# void macnet_depend(void)
+#
+# Sets up the dependancies for the module
+macnet_depend() {
+ before interface wireless
+ after macchanger
+}
+
+# bool macnet_check_installed(void)
+#
+# Always returns 0 as we are "installed" by wireless in the depend function
+macnet_check_installed() {
+ return 0
+}
+
+# char* macnet_provides(void)
+#
+# Returns a string to change module definition for starting up
+macnet_provides() {
+ echo "macnet"
+}
+
+# bool macnet_check_depends(void)
+#
+# Checks to see if we have the needed functions
+macnet_check_depends() {
+ local f
+
+ for f in interface_get_mac_address; do
+ [[ $( type -t "${f}" ) == "function" ]] && continue
+ eerror "macnet: missing required function ${f}\n"
+ return 1
+ done
+
+ return 0
+}
+
+# bool macnet_start(char *iface)
+#
+# All interfaces and module scripts expose modulename_get_vars
+# which returns a space seperated list of user configuration variables
+# We can override each variable here from a given MAC address of the interface
+# Always returns 0
+macnet_pre_start() {
+ local iface="$1"
+
+ interface_exists "${iface}" || return 0
+
+ # We need to bring the interface up for some interfaces, otherwise the MAC
+ # address isn't consistent - mainly wireless cards with firmware uploading.
+ interface_up "${iface}"
+
+ local mac=$( interface_get_mac_address "${iface}" )
+ [[ -z ${mac} ]] && return 0
+
+ vebegin "Configuring ${iface} for MAC address ${mac}" 2>/dev/null
+ mac="${mac//:}"
+ configure_variables "${iface}" "${mac}"
+ veend 0 2>/dev/null
+
+ return 0
+}
+
+# vim:ts=4
diff --git a/lib/rcscripts/net.modules.d/netplug b/lib/rcscripts/net.modules.d/netplug
new file mode 100644
index 0000000..9f3b77d
--- /dev/null
+++ b/lib/rcscripts/net.modules.d/netplug
@@ -0,0 +1,123 @@
+#!/bin/bash
+# Copyright (c) 2004-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# Contributed by Roy Marples (uberlord@gentoo.org)
+
+# char* netplug_provides(void)
+#
+# Returns a string to change module definition for starting up
+netplug_provides() {
+ echo "netplug"
+}
+
+# void netplug_depend(void)
+#
+# Sets up the dependancies for the module
+netplug_depend() {
+ after macnet
+ before interface
+}
+
+# bool netplug_check_installed(void)
+#
+# Returns 0 if netplug is installed, otherwise 1
+netplug_check_installed() {
+ if [[ ! -x /sbin/netplugd ]]; then
+ ${1:-false} && eerror "For netplug support, emerge sys-apps/netplug"
+ return 1
+ fi
+ return 0
+}
+
+# bool netplug_check_depends(void)
+#
+# Checks to see if we have the needed functions
+netplug_check_depends() {
+ local f
+
+ for f in interface_exists; do
+ [[ $( type -t "${f}" ) == "function" ]] && continue
+ eerror "netplug: missing required function ${f}\n"
+ return 1
+ done
+
+ return 0
+}
+
+# bool netplug_pre_start(char *interface)
+#
+# Start netplug on an interface
+netplug_pre_start() {
+ local iface="$1" timeout i
+ local pidfile="/var/run/netplug.${iface}.pid"
+
+ # We don't start netplug if we're being called from the background
+ ${IN_BACKGROUND} && return 0
+
+ # We need a valid MAC address
+ # It's a basic test to ensure it's not a virtual interface
+ local mac=$(interface_get_mac_address "${iface}")
+ if [[ -z ${mac} ]]; then
+ vewarn "netplug only works on interfaces with a valid MAC address"
+ return 0
+ fi
+
+ # We don't work on wirelesss interfaces
+ if [[ $(type -t wireless_check_extensions) == "function" ]]; then
+ if wireless_check_extensions "${iface}"; then
+ veinfo "netplug does not work on wireless interfaces"
+ return 0
+ fi
+ fi
+
+ ebegin "Starting netplug on ${iface}"
+
+ # We need the interface up for netplug to listen to netlink events
+ interface_up "${iface}"
+
+ # Mark the us as inactive so netplug can restart us
+ mark_service_inactive "net.${iface}"
+
+ # Start netplug
+ start-stop-daemon --start --exec /sbin/netplugd \
+ --pidfile "${pidfile}" \
+ -- -i "${iface}" -P -p "${pidfile}" -c /dev/null
+ eend "$?" || return 1
+
+ eindent
+ veinfo "Waiting for ${iface} to be marked as started"
+
+ eval timeout=\"\$\{plug_timeout_${ifvar}\:-10}\"
+ [[ ${timeout} == "0" ]] \
+ && vewarn "WARNING: infinite timeout set for ${iface} to come up"
+
+ i=0
+ while true ; do
+ if service_started "net.${iface}"; then
+ local addr=$( interface_get_address "${iface}" )
+ einfo "${iface} configured with address ${addr}"
+ exit 0
+ fi
+ sleep 1
+ (( i++ ))
+ [[ ${i} == "${timeout}" || ${i} -gt "${timeout}" ]] && break
+ done
+
+ eend 1 "Failed to configure ${iface} in the background"
+ exit 0
+}
+
+# bool netplug_post_stop(char *iface)
+#
+# Stops netplug on an interface
+# Returns 0 (true) when successful, non-zero otherwise
+netplug_post_stop() {
+ ${IN_BACKGROUND} && return 0
+ ebegin "Stopping netplug on $1"
+ start-stop-daemon --stop --exec /sbin/netplugd \
+ --pidfile "/var/run/netplug.$1.pid"
+ eend $?
+}
+
+# vim:ts=4
diff --git a/lib/rcscripts/net.modules.d/pump b/lib/rcscripts/net.modules.d/pump
new file mode 100644
index 0000000..98ac556
--- /dev/null
+++ b/lib/rcscripts/net.modules.d/pump
@@ -0,0 +1,136 @@
+#!/bin/bash
+# Copyright (c) 2004-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# Contributed by Roy Marples (uberlord@gentoo.org)
+
+# Fix any potential localisation problems
+# Note that LC_ALL trumps LC_anything_else according to locale(7)
+pump() {
+ LC_ALL=C /sbin/pump "$@"
+}
+
+# char* pump_provides(void)
+#
+# Returns a string to change module definition for starting up
+pump_provides() {
+ echo "dhcp"
+}
+
+# void pump_depend(void)
+#
+# Sets up the dependancies for the module
+pump_depend() {
+ after interface
+}
+
+# bool pump_check_installed(void)
+#
+# Returns 1 if pump is installed, otherwise 0
+pump_check_installed() {
+ [[ -x /sbin/pump ]] && return 0
+ ${1:-false} && eerror "For DHCP (pump) support, emerge net-misc/pump"
+ return 1
+}
+
+# bool pump_check_depends(void)
+#
+# Checks to see if we have the needed functions
+pump_check_depends() {
+ local f
+
+ for f in interface_exists interface_get_address; do
+ [[ $( type -t "${f}" ) == "function" ]] && continue
+ eerror "pump: missing required function ${f}\n"
+ return 1
+ done
+
+ return 0
+}
+
+# char* pump_get_vars(char *interface)
+#
+# Returns a string spaced with possible user set
+# configuration variables
+pump_get_vars() {
+ echo "pump_$1 dhcp_$1"
+}
+
+# bool pump_stop(char *iface)
+#
+# Stop pump on an interface
+# Return 0 if pump is not running or we stop it successfully
+# Otherwise 1
+pump_stop() {
+ local iface="$1" count e
+
+ pump_check_installed || return 0
+
+ # We check for a pump process first as querying for status
+ # causes pump to spawn a process
+ pidof /sbin/pump &>/dev/null || return 0
+
+ # Check that pump is running on the interface
+ pump --status --interface "${iface}" 2>/dev/null \
+ | grep -q "^Device ${iface}" || return 0
+
+ # Pump always releases the lease
+ ebegin "Stopping pump on ${iface}"
+ pump --release --interface "${iface}"
+ eend "$?" "Failed to stop pump"
+ return "$?"
+}
+
+# bool pump_start(char *iface)
+#
+# Start pump on an interface by calling pumpcd $iface $options
+#
+# Returns 0 (true) when a dhcp address is obtained, otherwise
+# the return value from pump
+pump_start() {
+ local iface="$1" opts d ifvar=$( bash_variable "$1" ) search
+
+ interface_exists "${iface}" true || return 1
+
+ eval opts=\" \$\{pump_${ifvar}\} \"
+
+ # Map some generic options to pump
+ eval d=\" \$\{dhcp_${ifvar}\} \"
+ [[ ${d} == " " ]] && d=" ${dhcp} "
+ [[ ${d} == *" nodns "* ]] && opts="${opts} --no-dns"
+ [[ ${d} == *" nogateway "* ]] && opts="${opts} --no-gateway"
+ [[ ${d} == *" nontp "* ]] && opts="${opts} --no-ntp"
+
+ eval search=\"\$\{dns_search_path_${ifvar}\}\"
+ [[ -n ${search} ]] && opts="${opts} --search-path='"${search}"'"
+
+ # Add our route metric
+ eval metric=\"\$\{metric_${ifvar}\}\"
+ [[ -n ${metric} ]] && opts="${opts} --route-metric ${metric}"
+
+ [[ ! -d "${statedir}/${iface}" ]] && mkdir -m 0755 -p "${statedir}/${iface}"
+
+ opts="${opts} --win-client-ident --etc-dir=${statedir}/${iface}"
+ opts="${opts} --script /lib/rcscripts/net.modules.d/helpers.d/pump-wrapper"
+ opts="${opts} --keep-up --interface ${iface}"
+
+ # Bring up DHCP for this interface (or alias)
+ ebegin "Running pump"
+
+ if [[ ${background} == "yes" ]]; then
+ eval pump ${opts} &
+ eend 0
+ go_background
+ fi
+
+ eval pump ${opts}
+ eend "$?" || return "$?"
+
+ # pump succeeded, show address retrieved
+ local addr=$( interface_get_address "${iface}" )
+ einfo "${iface} received address ${addr}"
+
+ return 0
+}
+
+# vim:ts=4
diff --git a/lib/rcscripts/net.modules.d/rename b/lib/rcscripts/net.modules.d/rename
new file mode 100644
index 0000000..ddab8b0
--- /dev/null
+++ b/lib/rcscripts/net.modules.d/rename
@@ -0,0 +1,86 @@
+#!/bin/bash
+# Copyright (c) 2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# Contributed by Roy Marples (uberlord@gentoo.org)
+
+# char* rename_provides(void)
+#
+# Returns a string to change module definition for starting up
+rename_provides() {
+ echo "rename"
+}
+
+# void rename_depend(void)
+#
+# Sets up the dependancies for the module
+rename_depend() {
+ after macchanger macnet
+ before wireless interface
+}
+
+# bool rename_check_installed(void)
+#
+# We are always installed
+rename_check_installed() {
+ return 0
+}
+
+# bool rename_check_depends(void)
+#
+# Checks to see if we have the needed functions
+rename_check_depends() {
+ return 0
+}
+
+# char* rename_get_vars(char *interface)
+#
+# Returns a string spaced with possible user set
+# configuration variables
+rename_get_vars() {
+ echo "rename_$1"
+}
+
+# bool rename_pre_start(char *iface)
+#
+# Checks to see if we have to rename the interface
+rename_pre_start() {
+ local iface="$1" newname="" mac ifvar=$( bash_variable "$1" )
+
+ interface_exists "${iface}" || return 0
+
+ eval newname=\"\$\{rename_${ifvar}\}\"
+ [[ -z ${newname} || ${iface} == "${newname}" ]] && return 0
+
+ # We cannot rename vlan interfaces as /proc/net/vlan/config always
+ # returns the old interface name. We don't bail out though as it's
+ # not critical that the interface gets renamed.
+ if [[ -d /proc/net/vlan/config ]] ; then
+ if grep -q "^eth0.2 " /proc/net/vlan/config ; then
+ eerror "Cannot rename VLAN interfaces"
+ return 0
+ fi
+ fi
+
+ ebegin "Renaming \"${iface}\" to \"${newname}\""
+
+ # Ensure that we have an init script
+ [[ ! -e "/etc/init.d/net.${newname}" ]] \
+ && ( cd /etc/init.d ; ln -s net.lo "net.${newname}" )
+
+ # Ensure that the interface is down and without any addresses or we
+ # will not work
+ interface_del_addresses "${iface}"
+ interface_down "${iface}"
+ interface_set_name "${iface}" "${newname}"
+ eend "$?" "Failed to rename interface" || return 1
+
+ # Mark us as stopped, start the new interface and bail cleanly
+ mark_service_stopped "net.${iface}"
+ einfo "Stopped configuration of ${iface} due to renaming"
+ service_stopped "net.${newname}" && start_service "net.${newname}"
+
+ exit 1
+}
+
+# vim:ts=4
diff --git a/lib/rcscripts/net.modules.d/system b/lib/rcscripts/net.modules.d/system
new file mode 100644
index 0000000..d6b6f46
--- /dev/null
+++ b/lib/rcscripts/net.modules.d/system
@@ -0,0 +1,134 @@
+#!/bin/bash
+# Copyright (c) 2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# void system_depend(void)
+#
+# Sets up the dependancies for the module
+system_depend() {
+ after interface essidnet
+ before dhcp
+}
+
+# bool system_check_installed(void)
+#
+# Always returns 0 as we are writing to files
+system_check_installed() {
+ return 0
+}
+
+# char* system_provides(void)
+#
+# Returns a string to change module definition for starting up
+system_provides() {
+ echo "system"
+}
+
+# bool system_check_depends(void)
+#
+# Checks to see if we have the needed functions
+system_check_depends() {
+ return 0
+}
+
+# char* ifconfig_get_vars(char *interface)
+#
+# Returns a string spaced with possible user set configuration variables
+system_get_vars() {
+ echo "dns_servers_$1 dns_domain_$1 dns_search_path_$1 ntp_servers_$1 nis_domain_$1 nis_servers_$1"
+}
+
+system_dns() {
+ local iface="$1" ifvar=$( bash_variable "$1" ) x
+ local conffile="${statedir}/${iface}/resolv.conf" tmpfile="${conffile}.$$"
+ local -a servers
+
+ eval servers=( \"\$\{dns_servers_${ifvar}\[@\]\}\" )
+ [[ -z ${servers} ]] && return 0
+
+ echo "# Generated by net-scripts for interface ${iface}" > "${tmpfile}"
+ chmod 644 "${tmpfile}"
+
+ eval x=\"\$\{dns_domain_${ifvar}\}\"
+ [[ -n ${x} ]] && echo "domain ${x}" >> "${tmpfile}"
+
+ for x in ${servers[@]}; do
+ echo "nameserver ${x}" >> "${tmpfile}"
+ done
+
+ eval x=\"\$\{dns_search_path_${ifvar}\}\"
+ [[ -n ${x} ]] && echo "search ${x}" >> "${tmpfile}"
+
+ mv "${tmpfile}" "${conffile}"
+}
+
+system_ntp() {
+ local iface="$1" ifvar=$( bash_variable "$1" ) x
+ local conffile="${statedir}/${iface}/ntp.conf" tmpfile="${conffile}.$$"
+ local -a servers
+
+ eval servers=( \"\$\{ntp_servers_${ifvar}\[\@\]\}\" )
+ [[ -z ${servers} ]] && return 0
+
+ echo "# Generated by net-scripts for interface ${iface}" > "${tmpfile}"
+ chmod 644 "${tmpfile}"
+
+ echo "restrict default noquery notrust nomodify" >> "${tmpfile}"
+ echo "restrict 127.0.0.1" >> "${tmpfile}"
+
+ for x in ${servers[@]}; do
+ echo "restrict ${x} nomodify notrap noquery" >> "${tmpfile}"
+ echo "server ${x}" >> "${tmpfile}"
+ done
+
+ echo "driftfile /var/lib/ntp/ntp.drift" >> "${tmpfile}"
+ echo "logfile /var/log/ntp.log" >> "${tmpfile}"
+
+ mv "${tmpfile}" "${conffile}"
+}
+
+system_nis() {
+ local iface="$1" ifvar=$( bash_variable "$1" ) domain x
+ local conffile="${statedir}/${iface}/yp.conf" tmpfile="${conffile}.$$"
+ local -a servers
+
+ eval servers=( \"\$\{nis_servers_${ifvar}\[\@\]\}\" )
+ eval domain=\"\$\{nis_domain_${ifvar}\}\"
+ [[ -z ${servers} && -z ${domain} ]] && return 0
+
+ echo "# Generated by net-scripts for interface ${iface}" > "${tmpfile}"
+ chmod 644 "${tmpfile}"
+
+ if [[ -n ${domain} ]]; then
+ /bin/hostname -y "${domain}"
+ if [[ -n ${servers} ]]; then
+ for x in ${servers}; do
+ echo "domain ${domain} server ${x}" >> "${tmpfile}"
+ done
+ else
+ echo "domain ${domain} broadcast" >> "${tmpfile}"
+ fi
+ else
+ for x in ${servers}; do
+ echo "ypserver ${x}" >> "${tmpfile}"
+ done
+ fi
+
+ mv "${tmpfile}" "${conffile}"
+}
+
+# bool system_post_start(char *iface)
+#
+# Configures the host system for dns, ntp and nis information
+# Always returns 0
+system_post_start() {
+ local iface="$1"
+
+ system_dns "${iface}"
+ system_ntp "${iface}"
+ system_nis "${iface}"
+
+ return 0
+}
+
+# vim:ts=4
diff --git a/lib/rcscripts/net.modules.d/tuntap b/lib/rcscripts/net.modules.d/tuntap
new file mode 100644
index 0000000..150b892
--- /dev/null
+++ b/lib/rcscripts/net.modules.d/tuntap
@@ -0,0 +1,116 @@
+#!/bin/bash
+# Copyright (c) 2004-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# Contributed by Roy Marples (uberlord@gentoo.org)
+
+# Fix any potential localisation problems
+# Note that LC_ALL trumps LC_anything_else according to locale(7)
+tunctl() {
+ LC_ALL=C /usr/bin/tunctl "$@"
+}
+
+# char* tuntap_provides(void)
+#
+# Returns a string to change module definition for starting up
+tuntap_provides() {
+ echo "tuntap"
+}
+
+# void tuntap_depend(void)
+#
+# Sets up the dependancies for the module
+tuntap_depend() {
+ after interface
+ before dhcp
+}
+
+# bool tuntap_check_installed(void)
+#
+# Returns 1 if tuntap is installed, otherwise 0
+tuntap_check_installed() {
+ [[ -x /usr/bin/tunctl ]] && return 0
+ ${1:-false} && eerror "For TunTap support, emerge sys-apps/usermode-utilities"
+ return 1
+}
+
+# bool tuntap_check_depends(void)
+#
+# Checks to see if we have the needed functions
+tuntap_check_depends() {
+ local f
+
+ for f in interface_exists interface_type; do
+ [[ $( type -t "${f}" ) == "function" ]] && continue
+ eerror "tuntap: missing required function ${f}\n"
+ return 1
+ done
+
+ return 0
+}
+
+# bool tuntap_check_kernel(void)
+#
+# Checks to see if the tun is present - if not try and load it
+# Returns 1 if there is a problem
+tuntap_check_kernel() {
+ [[ -a /dev/net/tun ]] && return 0
+ /sbin/modprobe tun && sleep 1
+ [[ -a /dev/net/tun ]] && return 0
+ eerror "TUN/TAP support is not present in this kernel"
+ return 1
+}
+
+# char* tuntap_get_vars(char *interface)
+#
+# Returns a string spaced with possible user set
+# configuration variables
+tuntap_get_vars() {
+ echo "tunctl_$1"
+}
+
+# bool tuntap_pre_start(char *iface)
+#
+# Create the device, give it the right perms
+tuntap_pre_start() {
+ local iface="$1" opts ifvar=$( bash_variable "$1" )
+ local itype=$( interface_type "${iface}" )
+
+ # Check that we are a valid tun/tap interface
+ # NOTE - the name can be anything as we define it
+ # but for simplicity in the config we require either
+ # tun or tap
+ [[ ${itype} != "tun" && ${itype} != "tap" ]] && return 0
+
+ tuntap_check_kernel || return 1
+
+ # Get our options
+ eval opts=\"\$\{tunctl_${ifvar}\}\"
+
+ ebegin "Creating Tun/Tap interface ${iface}"
+ tunctl ${opts} -t "${iface}"
+ eend "$?" || return 1
+
+ return 0
+}
+
+# bool tuntap_stop(char *iface)
+#
+# Removes the device
+tuntap_stop() {
+ local iface="$1"
+
+ tuntap_check_installed || return 0
+ interface_exists "${iface}" || return 0
+
+ # tunctl doesn't always error on on tun/tap
+ # interfaces (mainly aliases, etc)
+ if tunctl -d "${iface}" &>/dev/null ; then
+ interface_exists "${iface}" \
+ || einfo "Destroyed Tun/Tap interface ${iface}"
+ fi
+
+ return 0
+}
+
+# vim:ts=4
diff --git a/lib/rcscripts/net.modules.d/udhcpc b/lib/rcscripts/net.modules.d/udhcpc
new file mode 100644
index 0000000..25596c5
--- /dev/null
+++ b/lib/rcscripts/net.modules.d/udhcpc
@@ -0,0 +1,153 @@
+#!/bin/bash
+# Copyright (c) 2004-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# Contributed by Roy Marples (uberlord@gentoo.org)
+
+# Fix any potential localisation problems
+# Note that LC_ALL trumps LC_anything_else according to locale(7)
+udhcpc() {
+ LC_ALL=C /sbin/udhcpc "$@"
+}
+
+# char* udhcpc_provides(void)
+#
+# Returns a string to change module definition for starting up
+udhcpc_provides() {
+ echo "dhcp"
+}
+
+# void udhcpc_depend(void)
+#
+# Sets up the dependancies for the module
+udhcpc_depend() {
+ after interface
+}
+
+# bool udhcpc_check_installed(void)
+#
+# Returns 1 if udhcpc is installed, otherwise 0
+udhcpc_check_installed() {
+ [[ -x /sbin/udhcpc ]] && return 0
+ ${1:-false} && eerror "For DHCP (udhcpc) support, emerge net-misc/udhcp"
+ return 1
+}
+
+# bool udhcpc_check_depends(void)
+#
+# Checks to see if we have the needed functions
+udhcpc_check_depends() {
+ local f
+
+ for f in interface_exists interface_get_address; do
+ [[ $( type -t "${f}" ) == "function" ]] && continue
+ eerror "udhcpc: missing required function ${f}\n"
+ return 1
+ done
+
+ return 0
+}
+
+# char* udhcpc_get_vars(char *interface)
+#
+# Returns a string spaced with possible user set
+# configuration variables
+udhcpc_get_vars() {
+ echo "udhcpc_$1 dhcp_$1"
+}
+
+# bool udhcpc_stop(char *iface)
+#
+# Stops udhcpc running on an interface
+# Return 1 if we fail to stop udhcpc (if it's running) otherwise 0
+udhcpc_stop() {
+ local iface="$1" pidfile="/var/run/udhcpc-$1.pid" d
+
+ udhcpc_check_installed || return 0
+ [[ ! -f ${pidfile} ]] && return 0
+
+ ebegin "Stopping udhcpc on ${iface}"
+ local pid=$( < "${pidfile}" ) e=true
+
+ local ifvar=$( bash_variable "${iface}" )
+ eval d=\" \$\{dhcp_${ifvar}\} \"
+ [[ ${d} == " " ]] && d=" ${dhcp} "
+
+ if [[ ${d} == *" release "* ]]; then
+ kill -s USR2 "${pid}" &>/dev/null
+ [[ -f "/var/cache/dhcp-${iface}.lease" ]] \
+ && rm "/var/cache/dhcp-${iface}.lease"
+ fi
+
+ kill -s TERM "${pid}" &>/dev/null
+
+ [[ -f ${pidfile} ]] && rm -f "${pidfile}"
+
+ ${e}
+ eend "$?"
+ return "$?"
+}
+
+# bool udhcpc_start(char *iface)
+#
+# Start DHCP on an interface by calling udhcpc $iface $options
+#
+# Returns 0 (true) when a DHCP address is obtained, otherwise 1
+udhcpc_start() {
+ local iface="$1" opts pidfile="/var/run/udhcpc-$1.pid"
+ local cachefile="/var/cache/dhcp-$1.lease" d
+
+ interface_exists "${iface}" true || return 1
+
+ local ifvar=$( bash_variable "${iface}" ) opts hostname
+ eval opts=\"\$\{udhcpc_${ifvar}\}\"
+
+ eval d=\" \$\{dhcp_${ifvar}\} \"
+ [[ ${d} == " " ]] && d=" ${dhcp} "
+
+ if [[ ${d} != *" nosendhost "* ]]; then
+ if [[ ! " ${opts}" =~ " -([hH] |-hostname=)" ]]; then
+ local hostname=$( hostname )
+ [[ -n ${hostname} && ${hostname} != "(none)" \
+ && ${hostname} != "localhost" ]] \
+ && opts="${opts} --hostname=${hostname}"
+ fi
+ fi
+
+ # Bring up DHCP for this interface (or alias)
+ ebegin "Running udhcpc"
+
+ # Stop any instance of udhcpc on this interface
+ udhcpc_stop "${interface}"
+
+ # Try and load the cache if it exists
+ if [[ -f ${cachefile} ]]; then
+ if [[ " ${opts}" != *" --request="* && " ${opts} " != *" -r "* ]]; then
+ local x=$( < "${cachefile}" )
+ [[ -n ${x} ]] && opts="${opts} --request=${x}"
+ fi
+ fi
+
+ if [[ ${background} == "yes" ]]; then
+ eval udhcpc ${opts} --script="${MODULES_DIR}/helpers.d/udhcpc-wrapper" \
+ --pidfile="${pidfile}" --interface="${iface}" &>/dev/null &
+ eend 0
+ go_background
+ fi
+
+ x=$( eval udhcpc ${opts} --now --pidfile="${pidfile}" \
+ --interface="${iface}" \
+ --script="${MODULES_DIR}/helpers.d/udhcpc-wrapper" 2>&1 \
+ | egrep -v '^info,' )
+ # We just check the last 5 letters
+ [[ ${x:((${#x} - 5)):5} == "bound" ]]
+ eend "$?" "${x}" || return 1
+
+ # DHCP succeeded, show address retrieved
+ local addr=$( interface_get_address "${iface}" )
+ einfo "${iface} received address ${addr}"
+
+ return 0
+}
+
+# vim:ts=4
diff --git a/lib/rcscripts/net.modules.d/vlan b/lib/rcscripts/net.modules.d/vlan
new file mode 100644
index 0000000..c154a93
--- /dev/null
+++ b/lib/rcscripts/net.modules.d/vlan
@@ -0,0 +1,167 @@
+#!/bin/bash
+# Copyright (c) 2004-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# Contributed by Roy Marples (uberlord@gentoo.org)
+
+# Fix any potential localisation problems
+# Note that LC_ALL trumps LC_anything_else according to locale(7)
+vconfig() {
+ LC_ALL=C /sbin/vconfig "$@"
+}
+
+# char* vlan_provides(void)
+#
+# Returns a string to change module definition for starting up
+vlan_provides() {
+ echo "vlan"
+}
+
+# void vlan_depend(void)
+#
+# Sets up the dependancies for the module
+vlan_depend() {
+ after interface
+ before apipa dhcp
+}
+
+# bool vlan_check_installed(void)
+#
+# Returns 1 if vconfig is installed, otherwise 0
+vlan_check_installed() {
+ [[ -x /sbin/vconfig ]] && return 0
+ ${1:-false} && eerror "For VLAN (802.1q) support, emerge net-misc/vconfig"
+ return 1
+}
+
+# bool vlan_check_depends(void)
+#
+# Checks to see if we have the needed functions
+vlan_check_depends() {
+ local f
+
+ for f in iface_start iface_stop; do
+ [[ $( type -t "${f}" ) == function ]] && continue
+ eerror "vlan: missing required function ${f}\n"
+ return 1
+ done
+
+ return 0
+}
+
+# char* vlan_get_vars(char *interface)
+#
+# Returns a string spaced with possible user set
+# configuration variables
+vlan_get_vars() {
+ echo "vlans_$1 iface_$1_vlans"
+}
+
+# char* vlan_get_vlans(char *interface)
+#
+# Fetch the configured vlans for an interface. Outputs a space
+# separated list on stdout. For example "eth0.1 eth0.2 eth0.3"
+vlan_get_vlans() {
+ sed -n -e 's/^\(.*[0-9]\) \(.* \) .*'"$1"'$/\1/p' \
+ /proc/net/vlan/config 2>/dev/null
+}
+
+# bool vlan_check_kernel(void)
+#
+# Checks to see if the 802.1q module is present - if not try and load it
+# Returns 1 if there is a problem
+vlan_check_kernel() {
+ [[ -d /proc/net/vlan ]] && return 0
+ /sbin/modprobe 8021q &>/dev/null
+ [[ -d /proc/net/vlan ]] && return 0
+ eerror "VLAN (802.1q) support is not present in this kernel"
+ return 1
+}
+
+#bool vlan_pre_start(char *iface)
+#
+# Setup vconfig
+vlan_pre_start() {
+ local iface="$1" opts i x e ifvar=$( bash_variable "$1" )
+
+ eval opts=( \"\$\{vconfig_${ifvar}\[@\]\}\" )
+ [[ -z ${opts} ]] && return 0
+
+ vlan_check_kernel || return 1
+
+ for (( i=0; i<${#opts[@]}; i++ )); do
+ if [[ ${opts[i]} == "set_name_type "* ]]; then
+ x="${opts[i]}"
+ else
+ x="${opts[i]/ / ${iface} }"
+ [[ ${x} == "${opts[i]}" ]] && x="${x} ${iface}"
+ fi
+ e=$( vconfig ${x} 2>&1 1>/dev/null )
+ [[ -z ${e} ]] && continue
+ eerror "vconfig ${x}"
+ eerror "${e}"
+ return 1
+ done
+
+ return 0
+}
+
+# bool vlan_post_start(char *iface)
+#
+# Starts VLANs for a given interface
+#
+# Always returns 0 (true)
+vlan_post_start() {
+ local iface="$1" vlan vlans vlans_old e ifname ifvar=$( bash_variable "$1" )
+
+ eval vlans=\"\$\{vlans_${ifvar}\}\"
+
+ # BACKWARD COMPATIBILITY: check for old vlan variable name
+ eval vlans_old=\"\$\{iface_${ifvar}_vlans\}\"
+ [[ -n ${vlans_old} && -z ${vlans} ]] && vlans="${vlans_old}"
+
+ [[ -z ${vlans} ]] && return 0
+
+ vlan_check_kernel || return 1
+
+ # Start vlans for this interface
+ for vlan in ${vlans}; do
+ einfo "Adding VLAN ${vlan} to ${iface}"
+ e=$( vconfig add "${iface}" "${vlan}" 2>&1 1>/dev/null )
+ if [[ -n ${e} ]] ; then
+ eend 1 "${e}"
+ continue
+ fi
+ eend 0
+
+ # We need to work out the interface name of our new vlan id
+ ifname=$( \
+ sed -n -e 's/^\([^ \t]*\) *| '"${vlan}"' *| .*'"${iface}"'$/\1/p' \
+ /proc/net/vlan/config
+ )
+ iface_start "${ifname}"
+ done
+
+ return 0
+}
+
+# bool vlan_pre_stop(char *iface)
+#
+# Stops VLANs for a given interface
+#
+# Always returns 0 (true)
+vlan_pre_stop() {
+ local iface="$1" vlan
+
+ vlan_check_installed || return 0
+
+ for vlan in $( vlan_get_vlans "${iface}" ); do
+ einfo "Removing VLAN ${vlan##*.} from ${iface}"
+ iface_stop "${vlan}"
+ vconfig rem "${vlan}" >/dev/null
+ done
+
+ return 0
+}
+
+# vim:ts=4
diff --git a/lib/rcscripts/net.modules.d/wpa_supplicant b/lib/rcscripts/net.modules.d/wpa_supplicant
new file mode 100644
index 0000000..f48cf44
--- /dev/null
+++ b/lib/rcscripts/net.modules.d/wpa_supplicant
@@ -0,0 +1,350 @@
+#!/bin/bash
+# Copyright (c) 2004-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# Contributed by Roy Marples (uberlord@gentoo.org)
+
+# Fix any potential localisation problems
+# Note that LC_ALL trumps LC_anything_else according to locale(7)
+wpa_supplicant() {
+ LC_ALL=C /sbin/wpa_supplicant "$@"
+}
+
+wpa_cli() {
+ LC_ALL=C /bin/wpa_cli "$@"
+}
+
+# char* wpa_supplicant_provides(void)
+#
+# Returns a string to change module definition for starting up
+wpa_supplicant_provides() {
+ echo "wireless"
+}
+
+# void wpa_supplicant_depend(void)
+#
+# Sets up the dependancies for the module
+wpa_supplicant_depend() {
+ after macnet
+ before interface
+}
+
+# bool wpa_supplicant_check_installed(void)
+#
+# Returns 0 if wpa_supplicant is installed, otherwise 1
+wpa_supplicant_check_installed() {
+ local report="${1:-false}" installed="0"
+ if [[ ! -x /sbin/wpa_supplicant ]]; then
+ installed="1"
+ ${report} && eerror "For WPA support (wpa_supplicant) support, emerge net-wireless/wpa_supplicant"
+ fi
+ if [[ ! -e /proc/net/packet ]]; then
+ installed="1"
+ ${report} && eerror "wpa_supplicant requires Packet Socket (CONFIG_PACKET=y) enabled in the kernel"
+ fi
+ return "${installed}"
+}
+
+# bool wpa_supplicant_check_depends(void)
+#
+# Checks to see if we have the needed functions
+wpa_supplicant_check_depends() {
+ local f
+
+ for f in interface_exists; do
+ [[ $( type -t "${f}" ) == "function" ]] && continue
+ eerror "wpa_supplicant: missing required function ${f}\n"
+ return 1
+ done
+
+ return 0
+}
+
+# bool wpa_supplicant_check_extensions(char *interface)
+#
+# Checks to see if wireless extensions are enabled on the interface
+wpa_supplicant_check_extensions() {
+ grep -q "^[ \t]*$1:[ \t]" /proc/net/wireless
+}
+
+# char* wpa_supplicant_get_essid(char *interface)
+#
+# Gets the current ESSID of iface
+wpa_supplicant_get_essid() {
+ local i essid
+
+ for (( i=0; i<5; i++ )); do
+ essid=$( wpa_cli -i"$1" status | sed -n -e 's/^ssid=//p' )
+ if [[ -n ${essid} ]]; then
+ echo "${essid}"
+ return 0
+ fi
+ sleep 1
+ done
+
+ return 1
+}
+
+# char* wpa_supplicant_get_ap_mac_address(char *interface)
+#
+# Returns the MAC address of the Access Point
+# the interface is connected to
+wpa_supplicant_get_ap_mac_address() {
+ wpa_cli -i"$1" status | sed -n -e 's/^bssid=\([^=]\+\).*/\U\1/p'
+}
+
+# bool wpa_supplicant_associated(char *interface)
+#
+# Returns 0 if we're associated correctly or 1 if not
+# Note that just because we are associated does not mean we are using the
+# correct encryption keys
+# We only need this for wpa_supplicant-0.3.x
+wpa_supplicant_associated() {
+ local -a status=( "$( wpa_cli -i"$1" status | sed -n -e 's/^\(key_mgmt\|wpa_state\|EAP state\)=\([^=]\+\).*/\U\2/p' )" )
+
+ case "${status[0]}" in
+ "NONE") [[ ${status[1]} == "ASSOCIATED" ]] ;;
+ "IEEE 802.1X (no WPA)") [[ ${status[2]} == "SUCCESS" ]] ;;
+ *) [[ ${status[1]} == "COMPLETED" ]] ;;
+ esac
+
+ return $?
+}
+
+# void wpa_supplicant_kill(char *interface, bool report)
+#
+# Kills any existing wpa_supplicant process on the interface
+wpa_supplicant_kill() {
+ local iface="$1" report="${2:-false}" pidfile
+
+ # Shutdown wpa_cli first, if it's running
+ # This is important as future versions of wpa_supplicant
+ # may send a disconnect message to wpa_cli when it shutsdown
+ pidfile="/var/run/wpa_cli-${iface}.pid"
+ if ! clean_pidfile "${pidfile}" ; then
+ ${report} && ebegin "Stopping wpa_cli on ${iface}"
+ start-stop-daemon --stop --exec /bin/wpa_cli \
+ --pidfile "${pidfile}"
+ ${report} && eend "$?"
+ fi
+
+ # Now shutdown wpa_supplicant
+ pidfile="/var/run/wpa_supplicant-${iface}.pid"
+ if ! clean_pidfile "${pidfile}" ; then
+ ${report} && ebegin "Stopping wpa_supplicant on ${iface}"
+ start-stop-daemon --stop --exec /sbin/wpa_supplicant \
+ --pidfile "${pidfile}"
+ ${report} && eend "$?"
+ else
+ # Support wpa_supplicant-0.3.x
+ local pid=$( pgrep -f '^/sbin/wpa_supplicant .* -i'"${iface}"'[ ]*$' )
+ if [[ -n ${pid} ]]; then
+ ${report} && ebegin "Stopping wpa_supplicant on ${iface}"
+ kill -s TERM "${pid}"
+ ${report} && eend 0
+ fi
+ fi
+
+ # If wpa_supplicant exits uncleanly, we need to remove the stale dir
+ [[ -S "/var/run/wpa_supplicant/${iface}" ]] \
+ && rm -f "/var/run/wpa_supplicant/${iface}"
+}
+
+# bool wpa_supplicant_associate(char *interface)
+#
+# Returns 0 if wpa_supplicant associates and authenticates to an AP
+# otherwise, 1
+wpa_supplicant_associate() {
+ local iface="$1" ifvar=$( bash_variable "$1" ) timeout i
+ eval timeout=\"\$\{associate_timeout_${ifvar}\}\"
+ [[ -z ${timeout} ]] && eval timeout=\"\$\{wpa_timeout_${ifvar}:-60\}\"
+
+ [[ ${timeout} == "0" ]] \
+ && vewarn "WARNING: infinite timeout set for association on ${iface}"
+
+ while true ; do
+ if ${action} ; then
+ service_started "net.${iface}" && return 0
+ else
+ if ! wpa_cli -i"${iface}" status &>/dev/null ; then
+ eend 1 "wpa_supplicant has exited unexpectedly"
+ return 1
+ fi
+ wpa_supplicant_associated "${iface}" && return 0
+ fi
+ sleep 1
+ (( i++ ))
+ [[ ${i} == "${timeout}" || ${i} -gt "${timeout}" ]] && break
+ done
+
+ # Spit out an appropriate error
+ if [[ ${background} != "yes" ]]; then
+ if ${action} ; then
+ eend 1 "Failed to configure ${iface} in the background"
+ else
+ eend 1 "Timed out"
+ fi
+ fi
+
+ # exit without error with wpa_supplicant-0.4.x as we may get kickstarted
+ # when an AP comes in range
+ ${action} && exit 0
+
+ # Kill wpa_supplicant for 0.3.x
+ wpa_supplicant_kill "${iface}"
+ return 1
+}
+
+# bool wpa_supplicant_pre_start(char *interface)
+#
+# Start wpa_supplicant on an interface and wait for association
+# Returns 0 (true) when successful, non-zero otherwise
+wpa_supplicant_pre_start() {
+ local iface="$1" opts timeout action=false
+ local cfgfile="/etc/wpa_supplicant.conf"
+ local actfile="/sbin/wpa_cli.action"
+
+ # We don't configure wireless if we're being called from
+ # the background
+ if ${IN_BACKGROUND} ; then
+ ESSID=$( wpa_supplicant_get_essid "${iface}" )
+ ESSIDVAR=$( bash_variable "${ESSID}" )
+ save_options "ESSID" "${ESSID}"
+ return 0
+ fi
+
+ save_options "ESSID" ""
+
+ # We only work on wirelesss interfaces
+ wpa_supplicant_check_extensions "${iface}" || return 0
+
+ # Kill off any existing wpa_supplicant on this interface
+ # This is so we can re-read the configuration file and clean any stale
+ # directories
+ wpa_supplicant_kill "${iface}" true
+
+ # Check for rf_kill - only ipw supports this at present, but other
+ # cards may in the future
+ if [[ -e "/sys/class/net/${iface}/device/rf_kill" ]]; then
+ if [[ $( < "/sys/class/net/${iface}/device/rf_kill" ) != 0 ]]; then
+ eerror "Wireless radio has been killed for interface ${iface}"
+ return 1
+ fi
+ fi
+
+ # If wireless-tools is installed, try and apply our user config
+ # This is needed for some drivers - such as hostap because they start
+ # the card in Master mode which causes problems with wpa_supplicant.
+ if [[ $( type -t iwconfig_defaults ) == "function" ]]; then
+ iwconfig_defaults "${iface}"
+ iwconfig_user_config "${iface}"
+ fi
+
+ ebegin "Starting wpa_supplicant on ${iface}"
+
+ if [[ ! -f ${cfgfile} ]]; then
+ eend 1 "configuration file ${cfgfile} not found!"
+ return 1
+ fi
+
+ local ctrl_dir=$( sed -n -e 's/[ \t]*#.*//g;s/[ \t]*$//g;s/^ctrl_interface=//p' "${cfgfile}" )
+ if [[ ${ctrl_dir} != "/var/run/wpa_supplicant" ]]; then
+ eerror "${cfgfile} must set"
+ eerror " ctrl_interface=/var/run/wpa_supplicant"
+ eend 1
+ return 1
+ fi
+
+ local ifvar=$( bash_variable "${iface}" )
+ eval opts=\" \$\{wpa_supplicant_${ifvar}\}\"
+ [[ ${opts} != *" -D"* ]] \
+ && ewarn "wpa_supplicant_${ifvar} does not define a driver"
+
+ # Some drivers require the interface to be up
+ interface_up "${iface}"
+
+ version=$( wpa_cli -v | sed -n -e 's/wpa_cli v//p' )
+ version=( ${version//./ } )
+ (( version = version[0] * 1000 + version[1] * 100 + version[2] ))
+
+ # wpa_supplicant 0.4.0 and greater supports wpa_cli actions
+ # This is very handy as if and when different association mechanisms are
+ # introduced to wpa_supplicant we don't have to recode for them as
+ # wpa_cli is now responsible for informing us of success/failure.
+ # The downside of this is that we don't see the interface being configured
+ # for DHCP/static.
+ if [[ ${version} -gt 399 && -x ${actfile} ]]; then
+ opts="${opts} -W -P/var/run/wpa_supplicant-${iface}.pid"
+ action=true
+ [[ ${RC_PARALLEL_STARTUP} == "yes" ]] && background=no
+ fi
+
+ start-stop-daemon --start --exec /sbin/wpa_supplicant \
+ -- ${opts} -B -c/etc/wpa_supplicant.conf -i"${iface}"
+ eend "$?" || return 1
+
+ # Starting wpa_supplication-0.4.0, we can get wpa_cli to
+ # start/stop our scripts from wpa_supplicant messages
+ if ${action} ; then
+ mark_service_inactive "net.${iface}"
+ ebegin "Starting wpa_cli on ${iface}"
+ start-stop-daemon --start --exec /bin/wpa_cli \
+ -- -a"${actfile}" -i"${iface}" \
+ -P"/var/run/wpa_cli-${iface}.pid" -B
+ eend "$?" || return 1
+ fi
+
+ # Background wpa_supplication if required
+ if [[ ${background} == "yes" ]]; then
+ if ! ${action} ; then
+ wpa_supplicant_associate "${iface}" \
+ && export IN_BACKGROUND=true \
+ && /etc/init.d/net.${iface} start >/dev/null &
+ fi
+ go_background
+ fi
+
+ eindent
+ veinfo "Waiting for association"
+ eend 0
+
+ wpa_supplicant_associate "${iface}" || return 1
+
+ # Set ESSID for essidnet and report
+ ESSID=$( wpa_supplicant_get_essid "${iface}" )
+ ESSIDVAR=$( bash_variable "${ESSID}" )
+ save_options "ESSID" "${ESSID}"
+
+ local -a status=( "$( wpa_cli -i${iface} status | sed -n -e 's/^\(bssid\|pairwise_cipher\|key_mgmt\)=\([^=]\+\).*/\U\2/p' | tr '[:lower:]' '[:upper:]' )" )
+ einfo "${iface} connected to \"${ESSID//\\\\/\\\\}\" at ${status[0]}"
+
+ if [[ ${status[2]} == "NONE" ]]; then
+ if [[ ${status[1]} == "NONE" ]]; then
+ ewarn "not using any encryption"
+ else
+ veinfo "using ${status[1]}"
+ fi
+ else
+ veinfo "using ${status[2]}/${status[1]}"
+ fi
+ eoutdent
+
+ if ${action} ; then
+ local addr=$( interface_get_address "${iface}" )
+ einfo "${iface} configured with address ${addr}"
+ exit 0
+ fi
+
+ return 0
+}
+
+# bool wpa_supplicant_post_stop(char *iface)
+#
+# Stops wpa_supplicant on an interface
+# Returns 0 (true) when successful, non-zero otherwise
+wpa_supplicant_post_stop() {
+ ! ${IN_BACKGROUND} && wpa_supplicant_kill "$1" true
+ return 0
+}
+
+# vim:ts=4
diff --git a/man/MAKEDEV.8 b/man/MAKEDEV.8
new file mode 100644
index 0000000..b3c9b84
--- /dev/null
+++ b/man/MAKEDEV.8
@@ -0,0 +1,392 @@
+.\" $Id: MAKEDEV.8 334 2003-03-09 09:06:23Z azarah $
+.TH MAKEDEV 8 "14th August 1994" Linux "Linux Programmer's Manual"
+.SH NAME
+MAKEDEV \- create devices
+.SH SYNOPSIS
+.B "cd dev; ./MAKEDEV -V"
+.br
+.B "cd dev; ./MAKEDEV [ -n ] [ -v ] update"
+.br
+.BI "cd dev; ./MAKEDEV [ -n ] [ -v ] [ -d ]" " device ..."
+.SH DESCRIPTION
+.B MAKEDEV
+is a script that will create the devices in \fC/dev\fP used to interface
+with drivers in the kernel.
+.PP
+This man page is woefully out of date. A large number of devices are supported
+that are not documented here.
+.PP
+Note that programs giving the error ``ENOENT: No such file or
+directory'' normally means that the device file is missing, whereas
+``ENODEV: No such device'' normally means the kernel does not have the
+driver configured or loaded.
+.SH OPTIONS
+.TP
+.B \-V
+Print out version (actually RCS version information) and exit.
+.TP
+.B \-n
+Do not actually update the devices, just print the actions that would be
+performed.
+.TP
+.B \-d
+Delete the devices. The main use for this flag is by
+.B MAKEDEV
+itself.
+.TP
+.B \-v
+Be verbose. Print out the actions as they are performed. This is the
+same output as produced by
+.BR \-n .
+.SH CUSTOMISATION
+Since there is currently no standardisation in what names are used for
+system users and groups, it is possible that you may need to modify
+.B MAKEDEV
+to reflect your site's settings. Near the top of the file is a mapping
+from device type to user, group and permissions (e.g. all CD-ROM devices
+are set from the \fC$cdrom\fP variable). If you wish to change the
+defaults, this is the section to edit.
+.SH DEVICES
+.TP
+.B General Options
+.TP
+.B update
+This only works on kernels which have \fC/proc/interrupts\fP (introduced
+during 1.1.x). This file is scanned to see what devices are currently
+configured into the kernel, and this is compared with the previous
+settings stored in the file called \fCDEVICES\fP.
+Devices which are new since then or have a different major number are
+created, and those which are no longer configured are deleted.
+.TP
+.B generic
+Create a generic subset of devices. This is the standard devices, plus
+floppy drives, various hard drives, pseudo-terminals, console devices,
+basic serial devices, busmice, and printer ports.
+.TP
+.B
+std
+Standard devices.
+These are:
+.B mem
+\- acess to physical memory;
+.B kmem
+\- access to kernel virtual memory;
+.B null
+\- null device (infinite sink);
+.B port
+\- access to I/O ports;
+.B zero
+\- null byte source (infinite source);
+.B core
+\- symlink to /proc/kcore (for kernel debugging);
+.B full
+\- always returns ENOSPACE on write;
+.B ram
+\- ramdisk;
+.B tty
+\- to access the controlling tty of a process.
+.TP
+.B local
+This simply runs
+.BR MAKEDEV.local .
+This is a script that can create any local devices.
+.TP
+.B Virtual Terminals
+.TP
+.I console
+This creates the devices associated with the console. This is the virtual
+terminals
+.RI tty x ,
+where
+.I x
+can be from 0 though 63. The device tty0 is the currently active vt, and
+is also known as \fCconsole\fP. For each vt, there are two devices
+.RI vcs x
+and
+.RI vcsa x ,
+which are used to generate screen-dumps of the vt (the
+.BI vcs x
+is just the text,
+and
+.BI vcsa x
+includes the attributes).
+.TP
+.B Serial Devices
+.TP
+.I ttyS{0..63}
+Serial ports and corresponding dialout device. For device
+.BI ttyS x ,
+there is also the device
+.BI cua x
+which is used to dial out with. This can avoid the need for cooperative
+locks in simple situations.
+.TP
+.I cyclades
+Dial-in and dial-out devices for the cyclades intelligent I/O serial card.
+The dial in device is
+.BI ttyC x
+and the corresponding dial-out device is
+.BI cub x
+Devices for 32 lines are created.
+.TP
+.B Pseudo Terminals
+.TP
+.I pty[p-s]
+Each possible argument will create a bank of 16 master and slave
+pairs. The current kernel (1.2) is limited to 64 such pairs.
+The master pseudo-terminals are
+.BR pty[p-s][0-9a-f] ,
+and the slaves are
+.BR tty[p-s][0-9a-f] .
+.TP
+.B Parallel Ports
+.TP
+.I lp
+Standard parallel ports. The devices are created
+.BR lp0 ,
+.BR lp1 ,
+and
+.BR lp2 .
+These correspond to ports at 0x3bc, 0x378 and 0x278.
+Hence, on some machines, the first printer port may actually be
+.BR lp1 .
+.TP
+.I par
+Alternative to
+.IR lp .
+Ports are named
+.BI par x
+instead of
+.BI lp x .
+.TP
+.B Bus Mice
+.TP
+.I busmice
+The various bus mice devices. This creates the following devices:
+.B logimouse
+(Logitech bus mouse),
+.B psmouse
+(PS/2-style mouse),
+.B msmouse
+(Microsoft Inport bus mouse) and
+.B atimouse
+(ATI XL bus mouse) and
+.B jmouse
+(J-mouse).
+.TP
+.B Joystick Devices
+.TP
+.I js
+Joystick. Creates
+.B js0
+and
+.BR js1 .
+.TP
+.B Disk Devices
+.TP
+.I fd[0-7]
+Floppy disk devices. The device
+.BI fd x
+is the device which autodetects the format, and the additional devices are
+fixed format (whose size is indicated in the name).
+The other devices are named as
+.BI fd xLn .
+The single letter
+.I L
+identifies the type of floppy disk (d = 5.25" DD, h = 5.25" HD, D = 3.5"
+DD, H = 3.5" HD, E = 3.5" ED). The number
+.I n
+represents the capacity of that format in K. Thus the standard formats
+are
+.BI fd x d360 ,
+.BI fd x h1200 ,
+.BI fd x D720 ,
+.BI fd x H1440 ,
+and
+.RI fd x E2880 .
+.IP
+For more information see Alain Knaff's fdutils package.
+.IP
+Devices
+.BI fd0 *
+through
+.BI fd3 *
+are floppy disks on the first controller, and devices
+.BI fd4 *
+through
+.BI fd7 *
+are floppy disks on the second controller.
+.TP
+.I hd[a-d]
+AT hard disks. The device
+.BI hd x
+provides access to the whole disk, with the partitions being
+.BI hd x [0-20].
+The four primary partitions are
+.BI hd x 1
+through
+.BI hd x 4,
+with the logical partitions being numbered from
+.BI hd x 5
+though
+.BI hd x 20.
+(A primary partition can be made into an extended partition, which can hold
+4 logical partitions).
+By default, only the devices for 4 logical partitions are made. The
+others can be made by uncommenting them.
+.IP
+Drives hda and hdb are the two on the first controller. If using the new
+IDE driver (rather than the old HD driver), then hdc and hdd are the two
+drives on the secondary controller. These devices can also be used to
+acess IDE CDROMs if using the new IDE driver.
+.TP
+.I xd[a-d]
+XT hard disks. Partitions are the same as IDE disks.
+.TP
+.I sd[a-h]
+SCSI hard disks. The partitions are similar to the IDE disks, but there
+is a limit of 11 logical partitions
+.RI (sd x 5
+through
+.RI sd x 15).
+This is to allow there to be 8 SCSI disks.
+.TP
+.I loop
+Loopback disk devices. These allow you to use a regular file as a
+block device. This means that images of filesystems can be mounted,
+and used as normal. This creates 8 devices loop0 through loop7.
+.TP
+.B Tape Devices
+.TP
+.I st[0-7]
+SCSI tapes. This creates the rewinding tape device
+.BI st x
+and the non-rewinding tape device
+.BI nst x .
+.TP
+.I qic
+QIC-80 tapes. The devices created are
+.BR rmt8 ,
+.BR rmt16 ,
+.BR tape-d ,
+and
+.BR tape-reset .
+.TP
+.I ftape
+Floppy driver tapes (QIC-117). There are 4 methods of access depending on
+the floppy tape drive. For each of access methods 0, 1, 2 and 3, the
+devices
+.BI rft x
+(rewinding) and
+.BI nrft x
+(non-rewinding) are created. For compatability, devices
+.B ftape
+and
+.B nftape
+are symlinks to
+.B rft0
+and
+.B nrft0
+respectively.
+.TP
+.B CDROM Devices
+.TP
+.I scd[0-7]
+SCSI CD players.
+.TP
+.I sonycd
+Sony CDU-31A CD player.
+.TP
+.I mcd
+Mitsumi CD player.
+.TP
+.I cdu535
+Sony CDU-535 CD player.
+.TP
+.I lmscd
+LMS/Philips CD player.
+.TP
+.I sbpcd{,1,2,3}
+Sound Blaster CD player. The kernel is capable of supporting 16 CDROMs,
+each of which is accessed as
+.BR sbpcd[0-9a-f] .
+These are assigned in groups of 4 to each controller.
+.B sbpcd
+is a symlink to
+.BR sbpcd0 .
+.\" .TP
+.\" .I idecd
+.\" NEC CDR-260 (note: this will probably be obsoleted by the new IDE driver).
+.TP
+.B Scanner
+.TP
+.I logiscan
+Logitech ScanMan32 & ScanMan 256.
+.TP
+.I m105scan
+Mustek M105 Handscanner.
+.TP
+.I ac4096
+A4Tek Color Handscanner.
+.TP
+.B Audio
+.TP
+.I audio
+This creates the audio devices used by the sound driver. These include
+.BR mixer ,
+.BR sequencer ,
+.BR dsp ,
+and
+.BR audio .
+.TP
+.I pcaudio
+Devices for the PC Speaker sound driver. These are
+.BR pcmixer .
+.BR pxsp ,
+and
+.BR pcaudio .
+.TP
+.B Miscellaneous
+.TP
+.I sg
+Generic SCSI devices. The devices created are
+.B sg0 through
+.BR sg7 .
+These
+allow arbitary commands to be sent to any SCSI device. This allows for
+querying information about the device, or controlling SCSI devices that
+are not one of disk, tape or CDROM (e.g. scanner, writeable CDROM).
+.TP
+.I fd
+To allow an arbitary program to be fed input from file descriptor
+.IR x ,
+use
+.BI /dev/fd/ x
+as the file name. This also creates
+BR /dev/stdin ,
+BR /dev/stdout ,
+and
+BR /dev/stderr .
+(Note, these are just symlinks into /proc/self/fd).
+.TP
+.I ibcs2
+Devices (and symlinks) needed by the IBCS2 emulation.
+.TP
+.I apm
+Devices for power management.
+.TP
+.I dcf
+Driver for DCF-77 radio clock.
+.TP
+.I helloworld
+Kernel modules demonstration device. See the modules source.
+.TP
+.B "Network Devices"
+Linux used to have devices in /dev for controlling network devices, but
+that is no longer the case. To see what network devices are known by the
+kernel, look at /proc/net/dev.
+.SH "SEE ALSO"
+Linux Allocated Devices, maintained by H.\ Peter Anvin,
+<Peter.Anvin@linux.org>.
+.SH AUTHOR
+Nick Holloway
diff --git a/man/consoletype.1 b/man/consoletype.1
new file mode 100644
index 0000000..2720f87
--- /dev/null
+++ b/man/consoletype.1
@@ -0,0 +1,28 @@
+.TH CONSOLETYPE 1 "Red Hat, Inc" "RH" \" -*- nroff -*-
+.SH NAME
+.B consoletype
+\- print type of the console connected to standard input
+.SH SYNOPSIS
+.B consoletype
+.SH DESCRIPTION
+.B consoletype
+prints the type of console connected to standard input. It prints
+.I vt
+if console is a virtual terminal (/dev/tty* or /dev/console device if not on
+a serial console),
+.I serial
+if standard input is a serial console (/dev/console or /dev/ttyS*) and
+.I pty
+if standard input is a pseudo terminal.
+.SH RETURN VALUE
+.B consoletype
+returns
+.TP
+.I 0
+if on virtual terminal
+.TP
+.I 1
+if on serial console
+.TP
+.I 2
+if on a pseudo terminal.
diff --git a/man/modules-update.8 b/man/modules-update.8
new file mode 100644
index 0000000..84ac7a8
--- /dev/null
+++ b/man/modules-update.8
@@ -0,0 +1,51 @@
+.TH MODULES-UPDATE 8 "Gentoo Linux" "2001"
+.SH NAME
+modules\-update \- (re)generate /etc/modules.conf
+.SH SYNOPSIS
+.B modules\-update
+[force]
+.SH DESCRIPTION
+.B modules\-update
+is a simple tool to manage
+.IR /etc/modules.conf .
+The Linux module utilities use a single file for all their
+configuration. This makes it difficult for packages to dynamically add
+information about their own modules.
+.PP
+.B modules-update
+makes the dynamic addition of information easier by generating the
+single configuration file from the many files located in
+.IR /etc/modules.d/ .
+All files in that directory are assembled together to form
+.IR /etc/modules.conf .
+.PP
+After generation, a backup of the old file can be found at
+.IR /etc/modules.conf.old .
+.SH "FILES"
+There are two types of file you can put in
+.IR /etc/modules.d/ :
+normal files and exectuable files. Normal files contain standard modules
+configuration information, as described in
+.BR modules.conf (5).
+Executable files are executed and their output is used as extra configuration
+information. Error messages are sent to stderr and thus do not become
+part of the configuration file.
+.SH OPTIONS
+.TP
+.I force
+.B modules\-update
+will check if the current
+.I /etc/modules.conf
+is a generated file by checking for a special tag on the first line. If this
+tag is not found generation is aborted. By supplying
+.I force
+as parameter only a warning is printed.
+.SH "REPORTING BUGS"
+Please report bugs via http://bugs.gentoo.org/
+.SH "SEE ALSO"
+.BR depmod (1),
+.BR modules.conf (5)
+.SH AUTHOR
+This manual page was written by Wichert Akkerman <wakkerma@debian.org>
+for the Debian GNU/Linux system. Modified for
+.I Gentoo Linux.
diff --git a/man/modules.autoload.5 b/man/modules.autoload.5
new file mode 100644
index 0000000..1a0c3e3
--- /dev/null
+++ b/man/modules.autoload.5
@@ -0,0 +1,19 @@
+.TH MODULES.AUTOLOAD 5 "Gentoo Linux" "Nov 2001"
+.SH NAME
+\fI/etc/modules.autoload\fR - kernel modules to load at boot time
+.SH DESCRIPTION
+.PP
+The \fI/etc/modules.autoload\fR
+file contains the names of kernel modules that are to be loaded at boot
+time, one per line. Arguments can be given on the same line as the module
+name. Comments begin with a `#', and everything on the line after it is
+ignored. This file is read by the \fI/etc/init.d/modules\fR initscript,
+which is usually linked in the \fI/etc/runlevels/boot\fR directory.
+.SH "SEE ALSO"
+.BR modules-update (8),
+.BR modprobe (8),
+.BR modules.conf (5)
+.TP
+The \fI/sbin/modules-update\fR script.
+.TP
+The files in \fI/etc/modules.d\fR.
diff --git a/man/rc-status.8 b/man/rc-status.8
new file mode 100644
index 0000000..c91e872
--- /dev/null
+++ b/man/rc-status.8
@@ -0,0 +1,39 @@
+.TH "BASELAYOUT" "8" "May 2004" "baselayout" "baselayout"
+.SH NAME
+rc-status \- show status info about runlevels
+.SH SYNOPSIS
+\fBrc-status\fR \fI[command [runlevel]]\fR
+.SH DESCRIPTION
+\fBrc-status\fR gathers and displays information about the status of init
+scripts in different runlevels. The default behavior is to show information
+about the current runlevel, but any runlevel can be quickly examined.
+directory. They must also conform to the Gentoo runscript standard.
+.SH OPTIONS
+.TP
+\fB\-\-all (\-a)\fR
+Show all runlevels and their services
+.TP
+\fB\-\-list (\-l)\fR
+List all defined runlevels
+.TP
+\fB\-\-nocolor (\-nc)\fR
+Disable color output
+.TP
+\fB\-\-servicelist (\-s)\fR
+Show all services
+.TP
+\fB\-\-unused (\-u)\fR
+Show services not assigned to any runlevel
+.TP
+\fB[runlevel]\fR
+Show information only for the named \fBrunlevel\fR
+.SH "REPORTING BUGS"
+Please report bugs via http://bugs.gentoo.org/
+.SH "SEE ALSO"
+.BR rc-update (8)
+
+http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=4
+.SH AUTHORS
+Mike Frysinger <vapier@gentoo.org>
+.SH "CVS HEADER"
+$Header$
diff --git a/man/rc-update.8 b/man/rc-update.8
new file mode 100644
index 0000000..b5b1d8c
--- /dev/null
+++ b/man/rc-update.8
@@ -0,0 +1,46 @@
+.TH "BASELAYOUT" "8" "May 2004" "baselayout" "baselayout"
+.SH NAME
+rc-update \- add and remove init scripts to a runlevel
+.SH SYNOPSIS
+\fBrc-update\fR \fIadd\fR \fIscript\fR \fI<runlevels>\fR
+.br
+\fBrc-update\fR \fIdel\fR \fIscript\fR \fI[runlevels]\fR
+.br
+\fBrc-update\fR \fIshow\fR \fI[runlevels]\fR
+.SH DESCRIPTION
+Gentoo's init system uses named runlevels. Rather than editing some obscure
+file or managing a directory of symlinks, \fBrc-update\fR exists to quickly
+add or delete init scripts from different runlevels.
+
+All scripts specified with this utility must reside in the \fI/etc/init.d\fR
+directory. They must also conform to the Gentoo runscript standard.
+.SH OPTIONS
+.TP
+\fBadd (\-a)\fR \fIscript\fR \fI<runlevels>\fR
+Add the specified \fIinit script\fR to the specified \fIrunlevels\fR. You
+must specify at least one runlevel.
+
+Example: rc-update add net.eth0 default
+.TP
+\fBdel (\-d)\fR \fIscript\fR \fI[runlevels]\fR
+Delete the specified \fIinit script\fR from the specified \fIrunlevels\fR.
+If you do not specify the \fIrunlevels\fR from which to delete, the script
+will be removed from all exists runlevels.
+
+Example: rc-update del sysklogd
+.TP
+\fBshow (\-s)\fR \fI[runlevels]\fR
+Show all init scripts and the runlevels they belong to. If you specify
+\fIrunlevels\fR to show, then only those will be included in the output.
+
+Example: rc-update show
+.SH "REPORTING BUGS"
+Please report bugs via http://bugs.gentoo.org/
+.SH "SEE ALSO"
+.BR rc-status (8)
+
+http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=4
+.SH AUTHORS
+Mike Frysinger <vapier@gentoo.org>
+.SH "CVS HEADER"
+$Header$
diff --git a/man/start-stop-daemon.8 b/man/start-stop-daemon.8
new file mode 100644
index 0000000..d0d8f0b
--- /dev/null
+++ b/man/start-stop-daemon.8
@@ -0,0 +1,233 @@
+.\" Hey, Emacs! This is an -*- nroff -*- source file.
+.TH START\-STOP\-DAEMON 8 "15th March 1997" "Debian Project" "Debian GNU/Linux"
+.SH NAME
+start\-stop\-daemon \- start and stop system daemon programs
+.SH SYNOPSIS
+.B start-stop-daemon
+.BR -S | --start
+.IR options
+.RB [ \-\- ]
+.IR arguments
+.HP
+.B start-stop-daemon
+.BR -K | --stop
+.IR options
+.HP
+.B start-stop-daemon
+.BR -H | --help
+.HP
+.B start-stop-daemon
+.BR -V | --version
+.SH DESCRIPTION
+.B start\-stop\-daemon
+is used to control the creation and termination of system-level processes.
+Using the
+.BR --exec ", " --pidfile ", " --user ", and " --name " options,"
+.B start\-stop\-daemon
+can be configured to find existing instances of a running process.
+
+With
+.BR --start ,
+.B start\-stop\-daemon
+checks for the existence of a specified process.
+If such a process exists,
+.B start\-stop\-daemon
+does nothing, and exits with error status 1 (0 if
+.BR --oknodo
+is specified).
+If such a process does not exist, it starts an
+instance, using either the executable specified by
+.BR --exec ,
+(or, if specified, by
+.BR --startas ).
+Any arguments given after
+.BR --
+on the command line are passed unmodified to the program being
+started. If
+.B --retry
+is specified then start-stop-daemon will check that the process(es)
+have terminated.
+
+With
+.BR --stop ,
+.B start\-stop\-daemon
+also checks for the existence of a specified process.
+If such a process exists,
+.B start\-stop\-daemon
+sends it the signal specified by
+.BR --signal ,
+and exits with error status 0.
+If such a process does not exist,
+.B start\-stop\-daemon
+exits with error status 1
+(0 if
+.BR --oknodo
+is specified).
+
+.SH OPTIONS
+
+.TP
+\fB-x\fP|\fB--exec\fP \fIexecutable\fP
+Check for processes that are instances of this executable (according to
+.B /proc/
+.I pid
+.B /exe
+).
+.TP
+\fB-p\fP|\fB--pidfile\fP \fIpid-file\fP
+Check for processes whose process-id is specified in
+.I pid-file.
+.TP
+\fB-u\fP|\fB--user\fP \fIusername\fP|\fIuid\fP
+Check for processes owned by the user specified by
+.I username
+or
+.I uid.
+.TP
+\fB-n\fP|\fB--name\fP \fIprocess-name\fP
+Check for processes with the name
+.I process-name
+(according to
+.B /proc/
+.I pid
+.B /stat
+).
+.TP
+\fB-s\fP|\fB--signal\fP \fIsignal\fP
+With
+.BR --stop
+, specifies the signal to send to processes being stopped (default 15).
+.TP
+\fB-R\fP|\fB--retry\fP \fItimeout\fP|\fIschedule\fP
+With
+.BR --stop ,
+specifies that
+.B start-stop-daemon
+is to check whether the process(es)
+do finish. It will check repeatedly whether any matching processes
+are running, until none are. If the processes do not exit it will
+then take further action as determined by the schedule.
+
+If
+.I timeout
+is specified instead of
+.I schedule
+then the schedule
+.IB signal / timeout /KILL/ timeout
+is used, where
+.I signal
+is the signal specified with
+.BR --signal .
+
+.I schedule
+is a list of at least two items separated by slashes
+.RB ( / );
+each item may be
+.BI - signal-number
+or [\fB\-\fP]\fIsignal-name\fP,
+which means to send that signal,
+or
+.IR timeout ,
+which means to wait that many seconds for processes to
+exit,
+or
+.BR forever ,
+which means to repeat the rest of the schedule forever if
+necessary.
+
+If the end of the schedule is reached and
+.BR forever
+is not specified, then
+.B start-stop-daemon
+exits with error status 2.
+If a schedule is specified, then any signal specified
+with
+.B --signal
+is ignored.
+.TP
+\fB-a\fP|\fB--startas\fP \fIpathname\fP
+With
+.BR --start ,
+start the process specified by
+.IR pathname .
+If not specified, defaults to the argument given to
+.BR --exec .
+.TP
+.BR -t | --test
+Print actions that would be taken and set appropriate return value,
+but take no action.
+.TP
+.BR -o | --oknodo
+Return exit status 0 instead of 1 if no actions are (would be) taken.
+.TP
+.BR -q | --quiet
+Do not print informational messages; only display error messages.
+.TP
+\fB-c\fP|\fB--chuid\fP \fIusername\fR|\fIuid\fP
+Change to this username/uid before starting the process. You can also
+specify a group by appending a
+.BR : ,
+then the group or gid in the same way
+as you would for the `chown' command (\fIuser\fP\fB:\fP\fIgroup\fP).
+When using this option
+you must realize that the primary and supplemental groups are set as well,
+even if the
+.B --group
+option is not specified. The
+.B --group
+option is only for
+groups that the user isn't normally a member of (like adding per/process
+group membership for generic users like
+.BR nobody ).
+.TP
+\fB-r\fP|\fB--chroot\fP \fIroot\fP
+Chdir and chroot to
+.I root
+before starting the process. Please note that the pidfile is also written
+after the chroot.
+.TP
+.BR -b | --background
+Typically used with programs that don't detach on their own. This option
+will force
+.B start-stop-daemon
+to fork before starting the process, and force it into the background.
+.B WARNING: start-stop-daemon
+cannot check the exit status if the process fails to execute for
+.B any
+reason. This is a last resort, and is only meant for programs that either
+make no sense forking on their own, or where it's not feasible to add the
+code for it to do this itself.
+.TP
+.BR -N | --nicelevel
+This alters the prority of the process before starting it.
+.TP
+.BR -m | --make-pidfile
+Used when starting a program that does not create its own pid file. This
+option will make
+.B start-stop-daemon
+create the file referenced with
+.B --pidfile
+and place the pid into it just before executing the process. Note, it will
+not be removed when stopping the program.
+.B NOTE:
+This feature may not work in all cases. Most notably when the program
+being executed forks from its main process. Because of this it is usually
+only useful when combined with the
+.B --background
+option.
+.TP
+.BR -v | --verbose
+Print verbose informational messages.
+.TP
+.BR -H | --help
+Print help information; then exit.
+.TP
+.BR -V | --version
+Print version information; then exit.
+
+.SH AUTHORS
+Marek Michalkiewicz <marekm@i17linuxb.ists.pwr.wroc.pl> based on
+a previous version by Ian Jackson <ian@chiark.greenend.org.uk>.
+
+Manual page by Klee Dienes <klee@mit.edu>, partially reformatted
+by Ian Jackson.
diff --git a/rc-lists/boot b/rc-lists/boot
new file mode 100644
index 0000000..069346d
--- /dev/null
+++ b/rc-lists/boot
@@ -0,0 +1,14 @@
+bootmisc
+checkroot
+consolefont
+keymaps
+modules
+rmnologin
+urandom
+checkfs
+clock
+domainname
+hostname
+localmount
+net.lo
+serial
diff --git a/rc-lists/default b/rc-lists/default
new file mode 100644
index 0000000..d6763ae
--- /dev/null
+++ b/rc-lists/default
@@ -0,0 +1,3 @@
+hdparm
+local
+netmount
diff --git a/rc-lists/nonetwork b/rc-lists/nonetwork
new file mode 100644
index 0000000..4083037
--- /dev/null
+++ b/rc-lists/nonetwork
@@ -0,0 +1 @@
+local
diff --git a/rc-lists/single b/rc-lists/single
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/rc-lists/single
diff --git a/sbin/MAKEDEV b/sbin/MAKEDEV
new file mode 100755
index 0000000..8b720d7
--- /dev/null
+++ b/sbin/MAKEDEV
@@ -0,0 +1,1894 @@
+#! /bin/sh -
+
+RCSID='$Id: MAKEDEV 560 2004-09-19 05:39:28Z vapier $'
+
+#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#
+# Customisation:
+# The devices fall into various classes. This section contains the mapping
+# from a class name into a group name and permission.
+# You will almost certainly need to edit the group name to match your
+# system, and you may change the permissions to suit your preference. These
+# lines _must_ be of the format "user group perm".
+
+ public=" root root 0666"
+private=" root root 0600"
+ system=" root root 0660"
+ kmem=" root kmem 0640"
+ tty=" root tty 0660" # Perms was 0666
+ cons=" root tty 0600"
+ vcs=" root root 0600"
+dialout=" root dialout 0660"
+ dip=" root dip 0660"
+ mouse=" root root 0660"
+printer=" root lp 0660"
+ floppy=" root floppy 0660"
+ disk=" root disk 0660"
+ scsi=" root root 0600"
+ cdrom=" root cdrom 0660"
+ tape=" root tape 0660"
+ audio=" root audio 0660"
+ video=" root video 0660"
+ fb=" root video 0620"
+ ibcs2=" root root 0660" # Perms was 0666
+scanner=" root root 0660" # Perms was 0666
+ coda=" root root 0600"
+ ipsec=" root root 0200"
+readable=" root root 0444"
+
+MAXVT=63
+
+# defaults for $major_*
+major_ide0=3
+major_ide1=22
+major_sd=8
+major_lp=6
+
+# Remark: OSS/Linux becomes major_OSSLinux
+
+#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#
+
+# don't stomp on devfs users
+if [ -c .devfsd ]
+then
+ echo ".devfsd presence implies active DevFS. Aborting MAKEDEV invocation."
+ # use exit 0, not 1, so postinst scripts don't fail on this
+ exit 0
+fi
+
+
+# make sure we are not in /
+if [ "`pwd`" = "/" ]; then
+ echo "Running MAKEDEV in your root filesystem is a VERY BAD IDEA."
+ exit 0
+fi
+
+#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#
+
+procfs=/proc
+
+opt_v=
+opt_d=
+opt_n=
+
+while [ $# -ge 1 ]
+do
+ case $1 in
+ --) shift; break ;;
+ -v) shift; opt_v=1 ;;
+ -d) shift; opt_d=1 ;;
+ -n) shift; opt_n=1; opt_v=1 ;;
+ -V) shift; opt_V=1 ;;
+ -*) echo "$0: unknown flag \"$1\"" >&2; exit 1 ;;
+ *) break ;;
+ esac
+done
+
+if [ "$opt_V" ]
+then
+ echo "$RCSID"
+ exit 0
+fi
+
+opts="${opt_n:+-n} ${opt_v:+-v} ${opt_d:+-d}"
+
+#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#
+
+makedev () { # usage: makedev name [bcu] major minor owner group mode
+ if [ "$opt_v" ]
+ then if [ "$opt_d" ]
+ then echo "delete $1"
+ else echo "create $1 $2 $3 $4 $5:$6 $7"
+ fi
+ fi
+ if [ ! "$opt_n" ]
+ then if [ "$opt_d" ]
+ then
+ rm -f $1
+ else
+ rm -f $1-
+ mknod $1- $2 $3 $4 &&
+ chown $5:$6 $1- &&
+ chmod $7 $1- &&
+ mv $1- $1
+ fi
+ fi
+}
+symlink () { # usage: symlink name target
+ if [ "$opt_v" ]
+ then if [ "$opt_d" ]
+ then echo "delete $1"
+ else echo "create $1 -> $2"
+ fi
+ fi
+ [ ! "$opt_n" ] && rm -f $1 &&
+ [ ! "$opt_d" ] && ln -s $2 $1
+}
+
+#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#
+
+# Debian allows us to assume /bin/sh is a POSIX compliant shell, so go for it!
+
+math () {
+ eval echo "\$(($*))"
+}
+index () { # index string c
+ eval "I=\${1%$2*}"
+ eval echo "\${#I}"
+}
+suffix () {
+ eval echo "\${1#$2}"
+}
+strip () {
+ eval echo "\${1% $2 *} \${1#* $2 }"
+}
+first () {
+ eval echo "\${1:0:1}"
+}
+second () {
+ eval echo "\${1:1:1}"
+}
+substr () {
+ echo $1 | cut -c $2
+}
+
+#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#
+
+devices=
+if [ ! -f $procfs/devices ]
+then
+ echo "$0: warning: can't read $procfs/devices" >&2
+else
+ exec 3<$procfs/devices
+ while read major device <&3
+ do
+ device=`echo $device | sed 's#/.*##'`
+ case "$major" in
+ Character|Block|'')
+ ;;
+ *)
+ eval "major_${device/-/_}=$major"
+ devices="$devices $device"
+ ;;
+ esac
+ done
+ exec 3<&-
+fi
+
+Major () {
+ device=$2
+ if [ "$opt_d" ]
+ then
+ echo -1 # don't care
+ else
+ eval echo \${major_${1/-/_}:-\${device:?\"unknown major number for $1\"}}
+ fi
+}
+
+cvt () {
+ while [ $# -ne 0 ]
+ do
+ case "$1" in
+ mem|tty|ttyp|cua|cub|cui) ;;
+ hd) (for d in a b c d e f g h ; do
+ echo -n hd$d " "
+ done) ; echo
+ ;;
+ ide0) echo hda hdb ;;
+ ide1) echo hdc hdd ;;
+ ide2) echo hde hdf ;;
+ ide3) echo hdg hdh ;;
+ ide4) echo hdi hdj ;;
+ ide5) echo hdk hdl ;;
+ sd) echo sda sdb sdc sdd ;;
+ dasd) (for d in a b c d e f g h i j k l m \
+ n o p q r s t u v w x y z ; do
+ echo -n dasd$d " "
+ done) ; echo
+ ;;
+ raw) echo raw ;;
+ sg) echo sg ;;
+ sr) echo scd ;;
+ st) echo st0 ;;
+ xd) echo xda xdb ;;
+ ad) echo ada adb ;;
+ fd) echo fd0 fd1 ;;
+ lp) echo lp ;;
+ mt) echo ftape ;;
+ qft) echo ftape ;;
+ loop) echo loop ;;
+ md) echo md ;;
+ ibcs2) echo ibcs2 ;;
+ tpqic02) echo qic ;;
+ sound) echo audio ;;
+ logiscan) echo logiscan ;;
+ ac4096) echo ac4096 ;;
+ hw) echo helloworld ;;
+ sbpcd | sbpcd[123]) echo $1 ;;
+ joystick) echo js ;;
+ input) echo input ;;
+ apm_bios) echo apm ;;
+ dcf) echo dcf ;;
+ aztcd) echo aztcd ;;
+ cm206cd) echo cm206cd ;;
+ gscd) echo gscd ;;
+ pcmcia) ;; # taken care of by its own driver
+ ttyC) echo cyclades ;;
+ isdn) echo isdnmodem isdnbri dcbri ;;
+ vcs) ;;
+ pty) echo pty ;;
+ misc) echo misc ;;
+ 3dfx) echo 3dfx ;;
+ agpgart) echo agpgart ;;
+ microcode) echo microcode ;;
+ ipmi|ipmikcs) echo ipmi ;;
+ fb) echo fb ;;
+ nb) echo nb0 nb1 ;;
+ netlink) echo netlink ;;
+ tap) echo netlink ;;
+ hamradio) echo hamradio ;;
+ snd) ;;
+ ptm) ;;
+ pts) ;;
+ ttyS) echo ttyS0 ttyS1 ttyS2 ttyS3 ;;
+ ttyI) echo ttyI0 ttyI1 ttyI2 ttyI3 ;;
+ ircomm|irlpt) echo irda ;;
+ ppp) echo ppp ;;
+ usb) echo usb ;;
+ lvm) ;; # taken care of by LVM userspace tools
+ ramdisk) echo ram ;;
+ *) echo "$0: don't know what \"$1\" is" >&2 ;;
+ esac
+ shift
+ done
+}
+
+for arg
+do
+# case `cvt $arg` in
+ case $arg in
+ generic)
+ if [ -n "`which dpkg 2> /dev/null`" ]
+ then
+ # pick the right generic-<arch> using dpkg's knowledge
+ case `dpkg --print-installation-architecture` in
+ alpha)
+ $0 $opts generic-alpha
+ ;;
+ arm)
+ $0 $opts generic-arm
+ ;;
+ hppa)
+ $0 $opts generic-hppa
+ ;;
+ i386)
+ $0 $opts generic-i386
+ ;;
+ ia64)
+ $0 $opts generic-ia64
+ ;;
+ m68k)
+ $0 $opts generic-m68k
+ ;;
+ mips)
+ $0 $opts generic-mips
+ ;;
+ mipsel)
+ $0 $opts generic-mipsel
+ ;;
+ powerpc)
+ $0 $opts generic-powerpc
+ ;;
+ s390)
+ $0 $opts generic-s390
+ ;;
+ sparc)
+ $0 $opts generic-sparc
+ ;;
+ *)
+ echo "$0: no support for generic on this arch" >&2
+ exit 1
+ ;;
+ esac
+ else
+ $0 $opts std
+ $0 $opts fd
+ $0 $opts fd0 fd1
+ $0 $opts hda hdb
+ $0 $opts xda xdb
+ $0 $opts sda sdb
+ $0 $opts pty
+ $0 $opts console
+ $0 $opts ttyS0 ttyS1 ttyS2 ttyS3
+ $0 $opts busmice
+ $0 $opts lp
+ $0 $opts par
+ fi
+ ;;
+ generic-alpha)
+ export MDARCH="alpha"
+ $0 $opts std
+ $0 $opts fd
+ $0 $opts fd0 fd1
+ $0 $opts hda hdb hdc hdd
+ $0 $opts xda xdb
+ $0 $opts sda sdb sdc sdd
+ $0 $opts scd0 scd1
+ $0 $opts st0 st1
+ $0 $opts sg
+ $0 $opts pty
+ $0 $opts console
+ $0 $opts ttyS0 ttyS1 ttyS2 ttyS3
+ $0 $opts busmice
+ $0 $opts lp
+ $0 $opts par
+ $0 $opts audio
+ $0 $opts fb
+ ;;
+ generic-arm)
+ export MDARCH="arm"
+ $0 $opts std
+ $0 $opts fd
+ $0 $opts fd0 fd1
+ $0 $opts hda hdb hdc hdd
+ $0 $opts xda xdb
+ $0 $opts sda sdb sdc sdd
+ $0 $opts scd0 scd1
+ $0 $opts st0 st1
+ $0 $opts sg
+ $0 $opts pty
+ $0 $opts console
+ $0 $opts ttyS0 ttyS1 ttyS2 ttyS3
+ $0 $opts busmice
+ $0 $opts lp
+ $0 $opts par
+ $0 $opts audio
+ $0 $opts fb
+ ;;
+ generic-hppa)
+ export MDARCH="hppa"
+ $0 $opts std
+ $0 $opts fd
+ $0 $opts fd0 fd1
+ $0 $opts sda sdb sdc sdd
+ $0 $opts scd0 scd1
+ $0 $opts st0 st1
+ $0 $opts sg
+ $0 $opts pty
+ $0 $opts console
+ $0 $opts ttyS0 ttyS1 ttyS2 ttyS3
+ $0 $opts busmice
+ $0 $opts lp
+ $0 $opts par
+ $0 $opts audio
+ $0 $opts fb
+ $0 $opts rtc
+ ;;
+ generic-i386)
+ export MDARCH="i386"
+ $0 $opts std
+ $0 $opts fd
+ $0 $opts fd0 fd1
+ $0 $opts hda hdb hdc hdd
+ $0 $opts xda xdb
+ $0 $opts sda sdb sdc sdd
+ $0 $opts scd0 scd1
+ $0 $opts st0 st1
+ $0 $opts sg
+ $0 $opts pty
+ $0 $opts console
+ $0 $opts ttyS0 ttyS1 ttyS2 ttyS3
+ $0 $opts busmice
+ $0 $opts lp
+ $0 $opts par
+ $0 $opts audio
+ $0 $opts fb
+ $0 $opts isdn-io eda edb sonycd mcd mcdx cdu535
+ $0 $opts optcd sjcd cm206cd gscd
+ $0 $opts lmscd sbpcd aztcd bpcd dac960 ida ataraid cciss
+ ;;
+ generic-ia64)
+ export MDARCH="ia64"
+ $0 $opts std
+ $0 $opts fd
+ $0 $opts fd0 fd1
+ $0 $opts hda hdb hdc hdd
+ $0 $opts xda xdb
+ $0 $opts sda sdb sdc sdd
+ $0 $opts scd0 scd1
+ $0 $opts st0 st1
+ $0 $opts sg
+ $0 $opts pty
+ $0 $opts console
+ $0 $opts ttyS0 ttyS1 ttyS2 ttyS3 ttyS4 ttyS5
+ $0 $opts busmice
+ $0 $opts lp
+ $0 $opts par
+ $0 $opts audio
+ $0 $opts fb
+ $0 $opts efirtc
+ ;;
+ generic-m68k)
+ export MDARCH="m68k"
+ $0 $opts std
+ $0 $opts fd
+ $0 $opts fd0 fd1
+ $0 $opts hda hdb hdc hdd
+ $0 $opts sda sdb sdc sdd
+ $0 $opts sg
+ $0 $opts ada adb adc add ade adf
+ $0 $opts pty
+ $0 $opts console
+ $0 $opts ttyS0 ttyS1 ttyS2 ttyS3 ttyS5
+ $0 $opts m68k-mice
+ $0 $opts lp
+ $0 $opts par
+ $0 $opts nvram
+ $0 $opts audio
+ $0 $opts fb
+ ;;
+ generic-mips)
+ export MDARCH="mips"
+ $0 $opts std
+ $0 $opts fd
+ $0 $opts fd0 fd1
+ $0 $opts hda hdb
+ $0 $opts sda sdb sdc sdd
+ $0 $opts scd0 scd1
+ $0 $opts st0 st1
+ $0 $opts sg
+ $0 $opts pty
+ $0 $opts console
+ $0 $opts ttyS0 ttyS1 ttyS2 ttyS3
+ $0 $opts lp
+ $0 $opts par
+ $0 $opts audio
+ $0 $opts fb
+ $0 $opts busmice
+ ;;
+ generic-mipsel)
+ export MDARCH="mipsel"
+ $0 $opts std
+ $0 $opts fd
+ $0 $opts fd0 fd1
+ $0 $opts hda hdb
+ $0 $opts sda sdb sdc sdd
+ $0 $opts scd0 scd1
+ $0 $opts st0 st1
+ $0 $opts sg
+ $0 $opts pty
+ $0 $opts console
+ $0 $opts ttyS0 ttyS1 ttyS2 ttyS3
+ $0 $opts lp
+ $0 $opts par
+ $0 $opts audio
+ $0 $opts fb
+ $0 $opts rtc
+ ;;
+ generic-powerpc)
+ export MDARCH="powerpc"
+ $0 $opts std
+ $0 $opts fd
+ $0 $opts fd0 fd1
+ $0 $opts hda hdb hdc hdd
+ $0 $opts sda sdb sdc sdd
+ $0 $opts scd0 scd1
+ $0 $opts st0 st1
+ $0 $opts sg
+ $0 $opts pty
+ $0 $opts console
+ $0 $opts ttyS0 ttyS1 ttyS2 ttyS3
+ $0 $opts busmice
+ $0 $opts m68k-mice
+ $0 $opts input
+ $0 $opts lp
+ $0 $opts par
+ $0 $opts nvram
+ $0 $opts audio
+ $0 $opts adb
+ $0 $opts fb
+ $0 $opts rtc
+ $0 $opts isdn-io
+ ;;
+ generic-s390)
+ export MDARCH="s390"
+ $0 $opts std
+ $0 $opts fd
+ $0 $opts dasda dasdb dasdc dasdd dasde dasdf dasdg dasdh \
+ dasdi dasdj dasdk dasdl dasdm dasdn dasdo dasdp \
+ dasdq dasdr dasds dasdt dasdu dasdv dasdw dasdx \
+ dasdy dasdz
+ $0 $opts pty
+ $0 $opts consoleonly
+ $0 $opts rtc
+ ;;
+ generic-sparc)
+ export MDARCH="sparc"
+ $0 $opts std
+ $0 $opts fd0-bare fd1-bare
+ $0 $opts hda hdb hdc hdd
+ $0 $opts sda sdb sdc sdd
+ $0 $opts scd0 scd1
+ $0 $opts st0 st1
+ $0 $opts sg
+ $0 $opts pty
+ $0 $opts console
+ $0 $opts ttyS0 ttyS1 ttyS2 ttyS3
+ $0 $opts busmice
+ $0 $opts fb
+ $0 $opts rtc
+ makedev kbd c 11 0 $cons
+ makedev sunmouse c 10 6 $mouse
+ symlink mouse sunmouse
+ makedev openprom c 10 139 $mouse
+ ;;
+ local)
+ $0.local $opts
+ ;;
+ std)
+ makedev mem c 1 1 $kmem
+ makedev kmem c 1 2 $kmem
+ makedev null c 1 3 $public
+ makedev port c 1 4 $kmem
+ makedev zero c 1 5 $public
+ symlink core $procfs/kcore
+ makedev full c 1 7 $public
+ makedev random c 1 8 $public
+ makedev urandom c 1 9 $readable
+ makedev tty c 5 0 $tty
+ $0 $opts ram
+ $0 $opts loop
+ ;;
+ hamradio)
+ $0 $opts scc
+ $0 $opts bc
+ ;;
+ scc)
+ for unit in 0 1 2 3 4 5 6 7
+ do
+ makedev scc$unit c 34 $unit $system
+ done
+ ;;
+ bc)
+ for unit in 0 1 2 3
+ do
+ makedev bc$unit c 51 $unit $system
+ done
+ ;;
+ random)
+ makedev random c 1 8 $public
+ ;;
+ urandom)
+ makedev urandom c 1 9 $readable
+ ;;
+ ram)
+ for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ; do
+ makedev ram$i b 1 $i $disk
+ done
+ symlink ram ram1
+ ;;
+ ram[0-9]|ram1[0-6])
+ unit=`suffix $arg ram`
+ makedev ram$unit b 1 $unit $disk
+ ;;
+ initrd)
+ makedev initrd b 1 250 $disk
+ ;;
+ raw)
+ makedev raw c 162 0 $disk
+ symlink rawctl raw
+ for i in 1 2 3 4 5 6 7 8; do
+ makedev raw$i c 162 $i $disk
+ done
+ ;;
+ consoleonly)
+ makedev tty0 c 4 0 $cons
+ # new kernels need a device, old ones a symlink... sigh
+ kern_rev1=`uname -r | awk -F'.' '{print $1}'`
+ kern_rev2=`uname -r | awk -F'.' '{print $2}'`
+ if [ $kern_rev1 -gt 2 ]
+ then
+ makedev console c 5 1 $cons
+ else
+ if [ $kern_rev1 -eq 2 -a $kern_rev2 -ge 1 ]
+ then
+ makedev console c 5 1 $cons
+ else
+ symlink console tty0
+ fi
+ fi
+ ;;
+ console)
+ $0 $opts consoleonly
+ major=`Major vcs 7` # not fatal
+ [ "$major" ] && makedev vcs0 c $major 0 $vcs
+ symlink vcs vcs0
+ [ "$major" ] && makedev vcsa0 c $major 128 $vcs
+ symlink vcsa vcsa0
+ # individual vts
+ line=1
+ while [ $line -le $MAXVT -a $line -le 63 ]
+ do
+ makedev tty$line c 4 $line $tty
+ [ "$major" ] && makedev vcs$line c $major $line $vcs
+ [ "$major" ] && makedev vcsa$line c $major `math $line + 128` $vcs
+ line=`math $line + 1`
+ done
+ ;;
+ adb)
+ myarch=
+
+ if [ -n "`which dpkg 2> /dev/null`" ]
+ then
+ # pick the right arch device using dpkg's knowledge
+ myarch="`dpkg --print-installation-architecture`"
+
+ elif [ -n "${MDARCH}" ]
+ then
+ myarch="${MDARCH}"
+ fi
+
+ case $myarch in
+ powerpc)
+ # ADB bus devices (char)
+ makedev adb c 56 0 $mouse
+ makedev adbmouse c 10 10 $mouse
+ ;;
+ m68k)
+ # ACSI disk 2, whole device (block)
+ makedev adb b 28 16 $disk
+ for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
+ do
+ minor=$(( 16 + $part ))
+ makedev adb$part b 28 $minor $disk
+ done
+ ;;
+ *)
+ echo "no support for adb on this arch" >&2
+ exit 1
+ ;;
+ esac
+ ;;
+ raw1394)
+ makedev raw1394 c 171 0 $disk
+ ;;
+ nvram)
+ makedev nvram c 10 144 $mouse
+ ;;
+ tty[1-9]|tty[1-5][0-9]|tty[6][0-3])
+ line=`suffix $arg tty`
+ makedev tty$line c 4 $line $tty
+ ;;
+ ttyS[0-9]|ttyS[1-5][0-9]|ttyS[6][0-3])
+ line=`suffix $arg ttyS`
+ minor=`math 64 + $line`
+ makedev ttyS$line c 4 $minor $dialout
+ ;;
+ pty[a-ep-z])
+ bank=`suffix $arg pty`
+ base=`index pqrstuvwxyzabcde $bank`
+ base=`math $base \* 16`
+ for i in 0 1 2 3 4 5 6 7 8 9 a b c d e f
+ do
+ j=`index 0123456789abcdef $i`
+ makedev pty$bank$i c 2 `math $base + $j` $tty
+ makedev tty$bank$i c 3 `math $base + $j` $tty
+ done
+ ;;
+ pty)
+ ptysufs=""
+ for i in p q r s t u v w x y z a b c d e
+ do
+ ptysufs="$ptysufs pty$i"
+ done
+ $0 $opts $ptysufs ptmx
+ ;;
+ ptmx)
+ # master pty multiplexer for 2.1 kernels
+ makedev ptmx c 5 2 $tty
+ ;;
+ cyclades|ttyC)
+ major1=`Major ttyC 19` || continue
+ #major2=`Major cub 20` || continue
+ for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 \
+ 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
+ do
+ makedev ttyC$i c $major1 $i $dialout
+ #makedev cub$i c $major2 $i $dialout
+ done
+ ;;
+ stallion|ttyE)
+ major1=`Major ttyE 24` || continue
+ #major2=`Major cue 25` || continue
+ majorc=28
+ minor=0
+ until [ $minor -gt 256 ]
+ do
+ makedev ttyE$minor c $major1 $minor $dialout
+ #makedev cue$minor c $major2 $minor $dialout
+ minor=`math $minor + 1`
+ done
+ for i in 0 1 2 3
+ do
+ makedev staliomem$i c $majorc $i $private
+ done
+ ;;
+ chase|ttyH)
+ major1=`Major ttyH 17` || continue
+ #major2=`Major cuh 18` || continue
+ minor=0
+ until [ $minor -gt 16 ] # tell me if 16 is wrong
+ do
+ makedev ttyH$minor c $major1 $minor $dialout
+ #makedev cuh$minor c $major2 $minor $dialout
+ minor=`math $minor + 1`
+ done
+ ;;
+ rocketport|ttyR)
+ major1=`Major ttyR 46` || continue
+ #major2=`Major cur 47` || continue
+ minor=0
+ until [ $minor -gt 64 ] # tell me if 64 is wrong
+ do
+ makedev ttyR$minor c $major1 $minor $dialout
+ #makedev cur$minor c $major2 $minor $dialout
+ minor=`math $minor + 1`
+ done
+ ;;
+ ttyV)
+ major1=`Major ttyV 105` || continue
+ #major2=`Major cuv 106` || continue
+ minor=0
+ until [ $minor -gt 16 ] # tell me if 16 is wrong
+ do
+ makedev ttyV$minor c $major1 $minor $dialout
+ #makedev cuv$minor c $major2 $minor $dialout
+ minor=`math $minor + 1`
+ done
+ ;;
+ digi|ttyD)
+ major1=`Major ttyD 22` || continue
+ #major2=`Major cud 23` || continue
+ minor=0
+ until [ $minor -gt 16 ] # tell me if 16 is wrong
+ do
+ makedev ttyD$minor c $major1 $minor $dialout
+ #makedev cud$minor c $major2 $minor $dialout
+ minor=`math $minor + 1`
+ done
+ ;;
+ specialix|ttyX)
+ major1=`Major ttyX 32` || continue
+ #major2=`Major cux 33` || continue
+ minor=0
+ until [ $minor -gt 16 ] # tell me if 16 is wrong
+ do
+ makedev ttyX$minor c $major1 $minor $dialout
+ #makedev cux$minor c $major2 $minor $dialout
+ minor=`math $minor + 1`
+ done
+ ;;
+ specialixIO8|ttyW)
+ major1=`Major ttyW 75` || continue
+ #major2=`Major cuw 76` || continue
+ minor=0
+ until [ $minor -gt 16 ] # tell me if 16 is wrong
+ do
+ makedev ttyW$minor c $major1 $minor $dialout
+ #makedev cuw$minor c $major2 $minor $dialout
+ minor=`math $minor + 1`
+ done
+ ;;
+ PAM|ttyM)
+ major1=`Major ttyM 79` || continue
+ #major2=`Major cum 80` || continue
+ minor=0
+ until [ $minor -gt 16 ] # tell me if 16 is wrong
+ do
+ makedev ttyM$minor c $major1 $minor $dialout
+ #makedev cum$minor c $major2 $minor $dialout
+ minor=`math $minor + 1`
+ done
+ ;;
+ riscom|ttyL)
+ major=`Major ttyL 48` || continue
+ minor=0
+ until [ $minor -gt 16 ] # tell me if 16 is wrong
+ do
+ makedev ttyL$minor c $major $minor $dialout
+ minor=`math $minor + 1`
+ done
+ ;;
+ computone|ttyF)
+ major=`Major ttyF 71` || continue
+ #major2=`Major cuf 72` || continue
+ minor=0
+ until [ $minor -gt 255 ]
+ do
+ makedev ttyF$minor c $major $minor $dialout
+ #makedev cuf$minor c $major2 $minor $dialout
+ minor=`math $minor + 1`
+ done
+ major=73
+ for i in 0 4 8 12
+ do
+ makedev ip2ipl$i c $major $i $private
+ makedev ip2stat$i c $major `math $i + 1` $private
+ done
+ ;;
+ ESP|ttyP)
+ major=`Major ttyP 57` || continue
+ #major2=`Major cup 58` || continue
+ minor=0
+ until [ $minor -gt 4 ] # tell me if 4 is wrong
+ do
+ makedev ttyP$minor c $major $minor $dialout
+ #makedev cup$minor c $major2 $minor $dialout
+ minor=`math $minor + 1`
+ done
+ ;;
+ COMX|comx)
+ major=`Major comx 88` || continue
+ minor=0
+ until [ $minor -gt 4 ] # tell me if 4 is wrong
+ do
+ makedev comx$minor c $major $minor $private
+ minor=`math $minor + 1`
+ done
+ ;;
+ isdnmodem|ttyI)
+ major1=`Major ttyI 43` || continue
+ #major2=`Major cui 44` || continue
+ minor=0
+ until [ $minor -gt 63 ]
+ do
+ makedev ttyI$minor c $major1 $minor $dialout
+ #makedev cui$minor c $major2 $minor $dialout
+ minor=`math $minor + 1`
+ done
+ ;;
+ isdnbri)
+ major=45
+ minor=0
+ until [ $minor -gt 63 ]
+ do
+ makedev isdn$minor c $major $minor $dialout
+ makedev isdnctrl$minor c $major `math $minor + 64` $dialout
+ makedev ippp$minor c $major `math $minor + 128` $dialout
+ minor=`math $minor + 1`
+ done
+ makedev isdninfo c $major 255 $private
+ ;;
+ dcbri)
+ major=52
+ for i in 0 1 2 3
+ do
+ makedev dcbri$i c $major $i $dialout
+ done
+ ;;
+ capi)
+ major=68
+ makedev capi20 c $major 0 $dialout
+ for i in 0 1 2 3 4 5 6 7 8 9
+ do
+ makedev capi20.0$i c $major `math $i + 1` $dialout
+ done
+ for i in 10 11 12 13 14 15 16 17 18 19
+ do
+ makedev capi20.$i c $major `math $i + 1` $dialout
+ done
+ ;;
+ ubd)
+ major=98
+ minor=0
+ until [ $minor -gt 255 ]
+ do
+ makedev ubd$minor b $major $minor $disk
+ minor=`math $minor + 1`
+ done
+ ;;
+ fb)
+ for i in 0 1 2 3 4 5 6 7
+ do
+ makedev fb$i c 29 `math 32 \* $i` $fb
+ makedev fb${i}current c 29 `math 32 \* $i` $fb
+ makedev fb${i}autodetect c 29 `math 32 \* $i + 1` $fb
+ done
+ ;;
+ fb[0-7])
+ dev=`suffix $arg fb`
+ base=`math 32 \* $dev`
+ makedev fb$dev c 29 $base $fb
+ makedev fb${dev}current c 29 $base $fb
+ makedev fb${dev}autodetect c 29 `math $base + 1` $fb
+ for i in 0 1 2 3 4 5 6 7
+ do
+ makedev fb${dev}user$i c 29 `math $base + 24 + $i` $fb
+ done
+ ;;
+ netlink|tap|tap[0-9]|tap1[0-5])
+ makedev route c 36 0 $coda
+ makedev skip c 36 1 $coda
+ makedev fwmonitor c 36 3 $coda
+ for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
+ do
+ makedev tap$i c 36 `math $i + 16` $coda
+ done
+ ;;
+ lp)
+ major=`Major lp 6` || continue
+ makedev ${arg}0 c $major 0 $printer
+ makedev ${arg}1 c $major 1 $printer
+ makedev ${arg}2 c $major 2 $printer
+ ;;
+ par)
+ major=`Major lp 6` || continue
+ makedev ${arg}0 c $major 0 $printer
+ makedev ${arg}1 c $major 1 $printer
+ makedev ${arg}2 c $major 2 $printer
+ ;;
+ parport)
+ major=`Major parport 99` || continue
+ makedev ${arg}0 c $major 0 $printer
+ makedev ${arg}1 c $major 1 $printer
+ makedev ${arg}2 c $major 2 $printer
+ ;;
+ slm)
+ major=`Major slm 28` || continue
+ for i in 0 1 2 3
+ do
+ makedev slm c $major $i $printer
+ done
+ ;;
+ input)
+ major=`Major pcsp 13` || continue
+ mkdir -p input
+ for i in 0 1 2 3
+ do
+ makedev input/js$i c $major $i $mouse
+ makedev input/mouse$i c $major `math $i + 32` $mouse
+ makedev input/event$i c $major `math $i + 64` $mouse
+ done
+ makedev input/mice c $major 63 $mouse
+ ;;
+ busmice)
+ major=`Major mouse 10` || continue
+ makedev logibm c $major 0 $mouse
+ makedev psaux c $major 1 $mouse
+ makedev inportbm c $major 2 $mouse
+ makedev atibm c $major 3 $mouse
+ makedev jbm c $major 4 $mouse
+ ;;
+ m68k-mice)
+ major=`Major mouse 10` || continue
+ makedev amigamouse c $major 4 $mouse
+ makedev atarimouse c $major 5 $mouse
+ makedev amigamouse1 c $major 7 $mouse
+ makedev adbmouse c $major 10 $mouse
+ ;;
+ 3dfx)
+ major=`Major $arg 107` || continue
+ makedev $arg c $major 0 $video
+ ;;
+ agpgart)
+ major=`Major $arg 10` || continue
+ makedev $arg c $major 175 $video
+ ;;
+ intel_rng)
+ major=`Major $arg 10` || continue
+ makedev $arg c $major 183 $private
+ ;;
+ cpu|microcode)
+ mkdir -p cpu
+ makedev cpu/microcode c 10 184 $private
+ for i in 0 1 2 3
+ do
+ mkdir -p cpu/$i
+ makedev cpu/$i/msr c 202 $i $private
+ makedev cpu/$i/cpuid c 203 $i $private
+ done
+ ;;
+ ipmi|ipmikcs)
+ major=`Major ipmikcs 10` || continue
+ makedev ipmikcs c $major 173 $private
+ ;;
+ irda)
+ for i in 0 1
+ do
+ makedev ircomm$i c 161 $i $dialout
+ makedev irlpt$i c 161 `math $i + 16` $printer
+ done
+ ;;
+ misc)
+ major=`Major mouse 10` || continue
+ makedev logibm c $major 0 $mouse
+ makedev psaux c $major 1 $mouse
+ makedev inportbm c $major 2 $mouse
+ makedev atibm c $major 3 $mouse
+ makedev jbm c $major 4 $mouse
+ makedev amigamouse c $major 4 $mouse
+ makedev atarimouse c $major 5 $mouse
+ makedev sunmouse c $major 6 $mouse
+ makedev amigamouse1 c $major 7 $mouse
+ makedev smouse c $major 8 $mouse
+ makedev pc110pad c $major 9 $mouse
+ makedev adbmouse c $major 10 $mouse
+ makedev beep c $major 128 $mouse
+ makedev modreq c $major 129 $mouse
+ makedev watchdog c $major 130 $mouse
+ makedev temperature c $major 131 $mouse
+ makedev hwtrap c $major 132 $mouse
+ makedev exttrp c $major 133 $mouse
+ makedev apm_bios c $major 134 $mouse
+ makedev rtc c $major 135 $mouse
+ makedev openprom c $major 139 $mouse
+ makedev relay8 c $major 140 $mouse
+ makedev relay16 c $major 141 $mouse
+ makedev msr c $major 142 $mouse
+ makedev pciconf c $major 143 $mouse
+ makedev nvram c $major 144 $mouse
+ makedev hfmodem c $major 145 $mouse
+ makedev led c $major 151 $mouse
+ makedev mergemem c $major 153 $mouse
+ makedev pmu c $major 154 $mouse
+ ;;
+ smapi|thinkpad)
+ major=`Major mouse 10` || continue
+ makedev smapi c $major 170 $mouse
+ symlink thinkpad smapi
+ ;;
+ rtc)
+ major=`Major mouse 10` || continue
+ makedev rtc c $major 135 $mouse
+ ;;
+ efirtc)
+ major=`Major mouse 10` || continue
+ makedev efirtc c $major 136 $mouse
+ ;;
+ js)
+ major=`Major Joystick 13` || continue
+ for unit in 0 1 2 3
+ do
+ makedev js$unit c $major $unit $readable
+ makedev djs$unit c $major `math $unit + 128` $readable
+ done
+ ;;
+ fd[0-7]-bare)
+ sarg="${arg%-bare}"
+ major=`Major fd 2` || continue
+ base=`suffix $sarg fd`
+ if [ $base -ge 4 ]
+ then
+ base=`math $base + 124`
+ fi
+ makedev ${sarg} b $major $base $floppy
+ ;;
+ fd[0-7])
+ major=`Major fd 2` || continue
+ base=`suffix $arg fd`
+ if [ $base -ge 4 ]
+ then
+ base=`math $base + 124`
+ fi
+ makedev ${arg} b $major $base $floppy
+ makedev ${arg}d360 b $major `math $base + 4` $floppy
+ makedev ${arg}h1200 b $major `math $base + 8` $floppy
+ makedev ${arg}u360 b $major `math $base + 12` $floppy
+ makedev ${arg}u720 b $major `math $base + 16` $floppy
+ makedev ${arg}h360 b $major `math $base + 20` $floppy
+ makedev ${arg}h720 b $major `math $base + 24` $floppy
+ makedev ${arg}u1440 b $major `math $base + 28` $floppy
+ makedev ${arg}u2880 b $major `math $base + 32` $floppy
+ makedev ${arg}CompaQ b $major `math $base + 36` $floppy
+
+ makedev ${arg}h1440 b $major `math $base + 40` $floppy
+ makedev ${arg}u1680 b $major `math $base + 44` $floppy
+ makedev ${arg}h410 b $major `math $base + 48` $floppy
+ makedev ${arg}u820 b $major `math $base + 52` $floppy
+ makedev ${arg}h1476 b $major `math $base + 56` $floppy
+ makedev ${arg}u1722 b $major `math $base + 60` $floppy
+ makedev ${arg}h420 b $major `math $base + 64` $floppy
+ makedev ${arg}u830 b $major `math $base + 68` $floppy
+ makedev ${arg}h1494 b $major `math $base + 72` $floppy
+ makedev ${arg}u1743 b $major `math $base + 76` $floppy
+ makedev ${arg}h880 b $major `math $base + 80` $floppy
+ makedev ${arg}u1040 b $major `math $base + 84` $floppy
+ makedev ${arg}u1120 b $major `math $base + 88` $floppy
+ makedev ${arg}h1600 b $major `math $base + 92` $floppy
+ makedev ${arg}u1760 b $major `math $base + 96` $floppy
+ makedev ${arg}u1920 b $major `math $base + 100` $floppy
+ makedev ${arg}u3200 b $major `math $base + 104` $floppy
+ makedev ${arg}u3520 b $major `math $base + 108` $floppy
+ makedev ${arg}u3840 b $major `math $base + 112` $floppy
+ makedev ${arg}u1840 b $major `math $base + 116` $floppy
+ makedev ${arg}u800 b $major `math $base + 120` $floppy
+ makedev ${arg}u1600 b $major `math $base + 124` $floppy
+ ;;
+ ed[a-b])
+ major=`Major ed 36` || continue
+ unit=`suffix $arg ed`
+ base=`index ab $unit`
+ base=`math $base \* 64`
+ makedev ed$unit b $major $base $disk
+ for part in 1 2 3 4 5 6 7 8 # 9 10 11 12 13 14 15 16 17 18 19 20
+ do
+ makedev ed$unit$part b $major `math $base + $part` $disk
+ done
+ ;;
+ hd[a-b])
+ major=`Major ide0` || major=`Major hd 3` || continue
+ unit=`suffix $arg hd`
+ base=`index ab $unit`
+ base=`math $base \* 64`
+ makedev hd$unit b $major $base $disk
+ for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
+ do
+ makedev hd$unit$part b $major `math $base + $part` $disk
+ done
+ ;;
+ hd[c-d])
+ major=`Major ide1 22` || continue
+ unit=`suffix $arg hd`
+ base=`index cd $unit`
+ base=`math $base \* 64`
+ makedev hd$unit b $major $base $disk
+ for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
+ do
+ makedev hd$unit$part b $major $(( $base + $part )) $disk
+ done
+ ;;
+ hd[e-f])
+ major=`Major ide2 33` || continue
+ unit=`suffix $arg hd`
+ base=`index ef $unit`
+ base=`math $base \* 64`
+ makedev hd$unit b $major $base $disk
+ for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
+ do
+ makedev hd$unit$part b $major $(( $base + $part )) $disk
+ done
+ ;;
+ hd[g-h])
+ major=`Major ide3 34` || continue
+ unit=`suffix $arg hd`
+ base=`index gh $unit`
+ base=`math $base \* 64`
+ makedev hd$unit b $major $base $disk
+ for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
+ do
+ makedev hd$unit$part b $major $(( $base + $part )) $disk
+ done
+ ;;
+ hd[i-j])
+ major=`Major ide4 56` || continue
+ unit=`suffix $arg hd`
+ base=`index ij $unit`
+ base=`math $base \* 64`
+ makedev hd$unit b $major $base $disk
+ for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
+ do
+ makedev hd$unit$part b $major $(( $base + $part )) $disk
+ done
+ ;;
+ hd[k-l])
+ major=`Major ide5 57` || continue
+ unit=`suffix $arg hd`
+ base=`index kl $unit`
+ base=`math $base \* 64`
+ makedev hd$unit b $major $base $disk
+ for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
+ do
+ makedev hd$unit$part b $major $(( $base + $part )) $disk
+ done
+ ;;
+ ht0)
+ major=`Major ht0 37` || continue
+ # Only one IDE tape drive is currently supported; ht0.
+ makedev ht0 c $major 0 $tape
+ makedev nht0 c $major 128 $tape
+ ;;
+ pt)
+ major=`Major pt 96` || continue
+ for i in 0 1 2 3
+ do
+ makedev pt$i c $major $i $tape
+ makedev npt$i c $major `math $i + 128` $tape
+ done
+ ;;
+ xd[a-d])
+ major=`Major xd 13` || continue
+ unit=`suffix $arg xd`
+ base=`index abcd $unit`
+ base=`math $base \* 64`
+ makedev xd$unit b $major $base $disk
+ for part in 1 2 3 4 5 6 7 8 # 9 10 11 12 13 14 15 16 17 18 19 20
+ do
+ makedev xd$unit$part b $major $(( $base + $part )) $disk
+ done
+ ;;
+ sd[a-z])
+ major=`Major sd 8` || continue
+ unit=`suffix $arg sd`
+ base=`index abcdefghijklmnopqrstuvwxyz $unit`
+ base=$(( $base * 16 ))
+ if [ $base -lt 256 ]; then
+ major=8
+ else
+ major=65
+ base=$(( $base - 256 ))
+ fi
+ makedev sd$unit b $major $base $disk
+ for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
+ do
+ minor=$(( $base + $part ))
+ makedev sd$unit$part b $major $minor $disk
+ done
+ ;;
+ sd[a-d][a-z])
+ unit=`suffix $arg sd`
+ unitmaj=`first $unit`
+ unitmin=`second $unit`
+ basemaj=`index Xabcd $unitmaj`
+ basemin=`index abcdefghijklmnopqrstuvwxyz $unitmin`
+ basemaj=`math $basemaj \* 416`
+ basemin=`math $basemin \* 16`
+ base=`math $basemaj + $basemin`
+ basemaj=`math $base / 256`
+ base=`math $base % 256`
+ major=`math basemaj \+ 64`
+ if [ $major -gt 71 ]; then
+ echo "$0: don't know how to make device \"$arg\"" >&2
+ exit 0
+ fi
+ makedev sd$unit b $major $base $disk
+ for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
+ do
+ minor=$(( $base + $part ))
+ makedev sd$unit$part b $major $minor $disk
+ done
+ ;;
+ dasd[a-z])
+ major=`Major dasd 94` || continue
+ unit=`suffix $arg dasd`
+ base=`index abcdefghijklmnopqrstuvwxyz $unit`
+ base=$(( $base * 4 ))
+ if [ $base -lt 256 ]; then
+ major=94
+ else
+ major=65
+ base=$(( $base - 256 ))
+ fi
+ makedev dasd$unit b $major $base $disk
+ # Not yet implemented. (Feb. 8, 2001)
+ # for part in 1 2 3
+ for part in 1
+ do
+ minor=$(( $base + $part ))
+ makedev dasd$unit$part b $major $minor $disk
+ done
+ ;;
+ ad[a-p])
+ major=`Major ad 28` || continue
+ unit=`suffix $arg ad`
+ base=`index abcdefghijklmnop $unit`
+ base=`math $base \* 16`
+ makedev ad$unit b $major $base $disk
+ for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
+ do
+ minor=$(( $base + $part ))
+ makedev ad$unit$part b $major $minor $disk
+ done
+ ;;
+ dac960)
+ for ctr in 0 1 2 3 4 5 6 7
+ do
+ $0 $opts dac960.$ctr
+ done
+ ;;
+ dac960.[0-7])
+ [ -d rd ] || {
+ mkdir rd
+ chown root:root rd
+ chmod 755 rd
+ }
+ unit=`suffix $arg dac960.`
+ major=`math 48 + $unit`
+ minor=0
+ for ld in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 \
+ 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
+ do
+ makedev rd/c${unit}d${ld} b $major $minor $disk
+ minor=`math $minor + 1`
+ for part in 1 2 3 4 5 6 7
+ do
+ makedev rd/c${unit}d${ld}p$part b $major $minor $disk
+ minor=`math $minor + 1`
+ done
+ done
+ ;;
+ ataraid)
+ for ctr in 0 1 2 # 3 4 5 6 7
+ do
+ $0 $opts ataraid.$ctr
+ done
+ ;;
+ ataraid.[0-7])
+ [ -d ataraid ] || {
+ mkdir ataraid
+ chown root:root ataraid
+ chmod 755 ataraid
+ }
+ unit=`suffix $arg ataraid.`
+ major=114
+ minor=`math $unit \* 16`
+ makedev ataraid/d${unit} b $major $minor $disk
+ for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
+ do
+ minor=`math $minor + 1`
+ makedev ataraid/d${unit}p$part b $major $minor $disk
+ done
+ ;;
+ ida)
+ for ctr in 0 1 2 # 3 4 5 6 7
+ do
+ $0 $opts ida.$ctr
+ done
+ ;;
+ ida.[0-7])
+ [ -d ida ] || {
+ mkdir ida
+ chown root:root ida
+ chmod 755 ida
+ }
+ unit=`suffix $arg ida.`
+ major=`math 72 + $unit`
+ minor=0
+ for ld in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
+ do
+ makedev ida/c${unit}d${ld} b $major $minor $disk
+ minor=`math $minor + 1`
+ for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
+ do
+ makedev ida/c${unit}d${ld}p$part b $major $minor $disk
+ minor=`math $minor + 1`
+ done
+ done
+ ;;
+ cciss)
+ for ctr in 0 1 2 # 3 4 5 6 7
+ do
+ $0 $opts cciss.$ctr
+ done
+ ;;
+ cciss.[0-7])
+ [ -d cciss ] || {
+ mkdir cciss
+ chown root:root cciss
+ chmod 755 cciss
+ }
+ unit=`suffix $arg cciss.`
+ major=`math 104 + $unit`
+ minor=0
+ for ld in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
+ do
+ makedev cciss/c${unit}d${ld} b $major $minor $disk
+ minor=`math $minor + 1`
+ for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
+ do
+ makedev cciss/c${unit}d${ld}p$part b $major $minor $disk
+ minor=`math $minor + 1`
+ done
+ done
+ ;;
+ rom)
+ major=`Major rom 31`
+ for i in 0 1 2 3 4 5 6 7
+ do
+ makedev rom$i b $major $i $disk
+ makedev rrom$i b $major `math $i +8` $disk
+ makedev flash$i b $major `math $i +16` $disk
+ makedev rflash$i b $major `math $i +24` $disk
+ done
+ ;;
+ nb[0-7])
+ major=`Major nbd 43` || continue
+ minor=`suffix $arg nb`
+ makedev nb$minor b $major $minor $disk
+ ;;
+ loop)
+ for part in 0 1 2 3 4 5 6 7
+ do
+ makedev loop$part b 7 $part $disk
+ done
+ ;;
+ md)
+ major=`Major md 9` || continue
+ for part in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
+ do
+ makedev md$part b $major $part $disk
+ done
+ ;;
+ st[0-7])
+ major=`Major st 9`
+ unit=`suffix $arg st`
+ makedev st${unit} c $major $unit $tape
+ makedev nst${unit} c $major `math 128 + $unit` $tape
+
+ makedev st${unit}l c $major `math 32 + $unit` $tape
+ makedev nst${unit}l c $major `math 160 + $unit` $tape
+
+ makedev st${unit}m c $major `math 64 + $unit` $tape
+ makedev nst${unit}m c $major `math 192 + $unit` $tape
+
+ makedev st${unit}a c $major `math 96 + $unit` $tape
+ makedev nst${unit}a c $major `math 224 + $unit` $tape
+ ;;
+ qic)
+ major=`Major tpqic02 12`
+ makedev ntpqic11 c $major 2 $tape
+ makedev tpqic11 c $major 3 $tape
+ makedev ntpqic24 c $major 4 $tape
+ makedev tpqic24 c $major 5 $tape
+ makedev ntpqic120 c $major 6 $tape
+ makedev tpqic120 c $major 7 $tape
+ makedev ntpqic150 c $major 8 $tape
+ makedev tpqic150 c $major 9 $tape
+ makedev rmt8 c $major 6 $tape
+ makedev rmt16 c $major 8 $tape
+ makedev tape-d c $major 136 $tape
+ makedev tape-reset c $major 255 $tape
+ $0 $opts qft
+ ;;
+ ftape)
+ major=`Major qft 27` || continue
+ for unit in 0 1 2 3
+ do
+ makedev qft$unit c $major $unit $tape
+ makedev nqft$unit c $major `math $unit + 4` $tape
+ makedev zqft$unit c $major `math $unit + 16` $tape
+ makedev nzqft$unit c $major `math $unit + 20` $tape
+ makedev rawqft$unit c $major `math $unit + 32` $tape
+ makedev nrawqft$unit c $major `math $unit + 36` $tape
+ done
+ symlink ftape qft0
+ symlink nftape nqft0
+ ;;
+ sr|scd|scd-all)
+ major=`Major sr 11` || continue
+ for unit in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
+ do
+ makedev scd$unit b $major $unit $cdrom
+ symlink sr$unit scd$unit
+ done
+ ;;
+ pktcdvd)
+ major=97
+ for unit in 0 1 2 3
+ do
+ makedev pktcdvd$unit b $major $unit $cdrom
+ done
+ ;;
+ cfs0)
+ makedev cfs0 c 67 0 $coda
+ ;;
+ scd[0-9]|scd[0-1][0-9])
+ major=`Major sr 11` || continue
+ unit=`suffix $arg scd`
+ makedev scd$unit b $major $unit $cdrom
+ ln -f scd$unit sr$unit
+ ;;
+ ttyI[0-9]|ttyI[1-5][0-9]|ttyI[6][0-3])
+ major=43
+ unit=`suffix $arg ttyI`
+ makedev ttyI$unit c $major $unit $dialout
+ ;;
+ ppp)
+ major=108
+ makedev ppp c $major 0 $dip
+ ;;
+ ippp[0-9]|ippp[1-5][0-9]|ippp[6][0-3])
+ major=45
+ unit=`suffix $arg ippp`
+ minor=`math $unit + 128`
+ makedev ippp$unit c $major $minor $dialout
+ ;;
+ isdn[0-9]|isdn[1-5][0-9]|isdn[6][0-3])
+ major=45
+ unit=`suffix $arg isdn`
+ minor=`math $unit + 0`
+ makedev isdn$unit c $major $minor $dialout
+ ;;
+ isdnctrl[0-9]|isdnctrl[1-5][0-9]|isdnctrl[6][0-3])
+ major=45
+ unit=`suffix $arg isdnctrl`
+ minor=`math $unit + 64`
+ makedev isdnctrl$unit c $major $minor $dialout
+ ;;
+ isdninfo)
+ makedev isdninfo c 45 255 $private
+ ;;
+ isdn-tty)
+ major=43
+ for unit in 0 1 2 3 4 5 6 7
+ do
+ makedev ttyI$unit c $major $unit $dialout
+ done
+ ;;
+ isdn-ippp)
+ major=45
+ for unit in 0 1 2 3 4 5 6 7
+ do
+ makedev ippp$unit c $major `math $unit + 128` $dialout
+ done
+ ;;
+ isdn-io)
+ for unit in 0 1 2 3 4 5 6 7
+ do
+ makedev isdn$unit c 45 $unit $dialout
+ makedev isdnctrl$unit c 45 `math $unit + 64` $dialout
+ makedev ippp$unit c 45 `math $unit + 128` $dialout
+ done
+ makedev isdninfo c 45 255 $dialout
+ ;;
+ sonycd)
+ major=`Major sonycd 15` || continue
+ makedev $arg b $major 0 $cdrom
+ ;;
+ mcd)
+ major=`Major mcd 23` || continue
+ makedev $arg b $major 0 $cdrom
+ ;;
+ mcdx|mcdx[0-4])
+ major=`Major $arg 20` || continue
+ for unit in 0 1 2 3 4
+ do
+ makedev mcdx$unit b $major $unit $cdrom
+ done
+ test -r mcdx || symlink mcdx mcdx0
+ ;;
+ cdu535)
+ makedev $arg b 24 0 $cdrom
+ ;;
+ lmscd)
+ makedev $arg b 24 0 $cdrom
+ ;;
+ sbpcd|sbpcd[123])
+ major=`Major $arg 25` || continue
+ base=`suffix ${arg}0 sbpcd`
+ for minor in 0 1 2 3
+ do
+ # XXX
+ unit=$(substr 0123456789abcdef $(( $base * 4 + $minor + 1 )) )
+ makedev sbpcd$unit b $major $minor $cdrom
+ done
+ [ $arg = sbpcd ] && symlink $arg ${arg}0
+ ;;
+ aztcd)
+ major=`Major $arg 29` || continue
+ makedev ${arg}0 b $major 0 $cdrom
+ ;;
+ cm206cd)
+ major=`Major $arg 30` || continue
+ makedev ${arg}0 b $major 0 $cdrom
+ ;;
+ gscd)
+ major=`Major $arg 16` || continue
+ makedev ${arg}0 b $major 0 $cdrom
+ ;;
+ pcd)
+ for unit in 0 1 2 3
+ do
+ makedev pcd$unit b 46 $unit $cdrom
+ done
+ ;;
+ bpcd)
+ makedev $arg b 41 0 $cdrom
+ ;;
+ optcd)
+ makedev $arg b 17 0 $cdrom
+ ;;
+ sjcd)
+ makedev $arg b 18 0 $cdrom
+ ;;
+ cfs|coda)
+ makedev cfs0 c 67 0 $private
+ ;;
+ xfs|arla)
+ makedev xfs0 c 103 0 $private
+ ;;
+ logiscan)
+ major=`Major logiscan` || continue
+ makedev $arg c $major 0 $scanner
+ ;;
+ toshiba)
+ major=`Major $arg 10` || continue
+ makedev $arg c $major 181 root root 0666
+ ;;
+ m105scan)
+ major=`Major m105` || continue
+ makedev $arg c $major 0 $scanner
+ ;;
+ ac4096)
+ major=`Major ac4096` || continue
+ makedev $arg c $major 0 $scanner
+ ;;
+ audio)
+ major=`Major sound 14`
+ makedev mixer c $major 0 $audio
+ makedev mixer1 c $major 16 $audio
+ makedev mixer2 c $major 32 $audio
+ makedev mixer3 c $major 48 $audio
+ makedev sequencer c $major 1 $audio
+ makedev midi00 c $major 2 $audio
+ makedev midi01 c $major 18 $audio
+ makedev midi02 c $major 34 $audio
+ makedev midi03 c $major 50 $audio
+ makedev dsp c $major 3 $audio
+ makedev dsp1 c $major 19 $audio
+ makedev dsp2 c $major 35 $audio
+ makedev dsp3 c $major 51 $audio
+ makedev audio c $major 4 $audio
+ makedev audio1 c $major 20 $audio
+ makedev audio2 c $major 36 $audio
+ makedev audio3 c $major 52 $audio
+ makedev sndstat c $major 6 $audio
+ makedev audioctl c $major 7 $audio
+ major=31
+ makedev mpu401data c $major 0 $audio
+ makedev mpu401stat c $major 1 $audio
+ major=35
+ for i in 0 1 2 3
+ do
+ makedev midi$i c $major $i $audio
+ makedev rmidi$i c $major `math $i + 64` $audio
+ makedev smpte$i c $major `math $i + 128` $audio
+ done
+ ;;
+ pcaudio)
+ major=`Major pcsp 13` || continue
+ makedev pcmixer c $major 0 $audio
+ makedev pcsp c $major 3 $audio
+ makedev pcaudio c $major 4 $audio
+ ;;
+ video|video4linux|v4l|radio)
+ # video4linux api includes radio, teletext, etc.
+ major=`Major video 81` || continue
+ minor=0
+ until [ $minor -gt 63 ]
+ do
+ makedev video$minor c $major $minor $video
+ makedev radio$minor c $major `math $minor + 64` $video
+ minor=`math $minor + 1`
+ done
+ symlink radio radio0
+ minor=0
+ until [ $minor -gt 31 ]
+ do
+ makedev vtx$minor c $major `math $minor + 192` $video
+ makedev vbi$minor c $major `math $minor + 224` $video
+ minor=`math $minor + 1`
+ done
+ symlink video video0
+ symlink vbi vbi0
+ major=82
+ minor=0
+ until [ $minor -gt 1 ]
+ do
+ makedev winradio$minor c $major $minor $video
+ minor=`math $minor + 1`
+ done
+ major=83
+ makedev vtx c $major 0 $video
+ makedev vttuner c $major 16 $video
+ ;;
+ i2c)
+ # making it possible to create an arbitrary number of i2c
+ # devices might be good, but 8 should suffice for now
+ major=`Major i2c 89` || continue
+ minor=0
+ until [ $minor -gt 7 ]
+ do
+ makedev i2c-$minor c $major $minor $private
+ minor=`math $minor + 1`
+ done
+ ;;
+ tlk)
+ major=102
+ minor=0
+ until [ $minor -gt 3 ] # tell me if 3 is wrong...
+ do
+ makedev tlk$minor c $major $minor $video
+ minor=`math $minor + 1`
+ done
+ ;;
+ srnd)
+ makedev srnd0 c 110 0 $video
+ makedev srnd1 c 110 1 $video
+ ;;
+ fgrab)
+ makedev mmetfgrab c 40 0 $video
+ makedev wvisfgrab c 26 0 $video
+ for i in 0 1 # more?
+ do
+ makedev iscc$i c 93 $i $video
+ makedev isccctl$i c 93 `math $i + 128` $video
+ done
+ for i in 0 1 # more?
+ do
+ makedev dcxx$i c 94 $i $video
+ done
+ ;;
+ sg|sg-all)
+ major=`Major sg 21`
+ for unit in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
+ do
+ makedev sg$unit c $major $unit $scsi
+ done
+ ;;
+ pg)
+ major=`Major pg 97`
+ for unit in 0 1 2 3
+ do
+ makedev pg$unit c $major $unit $scsi
+ done
+ ;;
+ fd)
+ # not really devices, we use the /proc filesystem
+ symlink fd $procfs/self/fd
+ symlink stdin fd/0
+ symlink stdout fd/1
+ symlink stderr fd/2
+ ;;
+ ibcs2)
+ major=`Major ibcs2 30` || continue
+ makedev socksys c $major 0 $ibcs2
+ symlink nfsd socksys
+ makedev spx c $major 1 $ibcs2
+ symlink X0R null
+ ;;
+ netlink)
+ major=36
+ makedev route c $major 0 $private
+ makedev skip c $major 1 $private
+ ;;
+ enskip)
+ major=64
+ makedev enskip c $major 0 $private
+ ;;
+ ipfilt*)
+ major=95
+ makedev ipl c $major 0 $private
+ makedev ipnat c $major 1 $private
+ makedev ipstate c $major 2 $private
+ makedev ipauth c $major 3 $private
+ ;;
+ qng)
+ makedev qng c 77 0 $private
+ ;;
+ apm)
+ major=`Major mouse 10` || continue
+ makedev apm_bios c $major 134 $mouse
+ ;;
+ dcf)
+ major=`Major dcf` || continue
+ makedev $arg c $major 0 $system
+ ;;
+ helloworld)
+ major=`Major hw` || continue
+ makedev helloworld c $major 0 $public
+ ;;
+ ipsec)
+ # For the Free S/WAN (http://www.xs4all.nl/~freeswan/)
+ # implementation of IPSEC
+ makedev ipsec c 36 10 $ipsec
+ ;;
+ comedi)
+ major=98
+ for minor in 0 1 2 3
+ do
+ makedev comedi$minor c $major $minor $public
+ done
+ ;;
+ usb)
+ mkdir -p usb
+ major=180
+ for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
+ do
+ makedev usb/lp$i c $major $i $printer
+ makedev usb/mouse$i c $major `math $i + 16` $mouse
+ makedev usb/ez$i c $major `math $i + 32` $system
+ makedev usb/scanner$i c $major `math $i + 48` $scanner
+ makedev ttyACM$i c 166 $i $dialout
+ makedev ttyUSB$i c 188 $i $dialout
+ done
+ makedev usb/rio500 c $major 64 $audio
+ ;;
+ paride)
+ major=45
+ for unit in a b c d
+ do
+ base=`index abcd $unit`
+ base=`math $base \* 16`
+ makedev pd$unit b $major $base $disk
+ for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
+ do
+ makedev pd$unit$part b $major $(( $base + $part )) $disk
+ done
+ done
+ for i in 0 1 2 3
+ do
+ makedev pcd$i b 46 $i $cdrom
+ makedev pf$i b 47 $i $floppy
+ done
+ ;;
+ update)
+ if [ ! "$devices" ]
+ then
+ echo "$0: don't appear to have any devices" >&2
+ continue
+ fi
+ if [ "$opt_d" ]
+ then
+ echo "$0: can't delete an update" >&2
+ continue
+ fi
+ create=
+ delete=
+ devs="$devices"
+ if [ -f DEVICES ]
+ then
+ exec 3<DEVICES
+ while read device major <&3
+ do
+ eval now=\$major_${device/-/_}
+ if [ "$now" = "" ]
+ then
+ delete="$delete `cvt $device`"
+ continue
+ elif [ "$now" != $major ]
+ then
+ create="$create "`cvt $device`
+ fi
+ devs=`strip " $devs " $device`
+ done
+ exec 3<&-
+ fi
+ create="$create "`cvt $devs`
+ [ "$delete" != "" ] && $0 $opts -d $delete
+ [ "$create" != " " ] && $0 $opts $create
+ [ "$opt_n" ] && continue
+ for device in $devices
+ do
+ if [ "`cvt $device`" ]
+ then
+ eval echo $device \$major_${device/-/_}
+ fi
+ done > DEVICES
+ ;;
+ *)
+ echo "$0: don't know how to make device \"$arg\"" >&2
+ exit 1
+ ;;
+ esac
+done
+
+exit 0
diff --git a/sbin/MAKEDEV-gentoo.patch b/sbin/MAKEDEV-gentoo.patch
new file mode 100755
index 0000000..14e5edf
--- /dev/null
+++ b/sbin/MAKEDEV-gentoo.patch
@@ -0,0 +1,210 @@
+--- MAKEDEV.orig 2003-03-09 08:12:11.000000000 +0200
++++ MAKEDEV 2003-03-09 08:26:25.000000000 +0200
+@@ -260,48 +260,65 @@
+ # case `cvt $arg` in
+ case $arg in
+ generic)
+- # pick the right generic-<arch> using dpkg's knowledge
+- case `dpkg --print-installation-architecture` in
+- alpha)
+- $0 $opts generic-alpha
+- ;;
+- arm)
+- $0 $opts generic-arm
+- ;;
+- hppa)
+- $0 $opts generic-hppa
+- ;;
+- i386)
+- $0 $opts generic-i386
+- ;;
+- ia64)
+- $0 $opts generic-ia64
+- ;;
+- m68k)
+- $0 $opts generic-m68k
+- ;;
+- mips)
+- $0 $opts generic-mips
+- ;;
+- mipsel)
+- $0 $opts generic-mipsel
+- ;;
+- powerpc)
+- $0 $opts generic-powerpc
+- ;;
+- s390)
+- $0 $opts generic-s390
+- ;;
+- sparc)
+- $0 $opts generic-sparc
+- ;;
+- *)
+- echo "$0: no support for generic on this arch" >&2
+- exit 1
+- ;;
+- esac
++ if [ -n "`which dpkg 2> /dev/null`" ]
++ then
++ # pick the right generic-<arch> using dpkg's knowledge
++ case `dpkg --print-installation-architecture` in
++ alpha)
++ $0 $opts generic-alpha
++ ;;
++ arm)
++ $0 $opts generic-arm
++ ;;
++ hppa)
++ $0 $opts generic-hppa
++ ;;
++ i386)
++ $0 $opts generic-i386
++ ;;
++ ia64)
++ $0 $opts generic-ia64
++ ;;
++ m68k)
++ $0 $opts generic-m68k
++ ;;
++ mips)
++ $0 $opts generic-mips
++ ;;
++ mipsel)
++ $0 $opts generic-mipsel
++ ;;
++ powerpc)
++ $0 $opts generic-powerpc
++ ;;
++ s390)
++ $0 $opts generic-s390
++ ;;
++ sparc)
++ $0 $opts generic-sparc
++ ;;
++ *)
++ echo "$0: no support for generic on this arch" >&2
++ exit 1
++ ;;
++ esac
++ else
++ $0 $opts std
++ $0 $opts fd
++ $0 $opts fd0 fd1
++ $0 $opts hda hdb
++ $0 $opts xda xdb
++ $0 $opts sda sdb
++ $0 $opts pty
++ $0 $opts console
++ $0 $opts ttyS0 ttyS1 ttyS2 ttyS3
++ $0 $opts busmice
++ $0 $opts lp
++ $0 $opts par
++ fi
+ ;;
+ generic-alpha)
++ export MDARCH="alpha"
+ $0 $opts std
+ $0 $opts fd
+ $0 $opts fd0 fd1
+@@ -321,6 +338,7 @@
+ $0 $opts fb
+ ;;
+ generic-arm)
++ export MDARCH="arm"
+ $0 $opts std
+ $0 $opts fd
+ $0 $opts fd0 fd1
+@@ -340,6 +358,7 @@
+ $0 $opts fb
+ ;;
+ generic-hppa)
++ export MDARCH="hppa"
+ $0 $opts std
+ $0 $opts fd
+ $0 $opts fd0 fd1
+@@ -358,6 +377,7 @@
+ $0 $opts rtc
+ ;;
+ generic-i386)
++ export MDARCH="i386"
+ $0 $opts std
+ $0 $opts fd
+ $0 $opts fd0 fd1
+@@ -380,6 +400,7 @@
+ $0 $opts lmscd sbpcd aztcd bpcd dac960 ida ataraid cciss
+ ;;
+ generic-ia64)
++ export MDARCH="ia64"
+ $0 $opts std
+ $0 $opts fd
+ $0 $opts fd0 fd1
+@@ -400,6 +421,7 @@
+ $0 $opts efirtc
+ ;;
+ generic-m68k)
++ export MDARCH="m68k"
+ $0 $opts std
+ $0 $opts fd
+ $0 $opts fd0 fd1
+@@ -418,6 +440,7 @@
+ $0 $opts fb
+ ;;
+ generic-mips)
++ export MDARCH="mips"
+ $0 $opts std
+ $0 $opts fd
+ $0 $opts fd0 fd1
+@@ -436,6 +459,7 @@
+ $0 $opts busmice
+ ;;
+ generic-mipsel)
++ export MDARCH="mipsel"
+ $0 $opts std
+ $0 $opts fd
+ $0 $opts fd0 fd1
+@@ -454,6 +478,7 @@
+ $0 $opts rtc
+ ;;
+ generic-powerpc)
++ export MDARCH="powerpc"
+ $0 $opts std
+ $0 $opts fd
+ $0 $opts fd0 fd1
+@@ -478,6 +503,7 @@
+ $0 $opts isdn-io
+ ;;
+ generic-s390)
++ export MDARCH="s390"
+ $0 $opts std
+ $0 $opts fd
+ $0 $opts dasda dasdb dasdc dasdd dasde dasdf dasdg dasdh \
+@@ -489,6 +515,7 @@
+ $0 $opts rtc
+ ;;
+ generic-sparc)
++ export MDARCH="sparc"
+ $0 $opts std
+ $0 $opts fd0-bare fd1-bare
+ $0 $opts hda hdb hdc hdd
+@@ -601,8 +628,19 @@
+ done
+ ;;
+ adb)
+- # pick the right arch device using dpkg's knowledge
+- case `dpkg --print-installation-architecture` in
++ myarch=
++
++ if [ -n "`which dpkg 2> /dev/null`" ]
++ then
++ # pick the right arch device using dpkg's knowledge
++ myarch="`dpkg --print-installation-architecture`"
++
++ elif [ -n "${MDARCH}" ]
++ then
++ myarch="${MDARCH}"
++ fi
++
++ case $myarch in
+ powerpc)
+ # ADB bus devices (char)
+ makedev adb c 56 0 $mouse
diff --git a/sbin/depscan.sh b/sbin/depscan.sh
new file mode 100755
index 0000000..1fbf0ef
--- /dev/null
+++ b/sbin/depscan.sh
@@ -0,0 +1,93 @@
+#!/bin/bash
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+source /sbin/functions.sh
+
+if [[ $1 == "--debug" ]] ; then
+ shift
+ set -x
+fi
+
+if [[ ! -d ${svcdir} ]]; then
+ if ! mkdir -p -m 0755 "${svcdir}" 2>/dev/null ; then
+ eerror "Could not create needed directory '${svcdir}'!"
+ fi
+fi
+
+for x in softscripts snapshot options daemons \
+ started starting inactive stopping failed \
+ exclusive exitcodes ; do
+ if [[ ! -d "${svcdir}/${x}" ]] ; then
+ if ! mkdir -p -m 0755 "${svcdir}/${x}" 2>/dev/null ; then
+ eerror "Could not create needed directory '${svcdir}/${x}'!"
+ fi
+ fi
+done
+
+# Only update if files have actually changed
+update=1
+
+if [[ $1 == "-u" ]] ; then
+ update=0
+ clock_screw=0
+ mtime_test="${svcdir}/mtime-test.$$"
+
+ # If its not there, we have to update, and make sure its present
+ # for next mtime testing
+ if [[ ! -e ${svcdir}/depcache ]] ; then
+ update=1
+ touch "${svcdir}/depcache"
+ fi
+
+ touch "${mtime_test}"
+ for config in /etc/conf.d /etc/init.d /etc/rc.conf
+ do
+ [[ ${update} == 0 ]] && \
+ is_older_than "${svcdir}/depcache" "${config}" && update=1
+
+ is_older_than "${mtime_test}" "${config}" && clock_screw=1
+ done
+ rm -f "${mtime_test}"
+
+ [[ ${clock_screw} == 1 ]] && \
+ ewarn "Some file in '/etc/{conf.d,init.d}' have Modification time in the future!"
+
+ shift
+fi
+
+[[ ${update} == 0 ]] && exit 0
+
+ebegin "Caching service dependencies"
+
+# Clean out the non volitile directories ...
+rm -rf "${svcdir}"/dep{cache,tree} "${svcdir}"/{broken,snapshot}/*
+
+retval=0
+SVCDIR="${svcdir}"
+DEPTYPES="${deptypes}"
+ORDTYPES="${ordtypes}"
+
+export SVCDIR DEPTYPES ORDTYPES
+
+cd /etc/init.d
+
+/bin/gawk \
+ -f /lib/rcscripts/awk/functions.awk \
+ -f /lib/rcscripts/awk/cachedepends.awk || \
+ retval=1
+
+bash "${svcdir}/depcache" | \
+/bin/gawk \
+ -f /lib/rcscripts/awk/functions.awk \
+ -f /lib/rcscripts/awk/gendepends.awk || \
+ retval=1
+
+touch "${svcdir}"/dep{cache,tree}
+chmod 0644 "${svcdir}"/dep{cache,tree}
+
+eend ${retval} "Failed to cache service dependencies"
+
+exit ${retval}
+
+# vim:ts=4
diff --git a/sbin/env-update.sh b/sbin/env-update.sh
new file mode 100755
index 0000000..533e989
--- /dev/null
+++ b/sbin/env-update.sh
@@ -0,0 +1,42 @@
+#!/bin/bash
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+source /sbin/functions.sh || exit 1
+
+if [ "${EUID}" -ne 0 ]
+then
+ eerror "$0: must be root."
+ exit 1
+fi
+
+usage() {
+echo "usage: env-update.sh
+
+note:
+ This utility generates /etc/profile.env and /etc/csh.env
+ from the contents of /etc/env.d/
+"
+ exit 1
+}
+
+export SVCDIR="${svcdir}"
+
+# Only update if files have actually changed
+if [ "$1" == "-u" ]
+then
+ is_older_than "${svcdir}/envcache" /etc/env.d && exit 0
+ shift
+fi
+
+if [ "$#" -ne 0 ]
+then
+ usage
+else
+ /bin/gawk \
+ -f /lib/rcscripts/awk/functions.awk \
+ -f /lib/rcscripts/awk/genenviron.awk
+fi
+
+
+# vim:ts=4
diff --git a/sbin/functions.sh b/sbin/functions.sh
new file mode 100755
index 0000000..a210c4f
--- /dev/null
+++ b/sbin/functions.sh
@@ -0,0 +1,868 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+RC_GOT_FUNCTIONS="yes"
+
+# daemontools dir
+SVCDIR="/var/lib/supervise"
+
+# Check /etc/conf.d/rc for a description of these ...
+svcdir="/var/lib/init.d"
+svclib="/lib/rcscripts"
+svcmount="no"
+svcfstype="tmpfs"
+svcsize=1024
+
+# Different types of dependencies
+deptypes="need use"
+# Different types of order deps
+ordtypes="before after"
+
+#
+# Internal variables
+#
+
+# Dont output to stdout?
+RC_QUIET_STDOUT="no"
+RC_VERBOSE=${RC_VERBOSE:-no}
+
+# Should we use color?
+RC_NOCOLOR=${RC_NOCOLOR:-no}
+# Can the terminal handle endcols?
+RC_ENDCOL="yes"
+
+#
+# Default values for rc system
+#
+RC_TTY_NUMBER=11
+RC_NET_STRICT_CHECKING="no"
+RC_PARALLEL_STARTUP="no"
+RC_USE_CONFIG_PROFILE="yes"
+
+#
+# Default values for e-message indentation and dots
+#
+RC_INDENTATION=''
+RC_DEFAULT_INDENT=2
+#RC_DOT_PATTERN=' .'
+RC_DOT_PATTERN=''
+
+# Override defaults with user settings ...
+[ -f /etc/conf.d/rc ] && source /etc/conf.d/rc
+
+# void import_addon(char *addon)
+#
+# Import code from the specified addon if it exists
+#
+import_addon() {
+ local addon=${svclib}/addons/$1
+ if [[ -r ${addon} ]] ; then
+ source "${addon}"
+ return 0
+ fi
+ return 1
+}
+
+# void splash(...)
+#
+# Notify bootsplash/splashutils/gensplash/whatever about
+# important events.
+#
+splash() {
+ return 0
+}
+# This will override the splash() function...
+if ! import_addon splash-functions.sh ; then
+ [ -f /sbin/splash-functions.sh ] && source /sbin/splash-functions.sh
+fi
+
+# void profiling(...)
+#
+# Notify bootsplash/whatever about important events.
+#
+profiling() {
+ return 0
+}
+import_addon profiling-functions.sh
+
+# void bootlog(...)
+#
+# Notify bootlogger about important events.
+bootlog() {
+ return 0
+}
+[[ ${RC_BOOTLOG} == "yes" ]] && import_addon bootlogger.sh
+
+# void get_bootconfig()
+#
+# Get the BOOTLEVEL and SOFTLEVEL by setting
+# 'bootlevel' and 'softlevel' via kernel
+# parameters.
+#
+get_bootconfig() {
+ local copt=
+ local newbootlevel=
+ local newsoftlevel=
+
+ if [[ -r /proc/cmdline ]] ; then
+ for copt in $(</proc/cmdline) ; do
+ case "${copt%=*}" in
+ bootlevel)
+ newbootlevel=${copt##*=}
+ ;;
+ softlevel)
+ newsoftlevel=${copt##*=}
+ ;;
+ esac
+ done
+ fi
+
+ if [[ -n ${newbootlevel} ]] ; then
+ export BOOTLEVEL=${newbootlevel}
+ else
+ export BOOTLEVEL="boot"
+ fi
+
+ if [[ -n ${newsoftlevel} ]] ; then
+ export DEFAULTLEVEL=${newsoftlevel}
+ else
+ export DEFAULTLEVEL="default"
+ fi
+
+ return 0
+}
+
+setup_defaultlevels() {
+ get_bootconfig
+
+ if get_bootparam "noconfigprofile" ; then
+ export RC_USE_CONFIG_PROFILE="no"
+
+ elif get_bootparam "configprofile" ; then
+ export RC_USE_CONFIG_PROFILE="yes"
+ fi
+
+ if [ "${RC_USE_CONFIG_PROFILE}" = "yes" -a -n "${DEFAULTLEVEL}" ] && \
+ [ -d "/etc/runlevels/${BOOTLEVEL}.${DEFAULTLEVEL}" -o \
+ -L "/etc/runlevels/${BOOTLEVEL}.${DEFAULTLEVEL}" ]
+ then
+ export BOOTLEVEL="${BOOTLEVEL}.${DEFAULTLEVEL}"
+ fi
+
+ if [ -z "${SOFTLEVEL}" ] ; then
+ if [ -f "${svcdir}/softlevel" ] ; then
+ export SOFTLEVEL="$(< ${svcdir}/softlevel)"
+ else
+ export SOFTLEVEL="${BOOTLEVEL}"
+ fi
+ fi
+
+ return 0
+}
+
+# void get_libdir(void)
+#
+# prints the current libdir {lib,lib32,lib64}
+#
+get_libdir() {
+ if [ -n "${CONF_LIBDIR_OVERRIDE}" ] ; then
+ CONF_LIBDIR="${CONF_LIBDIR_OVERRIDE}"
+ elif [ -x "/usr/bin/portageq" ] ; then
+ CONF_LIBDIR="$(/usr/bin/portageq envvar CONF_LIBDIR)"
+ fi
+ echo ${CONF_LIBDIR:=lib}
+}
+
+# void esyslog(char* priority, char* tag, char* message)
+#
+# use the system logger to log a message
+#
+esyslog() {
+ local pri=
+ local tag=
+
+ if [ -x /usr/bin/logger ]
+ then
+ pri="$1"
+ tag="$2"
+
+ shift 2
+ [[ -z "$*" ]] && return 0
+
+ /usr/bin/logger -p "${pri}" -t "${tag}" -- "$*"
+ fi
+
+ return 0
+}
+
+# void eindent(int num)
+#
+# increase the indent used for e-commands.
+#
+eindent() {
+ local i=$1
+ (( i > 0 )) || (( i = RC_DEFAULT_INDENT ))
+ esetdent $(( ${#RC_INDENTATION} + i ))
+}
+
+# void eoutdent(int num)
+#
+# decrease the indent used for e-commands.
+#
+eoutdent() {
+ local i=$1
+ (( i > 0 )) || (( i = RC_DEFAULT_INDENT ))
+ esetdent $(( ${#RC_INDENTATION} - i ))
+}
+
+# void esetdent(int num)
+#
+# hard set the indent used for e-commands.
+# num defaults to 0
+#
+esetdent() {
+ local i=$1
+ (( i < 0 )) && (( i = 0 ))
+ RC_INDENTATION=$(printf "%${i}s" '')
+}
+
+# void einfo(char* message)
+#
+# show an informative message (with a newline)
+#
+einfo() {
+ einfon "$*\n"
+ LAST_E_CMD=einfo
+ return 0
+}
+
+# void einfon(char* message)
+#
+# show an informative message (without a newline)
+#
+einfon() {
+ [[ ${RC_QUIET_STDOUT} == yes ]] && return 0
+ [[ ${RC_ENDCOL} != yes && ${LAST_E_CMD} == ebegin ]] && echo
+ echo -ne " ${GOOD}*${NORMAL} ${RC_INDENTATION}$*"
+ LAST_E_CMD=einfon
+ return 0
+}
+
+# void ewarn(char* message)
+#
+# show a warning message + log it
+#
+ewarn() {
+ if [[ ${RC_QUIET_STDOUT} == yes ]]; then
+ echo " $*"
+ else
+ [[ ${RC_ENDCOL} != yes && ${LAST_E_CMD} == ebegin ]] && echo
+ echo -e " ${WARN}*${NORMAL} ${RC_INDENTATION}$*"
+ fi
+
+ # Log warnings to system log
+ esyslog "daemon.warning" "rc-scripts" "$*"
+
+ LAST_E_CMD=ewarn
+ return 0
+}
+
+# void eerror(char* message)
+#
+# show an error message + log it
+#
+eerror() {
+ if [[ ${RC_QUIET_STDOUT} == yes ]]; then
+ echo " $*" >/dev/stderr
+ else
+ [[ ${RC_ENDCOL} != yes && ${LAST_E_CMD} == ebegin ]] && echo
+ echo -e " ${BAD}*${NORMAL} ${RC_INDENTATION}$*"
+ fi
+
+ # Log errors to system log
+ esyslog "daemon.err" "rc-scripts" "$*"
+
+ LAST_E_CMD=eerror
+ return 0
+}
+
+# void ebegin(char* message)
+#
+# show a message indicating the start of a process
+#
+ebegin() {
+ local msg="$*" dots spaces=${RC_DOT_PATTERN//?/ }
+ [[ ${RC_QUIET_STDOUT} == yes ]] && return 0
+
+ if [[ -n ${RC_DOT_PATTERN} ]]; then
+ dots=$(printf "%$(( COLS - 3 - ${#RC_INDENTATION} - ${#msg} - 7 ))s" '')
+ dots=${dots//${spaces}/${RC_DOT_PATTERN}}
+ msg="${msg}${dots}"
+ else
+ msg="${msg} ..."
+ fi
+ einfon "${msg}"
+ [[ ${RC_ENDCOL} == yes ]] && echo
+
+ LAST_E_LEN=$(( 3 + ${#RC_INDENTATION} + ${#msg} ))
+ LAST_E_CMD=ebegin
+ return 0
+}
+
+# void _eend(int error, char *efunc, char* errstr)
+#
+# indicate the completion of process, called from eend/ewend
+# if error, show errstr via efunc
+#
+# This function is private to functions.sh. Do not call it from a
+# script.
+#
+_eend() {
+ local retval=${1:-0} efunc=${2:-eerror} msg
+ shift 2
+
+ if [[ ${retval} == 0 ]]; then
+ [[ ${RC_QUIET_STDOUT} == yes ]] && return 0
+ msg="${BRACKET}[ ${GOOD}ok${BRACKET} ]${NORMAL}"
+ else
+ if [[ -c /dev/null ]]; then
+ rc_splash "stop" &>/dev/null &
+ else
+ rc_splash "stop" &
+ fi
+ if [[ -n "$*" ]]; then
+ ${efunc} "$*"
+ fi
+ msg="${BRACKET}[ ${BAD}!!${BRACKET} ]${NORMAL}"
+ fi
+
+ if [[ ${RC_ENDCOL} == yes ]]; then
+ echo -e "${ENDCOL} ${msg}"
+ else
+ [[ ${LAST_E_CMD} == ebegin ]] || LAST_E_LEN=0
+ printf "%$(( COLS - LAST_E_LEN - 6 ))s%b\n" '' "${msg}"
+ fi
+
+ return ${retval}
+}
+
+# void eend(int error, char* errstr)
+#
+# indicate the completion of process
+# if error, show errstr via eerror
+#
+eend() {
+ local retval=${1:-0}
+ shift
+
+ _eend ${retval} eerror "$*"
+
+ LAST_E_CMD=eend
+ return $retval
+}
+
+# void ewend(int error, char* errstr)
+#
+# indicate the completion of process
+# if error, show errstr via ewarn
+#
+ewend() {
+ local retval=${1:-0}
+ shift
+
+ _eend ${retval} ewarn "$*"
+
+ LAST_E_CMD=ewend
+ return $retval
+}
+
+# v-e-commands honor RC_VERBOSE which defaults to no.
+# The condition is negated so the return value will be zero.
+veinfo() { [[ "${RC_VERBOSE}" != yes ]] || einfo "$@"; }
+veinfon() { [[ "${RC_VERBOSE}" != yes ]] || einfon "$@"; }
+vewarn() { [[ "${RC_VERBOSE}" != yes ]] || ewarn "$@"; }
+veerror() { [[ "${RC_VERBOSE}" != yes ]] || eerror "$@"; }
+vebegin() { [[ "${RC_VERBOSE}" != yes ]] || ebegin "$@"; }
+veend() {
+ [[ "${RC_VERBOSE}" == yes ]] && { eend "$@"; return $?; }
+ return ${1:-0}
+}
+veend() {
+ [[ "${RC_VERBOSE}" == yes ]] && { ewend "$@"; return $?; }
+ return ${1:-0}
+}
+
+# char *KV_major(string)
+#
+# Return the Major (X of X.Y.Z) kernel version
+#
+KV_major() {
+ [[ -z $1 ]] && return 1
+
+ local KV=$@
+ echo ${KV%%.*}
+}
+
+# char *KV_minor(string)
+#
+# Return the Minor (Y of X.Y.Z) kernel version
+#
+KV_minor() {
+ [[ -z $1 ]] && return 1
+
+ local KV=$@
+ KV=${KV#*.}
+ echo ${KV%%.*}
+}
+
+# char *KV_micro(string)
+#
+# Return the Micro (Z of X.Y.Z) kernel version.
+#
+KV_micro() {
+ [[ -z $1 ]] && return 1
+
+ local KV=$@
+ KV=${KV#*.*.}
+ echo ${KV%%[^[:digit:]]*}
+}
+
+# int KV_to_int(string)
+#
+# Convert a string type kernel version (2.4.0) to an int (132096)
+# for easy compairing or versions ...
+#
+KV_to_int() {
+ [[ -z $1 ]] && return 1
+
+ local KV_MAJOR=$(KV_major "$1")
+ local KV_MINOR=$(KV_minor "$1")
+ local KV_MICRO=$(KV_micro "$1")
+ local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+ # We make version 2.2.0 the minimum version we will handle as
+ # a sanity check ... if its less, we fail ...
+ if [[ ${KV_int} -ge 131584 ]] ; then
+ echo "${KV_int}"
+ return 0
+ fi
+
+ return 1
+}
+
+# int get_KV()
+#
+# Return the kernel version (major, minor and micro concated) as an integer.
+# Assumes X and Y of X.Y.Z are numbers. Also assumes that some leading
+# portion of Z is a number.
+# e.g. 2.4.25, 2.6.10, 2.6.4-rc3, 2.2.40-poop, 2.0.15+foo
+#
+get_KV() {
+ local KV=$(uname -r)
+
+ echo $(KV_to_int "${KV}")
+
+ return $?
+}
+
+# bool get_bootparam(param)
+#
+# return 0 if gentoo=param was passed to the kernel
+#
+# EXAMPLE: if get_bootparam "nodevfs" ; then ....
+#
+get_bootparam() {
+ local x copt params retval=1
+
+ [ ! -r "/proc/cmdline" ] && return 1
+
+ for copt in $(< /proc/cmdline)
+ do
+ if [ "${copt%=*}" = "gentoo" ]
+ then
+ params="$(gawk -v PARAMS="${copt##*=}" '
+ BEGIN {
+ split(PARAMS, nodes, ",")
+ for (x in nodes)
+ print nodes[x]
+ }')"
+
+ # Parse gentoo option
+ for x in ${params}
+ do
+ if [ "${x}" = "$1" ]
+ then
+# echo "YES"
+ retval=0
+ fi
+ done
+ fi
+ done
+
+ return ${retval}
+}
+
+# Safer way to list the contents of a directory,
+# as it do not have the "empty dir bug".
+#
+# char *dolisting(param)
+#
+# print a list of the directory contents
+#
+# NOTE: quote the params if they contain globs.
+# also, error checking is not that extensive ...
+#
+dolisting() {
+ local x=
+ local y=
+ local tmpstr=
+ local mylist=
+ local mypath="$*"
+
+ if [ "${mypath%/\*}" != "${mypath}" ]
+ then
+ mypath="${mypath%/\*}"
+ fi
+
+ for x in ${mypath}
+ do
+ [ ! -e "${x}" ] && continue
+
+ if [ ! -d "${x}" ] && ( [ -L "${x}" -o -f "${x}" ] )
+ then
+ mylist="${mylist} $(ls "${x}" 2> /dev/null)"
+ else
+ [ "${x%/}" != "${x}" ] && x="${x%/}"
+
+ cd "${x}"; tmpstr="$(ls)"
+
+ for y in ${tmpstr}
+ do
+ mylist="${mylist} ${x}/${y}"
+ done
+ fi
+ done
+
+ echo "${mylist}"
+}
+
+# void save_options(char *option, char *optstring)
+#
+# save the settings ("optstring") for "option"
+#
+save_options() {
+ local myopts="$1"
+
+ shift
+ if [ ! -d "${svcdir}/options/${myservice}" ]
+ then
+ mkdir -p -m 0755 "${svcdir}/options/${myservice}"
+ fi
+
+ echo "$*" > "${svcdir}/options/${myservice}/${myopts}"
+
+ return 0
+}
+
+# char *get_options(char *option)
+#
+# get the "optstring" for "option" that was saved
+# by calling the save_options function
+#
+get_options() {
+ if [ -f "${svcdir}/options/${myservice}/$1" ]
+ then
+ echo "$(< ${svcdir}/options/${myservice}/$1)"
+ fi
+
+ return 0
+}
+
+# char *add_suffix(char * configfile)
+#
+# Returns a config file name with the softlevel suffix
+# appended to it. For use with multi-config services.
+add_suffix() {
+ if [ "${RC_USE_CONFIG_PROFILE}" = "yes" -a -e "$1.${DEFAULTLEVEL}" ]
+ then
+ echo "$1.${DEFAULTLEVEL}"
+ else
+ echo "$1"
+ fi
+
+ return 0
+}
+
+# char *get_base_ver()
+#
+# get the version of baselayout that this system is running
+#
+get_base_ver() {
+ [[ ! -r /etc/gentoo-release ]] && return 0
+ local ver=$(</etc/gentoo-release)
+ echo ${ver##* }
+}
+
+# Network filesystems list for common use in rc-scripts.
+# This variable is used in is_net_fs and other places such as
+# localmount.
+NET_FS_LIST="afs cifs coda davfs gfs ncpfs nfs nfs4 ocfs2 shfs smbfs"
+
+# bool is_net_fs(path)
+#
+# return 0 if path is the mountpoint of a networked filesystem
+#
+# EXAMPLE: if is_net_fs / ; then ...
+#
+is_net_fs() {
+ local fstype
+ # /proc/mounts is always accurate but may not always be available
+ if [[ -e /proc/mounts ]]; then
+ fstype=$( sed -n -e '/^rootfs/!s:.* '"$1"' \([^ ]*\).*:\1:p' /proc/mounts )
+ else
+ fstype=$( mount | sed -n -e 's:.* on '"$1"' type \([^ ]*\).*:\1:p' )
+ fi
+ [[ " ${NET_FS_LIST} " == *" ${fstype} "* ]]
+ return $?
+}
+
+# bool is_uml_sys()
+#
+# return 0 if the currently running system is User Mode Linux
+#
+# EXAMPLE: if is_uml_sys ; then ...
+#
+is_uml_sys() {
+ grep -qs 'UML' /proc/cpuinfo
+ return $?
+}
+
+# bool is_vserver_sys()
+#
+# return 0 if the currently running system is a Linux VServer
+#
+# EXAMPLE: if is_vserver_sys ; then ...
+#
+is_vserver_sys() {
+ grep -qs '^s_context:[[:space:]]*[1-9]' /proc/self/status
+ return $?
+}
+
+# bool is_xenU_sys()
+#
+# return 0 if the currently running system is an unprivileged Xen domain
+#
+# EXAMPLE: if is_xenU_sys ; then ...
+#
+is_xenU_sys() {
+ [[ -d /proc/xen && ! -f /proc/xen/privcmd ]]
+}
+
+# bool get_mount_fstab(path)
+#
+# return the parameters to pass to the mount command generated from fstab
+#
+# EXAMPLE: cmd=$( get_mount_fstab /proc )
+# cmd=${cmd:--t proc none /proc}
+# mount -n ${cmd}
+#
+get_mount_fstab() {
+ awk '$1 ~ "^#" { next }
+ $2 == "'$*'" { stab="-t "$3" -o "$4" "$1" "$2; }
+ END { print stab; }
+ ' /etc/fstab
+}
+
+# char *reverse_list(list)
+#
+# Returns the reversed order of list
+#
+reverse_list() {
+ for (( i = $# ; i > 0 ; --i )); do
+ echo -n "${!i} "
+ done
+}
+
+# void start_addon(addon)
+#
+# Starts addon.
+#
+start_addon() {
+ local addon=$1
+ (import_addon ${addon}-start.sh)
+ return 0
+}
+
+# void start_volumes()
+#
+# Starts all volumes in RC_VOLUME_ORDER.
+#
+start_volumes() {
+ local x=
+
+ for x in ${RC_VOLUME_ORDER}; do
+ start_addon "${x}"
+ done
+
+ return 0
+}
+
+# void stop_addon(addon)
+#
+# Stops addon.
+#
+stop_addon() {
+ local addon=$1
+ (import_addon ${addon}-stop.sh)
+ return 0
+}
+
+# void stop_volumes()
+#
+# Stops all volumes in RC_VOLUME_ORDER (reverse order).
+#
+stop_volumes() {
+ local x=
+
+ for x in $(reverse_list ${RC_VOLUME_ORDER}); do
+ stop_addon "${x}"
+ done
+
+ return 0
+}
+
+# bool is_older_than(reference, files/dirs to check)
+#
+# return 0 if any of the files/dirs are newer than
+# the reference file
+#
+# EXAMPLE: if is_older_than a.out *.o ; then ...
+is_older_than() {
+ local x=
+ local ref="$1"
+ shift
+
+ for x in "$@" ; do
+ [[ ${x} -nt ${ref} ]] && return 0
+
+ if [[ -d ${x} ]] ; then
+ is_older_than "${ref}" "${x}"/* && return 0
+ fi
+ done
+
+ return 1
+}
+
+# char* bash_variable(char *variable)
+#
+# Turns the given variable into something that bash can use
+# Basically replaces anything not a-z,A-Z into a _
+#
+bash_variable() {
+ local args="$@"
+ LC_ALL=C echo "${args//[![:word:]]/_}"
+}
+
+# void requote()
+#
+# Requotes params so they're suitable to be eval'd, just like this would:
+# set -- 1 2 "3 4"
+# /usr/bin/getopt -- '' "$@" | sed 's/^ -- //'
+#
+requote() {
+ local q=\'
+ set -- "${@//\'/$q\'$q}" # quote inner instances of '
+ set -- "${@/#/$q}" # add ' to start of each param
+ set -- "${@/%/$q}" # add ' to end of each param
+ echo "$*"
+}
+
+##############################################################################
+# #
+# This should be the last code in here, please add all functions above!! #
+# #
+# *** START LAST CODE *** #
+# #
+##############################################################################
+
+if [ -z "${EBUILD}" ] ; then
+ # Setup a basic $PATH. Just add system default to existing.
+ # This should solve both /sbin and /usr/sbin not present when
+ # doing 'su -c foo', or for something like: PATH= rcscript start
+ PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/sbin:${PATH}"
+
+ # Cache the CONSOLETYPE - this is important as backgrounded shells don't
+ # have a TTY. rc unsets it at the end of running so it shouldn't hang
+ # around
+ if [[ -z ${CONSOLETYPE} ]]; then
+ export CONSOLETYPE=$( /sbin/consoletype 2>/dev/null )
+ fi
+ if [[ ${CONSOLETYPE} == "serial" ]] ; then
+ RC_NOCOLOR="yes"
+ RC_ENDCOL="no"
+ fi
+
+ for arg in "$@" ; do
+ case "${arg}" in
+ # Lastly check if the user disabled it with --nocolor argument
+ --nocolor|-nc)
+ RC_NOCOLOR="yes"
+ ;;
+ esac
+ done
+
+ if [ -r "/proc/cmdline" ] ; then
+ setup_defaultlevels
+ fi
+else
+ # Should we use colors ?
+ if [[ $* != *depend* ]]; then
+ # Check user pref in portage
+ RC_NOCOLOR="$(portageq envvar NOCOLOR 2>/dev/null)"
+ [ "${RC_NOCOLOR}" = "true" ] && RC_NOCOLOR="yes"
+ else
+ # We do not want colors during emerge depend
+ RC_NOCOLOR="yes"
+ # No output is seen during emerge depend, so this is not needed.
+ RC_ENDCOL="no"
+ fi
+fi
+
+if [[ -n ${EBUILD} && $* = *depend* ]]; then
+ # We do not want stty to run during emerge depend
+ COLS=80
+else
+ # Setup COLS and ENDCOL so eend can line up the [ ok ]
+ COLS=${COLUMNS:-0} # bash's internal COLUMNS variable
+ (( COLS == 0 )) && COLS=$(stty size 2>/dev/null | cut -d' ' -f2)
+ (( COLS > 0 )) || (( COLS = 80 )) # width of [ ok ] == 7
+fi
+
+if [[ ${RC_ENDCOL} == yes ]]; then
+ ENDCOL=$'\e[A\e['$(( COLS - 8 ))'C'
+else
+ ENDCOL=''
+fi
+
+# Setup the colors so our messages all look pretty
+if [[ ${RC_NOCOLOR} == yes ]]; then
+ unset GOOD WARN BAD NORMAL HILITE BRACKET
+else
+ GOOD=$'\e[32;01m'
+ WARN=$'\e[33;01m'
+ BAD=$'\e[31;01m'
+ NORMAL=$'\e[0m'
+ HILITE=$'\e[36;01m'
+ BRACKET=$'\e[34;01m'
+fi
+
+##############################################################################
+# #
+# *** END LAST CODE *** #
+# #
+# This should be the last code in here, please add all functions above!! #
+# #
+##############################################################################
+
+
+# vim:ts=4
diff --git a/sbin/modules-update b/sbin/modules-update
new file mode 100755
index 0000000..77c25be
--- /dev/null
+++ b/sbin/modules-update
@@ -0,0 +1,240 @@
+#!/bin/bash
+#
+# This is the modules-update script for Debian GNU/Linux.
+# Written by Wichert Akkerman <wakkerma@debian.org>
+# Copyright (C) 1998, 1999 Software in the Public Interest
+#
+# Modifications by Daniel Robbins <drobbins@gentoo.org>, Gentoo Foundation
+# 02 Sep 2001 -- Removed "arch" stuff since I see no reason to have
+# support for varying CPU architectures on a single system.
+#
+# Updated by Aron Griffis <agriffis@gentoo.org>
+# 05 May 2004 -- handle --assume-kernel argument for livecd building
+
+if [[ 0 -ne $(id -u) ]] ; then
+ echo "You have to be root to do this."
+ exit 2
+fi
+
+CFGFILE="/etc/modules.conf"
+TMPFILE="${CFGFILE}.$$"
+CFGFILE2="/etc/modprobe.conf"
+TMPFILE2="${CFGFILE2}.$$"
+TMPFILE2B="${CFGFILE2}B.$$"
+CFGFILE3="/etc/modules.devfs"
+TMPFILE3="${CFGFILE3}.$$"
+CFGFILE4="/etc/modprobe.devfs"
+TMPFILE4="${CFGFILE4}.$$"
+MODDIR="/etc/modules.d"
+ARCHDIR="${MODDIR}/arch"
+HEADER="### This file is automatically generated by modules-update"
+FULLHEADER="${HEADER}
+#
+# Please do not edit this file directly. If you want to change or add