diff options
author | Benedikt Boehm <hollow@gentoo.org> | 2006-06-22 06:36:41 +0000 |
---|---|---|
committer | Benedikt Boehm <hollow@gentoo.org> | 2006-06-22 06:36:41 +0000 |
commit | 210432b9aab1a98312bb31b4c7f9eaba93724e9e (patch) | |
tree | 3398b67c3c766b8a51fa12fe8c2e8476d98b6ab7 | |
parent | Removing the last .cvsignore (diff) | |
download | baselayout-vserver-210432b9aab1a98312bb31b4c7f9eaba93724e9e.tar.gz baselayout-vserver-210432b9aab1a98312bb31b4c7f9eaba93724e9e.tar.bz2 baselayout-vserver-210432b9aab1a98312bb31b4c7f9eaba93724e9e.zip |
first part of baselayout cleanup
svn path=/baselayout-vserver/branches/baselayout-1_12/; revision=384
72 files changed, 1401 insertions, 1090 deletions
@@ -1,18 +1,47 @@ # ChangeLog for Gentoo System Intialization ("rc") scripts # Copyright 1999-2006 Gentoo Foundation; Distributed under the GPLv2 - 12 June 2006; Roy Marples <uberlord@gentoo.org>: + 19 Jun 2006; Roy Marples <uberlord@gentoo.org>: + + Preliminary support for dscape ieee80211 stack devices. + + 18 Jun 2006; Roy Marples <uberlord@gentoo.org>: + + vlan id's can now be treated as individual interfaces via init scripts + provided they depend on the real interface, #137029 + + 15 Jun 2006; Roy Marples <uberlord@gentoo.org>: + + runscript.sh now supports the --verbose flag setting RC_VERBOSE="yes" + When RC_VERBOSE="yes" and RC_PARALLEL_STARTUP="yes" and there is no + exclusive lock (ie, init script not started via rc) then we don't hide + init script output by setting RC_QUIET_STDOUT, #136034. + + 14 Jun 2006; Roy Marples <uberlord@gentoo.org>: + + {start,stop}_volumes moved to rc and halt.sh respectively. + + net services are now depended upon more correctly. + + wireless cards now get their txpower set to auto before starting. + + Fix "before net" dependencies, #135872 thanks to Oldrich Jedlicka. + + pppd.sh now uses passwordfd instead of very nasty regex stuff, + thanks to Oldrich Jedlicka, Alin Nastac and me :), #134337 + + 12 Jun 2006; Roy Marples <uberlord@gentoo.org>: We now have a Makefile to install our scripts. - 06 June 2006; Roy Marples <uberlord@gentoo.org>: + 06 Jun 2006; Roy Marples <uberlord@gentoo.org>: shutdown.sh now uses the INIT_HALT variable correctly, #135740 thanks to Steve Moerk. * baselayout-1.12.1 (05 Jun 2006) - 05 June 2006; Roy Marples <uberlord@gentoo.org>: + 05 Jun 2006; Roy Marples <uberlord@gentoo.org>: Restore the man user/group, #113298 thanks to Chris Gianelloni. @@ -28,7 +57,7 @@ Ensure that an empty NET_FS_LIST doesn't cause localmount to error, #132928 thanks to Dominik Buerkle. - 02 June 2006; Roy Marples <uberlord@gentoo.org>: + 02 Jun 2006; Roy Marples <uberlord@gentoo.org>: Allow LC_* and LANG vars through to runscript.sh by default. diff --git a/ChangeLog.vserver b/ChangeLog.vserver deleted file mode 100644 index fcba82d..0000000 --- a/ChangeLog.vserver +++ /dev/null @@ -1,574 +0,0 @@ -# ChangeLog for Gentoo System Intialization ("rc") scripts -# Copyright 1999-2006 Gentoo Foundation; Distributed under the GPLv2 - - 05 Jun 2006; Christian Heim <phreak@gentoo.org>: - Merging latest changes to the baselayout-1_12 branch. This merge is based - upon revision 2079. - - 25 May 2006; Christian Heim <phreak@gentoo.org>: - Merging latest changes to the baselayout-1_12 branch. This merge is based - upon revision 2046. - - 24 May 2006; Christian Heim <phreak@gentoo.org>: - Merging latest changes to the baselayout-1_12 branch. This merge is based - upon revision 2045. - - This is finally baselayout-vserver-1.12.0 ! - - 23 May 2006; Christian Heim <phreak@gentoo.org>: - Merging latest changes to the baselayout-1_12 branch. This merge is based - upon revision 2042. - - 02 May 2006; Christian Heim <phreak@gentoo.org>: - Merging latest changes to the baselayout-1_12 branch. This merge is based - upon revision 2022. - - 21 Apr 2006; Christian Heim <phreak@gentoo.org>: - Merging latest changes to the baselayout-1_12 branch. This merge is based - upon revision 2014. Preparing baselayout-vserver-1.12.0_pre18! - - 08 Apr 2006; Christian Heim <phreak@gentoo.org>: - Merging latest changes to the baselayout-1_12 branch. This merge is based - upon revision 1965. Preparing baselayout-vserver-1.12.0_pre17! - - ChangeLog | 11 +- - ChangeLog.vserver | 19 +++ - net-scripts/conf.d/net.example | 9 - - net-scripts/init.d/net.lo | 88 ++++++------------ - net-scripts/net.modules.d/bridge.sh | 2 - net-scripts/net.modules.d/iptunnel.sh | 3 - net-scripts/net.modules.d/iwconfig.sh | 3 - net-scripts/net.modules.d/tuntap.sh | 4 - net-scripts/net.modules.d/udhcpc.sh | 5 - - net-scripts/net.modules.d/wpa_supplicant.sh | 2 - sbin/rc | 8 - - sbin/runscript.sh | 11 +- - tarball.sh | 2 - 13 files changed, 87 insertions(+), 80 deletions(-) - - 07 Apr 2006; Christian Heim <phreak@gentoo.org>: - Merging latest changes to the baselayout-1_12 branch. This merge is based - upon revision 1959. - - ChangeLog | 42 - ChangeLog.vserver | 44 - bin/rc-status | 7 - init.d/bootmisc | 7 - init.d/hostname | 32 - net-scripts/conf.d/net.example | 8 - net-scripts/init.d/net.lo | 287 +++-- - net-scripts/net.modules.d/adsl | 93 - - net-scripts/net.modules.d/adsl.sh | 93 + - net-scripts/net.modules.d/apipa | 46 - net-scripts/net.modules.d/apipa.sh | 46 - net-scripts/net.modules.d/arping | 109 -- - net-scripts/net.modules.d/arping.sh | 109 ++ - net-scripts/net.modules.d/bonding | 120 -- - net-scripts/net.modules.d/bonding.sh | 120 ++ - net-scripts/net.modules.d/bridge | 198 --- - net-scripts/net.modules.d/bridge.sh | 198 +++ - net-scripts/net.modules.d/dhclient | 150 -- - net-scripts/net.modules.d/dhclient.sh | 150 ++ - net-scripts/net.modules.d/dhcpcd | 123 -- - net-scripts/net.modules.d/dhcpcd.sh | 123 ++ - net-scripts/net.modules.d/essidnet | 49 - net-scripts/net.modules.d/essidnet.sh | 49 - net-scripts/net.modules.d/ifconfig | 454 -------- - net-scripts/net.modules.d/ifconfig.sh | 454 ++++++++ - net-scripts/net.modules.d/ifplugd | 146 -- - net-scripts/net.modules.d/ifplugd.sh | 146 ++ - net-scripts/net.modules.d/ip6to4 | 97 - - net-scripts/net.modules.d/ip6to4.sh | 97 + - net-scripts/net.modules.d/ipppd | 72 - - net-scripts/net.modules.d/ipppd.sh | 72 + - net-scripts/net.modules.d/iproute2 | 392 ------- - net-scripts/net.modules.d/iproute2.sh | 392 +++++++ - net-scripts/net.modules.d/iptunnel | 52 - net-scripts/net.modules.d/iptunnel.sh | 52 - net-scripts/net.modules.d/iwconfig | 943 ------------------ - net-scripts/net.modules.d/iwconfig.sh | 943 ++++++++++++++++++ - net-scripts/net.modules.d/macchanger | 102 - - net-scripts/net.modules.d/macchanger.sh | 102 + - net-scripts/net.modules.d/macnet | 43 - net-scripts/net.modules.d/macnet.sh | 43 - net-scripts/net.modules.d/netplugd | 124 -- - net-scripts/net.modules.d/netplugd.sh | 124 ++ - net-scripts/net.modules.d/pppd | 279 ----- - net-scripts/net.modules.d/pppd.sh | 279 +++++ - net-scripts/net.modules.d/pump | 105 -- - net-scripts/net.modules.d/pump.sh | 105 ++ - net-scripts/net.modules.d/rename | 63 - - net-scripts/net.modules.d/rename.sh | 63 + - net-scripts/net.modules.d/system | 155 -- - net-scripts/net.modules.d/system.sh | 155 ++ - net-scripts/net.modules.d/tuntap | 103 - - net-scripts/net.modules.d/tuntap.sh | 103 + - net-scripts/net.modules.d/udhcpc | 117 -- - net-scripts/net.modules.d/udhcpc.sh | 117 ++ - net-scripts/net.modules.d/vlan | 154 -- - net-scripts/net.modules.d/vlan.sh | 154 ++ - net-scripts/net.modules.d/wpa_supplicant | 368 ------- - net-scripts/net.modules.d/wpa_supplicant.sh | 368 +++++++ - sbin/functions.sh | 48 - sbin/rc | 10 - sbin/rc-daemon.sh | 2 - sbin/rc-services.sh | 31 - sbin/runscript.sh | 163 +-- - 64 files changed, 5114 insertions(+), 4881 deletions(-) - - 17 Mar 2006; Christian Heim <phreak@gentoo.org>: - Merging latest changes to the baselayout-1_12 branch. This merge is based - upon revision 1948. - - ChangeLog | 15 +++++++++ - ChangeLog.vserver | 13 ++++++++ - net-scripts/init.d/net.lo | 2 + - net-scripts/net.modules.d/iwconfig | 29 ++++++++++++++++-- - sbin/rc-daemon.sh | 2 - - sbin/rc-services.sh | 2 - - sbin/runscript.sh | 10 ++++-- - 7 files changed, 66 insertions(+), 7 deletions(-) - - 11 Mar 2006; Christian Heim <phreak@gentoo.org>: - Merging latest changes to the baselayout-1_12 branch. This merge is based - upon revision 1943. - - ChangeLog | 11 ++- - ChangeLog.vserver | 44 +++++++++++++ - net-scripts/init.d/net.lo | 5 + - net-scripts/net.modules.d/adsl | 4 - - net-scripts/net.modules.d/apipa | 5 - - net-scripts/net.modules.d/arping | 4 - - net-scripts/net.modules.d/bonding | 10 ++- - net-scripts/net.modules.d/bridge | 10 ++- - net-scripts/net.modules.d/dhclient | 10 ++- - net-scripts/net.modules.d/dhcpcd | 9 ++ - net-scripts/net.modules.d/essidnet | 4 - - net-scripts/net.modules.d/helpers.d/dhclient-wrapper | 11 +-- - net-scripts/net.modules.d/helpers.d/dhcp | 34 +++++----- - net-scripts/net.modules.d/helpers.d/dhcp-state | 20 +++--- - net-scripts/net.modules.d/helpers.d/dhcpcd-wrapper | 14 ++-- - net-scripts/net.modules.d/helpers.d/functions | 4 - - net-scripts/net.modules.d/helpers.d/module-loader | 34 +++------- - net-scripts/net.modules.d/helpers.d/pppd-wrapper | 10 +-- - net-scripts/net.modules.d/helpers.d/pump-wrapper | 14 ++-- - net-scripts/net.modules.d/helpers.d/udhcpc-wrapper | 9 +- - net-scripts/net.modules.d/ifconfig | 12 ++- - net-scripts/net.modules.d/ifplugd | 13 ++-- - net-scripts/net.modules.d/ip6to4 | 7 ++ - net-scripts/net.modules.d/ipppd | 3 - net-scripts/net.modules.d/iproute2 | 13 ++-- - net-scripts/net.modules.d/iptunnel | 12 ++- - net-scripts/net.modules.d/iwconfig | 58 ++++++++---------- - net-scripts/net.modules.d/macchanger | 12 ++- - net-scripts/net.modules.d/macnet | 6 - - net-scripts/net.modules.d/netplugd | 13 ++-- - net-scripts/net.modules.d/pppd | 5 - - net-scripts/net.modules.d/pump | 12 ++- - net-scripts/net.modules.d/rename | 12 ++- - net-scripts/net.modules.d/system | 12 ++- - net-scripts/net.modules.d/tuntap | 12 ++- - net-scripts/net.modules.d/udhcpc | 12 ++- - net-scripts/net.modules.d/vlan | 14 ++-- - net-scripts/net.modules.d/wpa_supplicant | 11 ++- - 38 files changed, 312 insertions(+), 193 deletions(-) - - 09 Mar 2006; Christian Heim <phreak@gentoo.org>: - Merging latest changes to the baselayout-1_12 branch. This merge is based - upon revision 1939. - - ChangeLog | 19 + - ChangeLog.vserver | 21 + - bin/rc-status | 2 - net-scripts/init.d/net.lo | 4 - net-scripts/net.modules.d/iwconfig | 16 + - sbin/depscan.sh | 71 +++--- - sbin/env-update.sh | 10 - sbin/functions.sh | 88 ++++--- - sbin/rc | 26 +- - sbin/rc-daemon.sh | 8 - sbin/rc-help.sh | 10 - sbin/rc-services.sh | 25 +- - sbin/runscript.sh | 211 ++++++++---------- - src/awk/cachedepends.awk | 18 - - src/awk/gendepends.awk | 12 - - 15 files changed, 303 insertions(+), 238 deletions(-) - - 27 Feb 2006; Christian Heim <phreak@gentoo.org>: - Merging latest changes to the baselayout-1_12 branch. This merge is based - upon revision 1928. - - ChangeLog | 16 ++ - ChangeLog.vserver | 41 +++++ - net-scripts/conf.d/net.example | 22 -- - net-scripts/init.d/net.lo | 2 - net-scripts/net.modules.d/adsl | 2 - net-scripts/net.modules.d/arping | 12 - - net-scripts/net.modules.d/bonding | 7 - net-scripts/net.modules.d/bridge | 38 ++--- - net-scripts/net.modules.d/dhclient | 103 ++++++------- - net-scripts/net.modules.d/dhcpcd | 31 +--- - net-scripts/net.modules.d/essidnet | 10 - - net-scripts/net.modules.d/helpers.d/dhclient-wrapper | 2 - net-scripts/net.modules.d/helpers.d/dhcp | 32 +--- - net-scripts/net.modules.d/helpers.d/dhcp-state | 10 - - net-scripts/net.modules.d/helpers.d/dhcpcd-wrapper | 14 - - net-scripts/net.modules.d/helpers.d/functions | 134 ++++++------------ - net-scripts/net.modules.d/helpers.d/module-loader | 14 - - net-scripts/net.modules.d/helpers.d/pppd-wrapper | 12 - - net-scripts/net.modules.d/helpers.d/pump-wrapper | 4 - net-scripts/net.modules.d/helpers.d/udhcpc-wrapper | 6 - net-scripts/net.modules.d/ifconfig | 30 ++-- - net-scripts/net.modules.d/ifplugd | 20 +- - net-scripts/net.modules.d/ipppd | 16 -- - net-scripts/net.modules.d/iptunnel | 6 - net-scripts/net.modules.d/iwconfig | 10 + - net-scripts/net.modules.d/macchanger | 22 +- - net-scripts/net.modules.d/macnet | 2 - net-scripts/net.modules.d/netplugd | 12 - - net-scripts/net.modules.d/pppd | 14 - - net-scripts/net.modules.d/pump | 4 - net-scripts/net.modules.d/rename | 2 - net-scripts/net.modules.d/system | 40 +++-- - net-scripts/net.modules.d/udhcpc | 31 +--- - net-scripts/net.modules.d/vlan | 18 +- - net-scripts/net.modules.d/wpa_supplicant | 36 ++-- - 35 files changed, 388 insertions(+), 387 deletions(-) - - 23 Feb 2006; Christian Heim <phreak@gentoo.org>: - Merging latest changes to the baselayout-1_12 branch. This merge is based - upon revision 1924. - - ChangeLog | 5 - ChangeLog.vserver | 15 + - net-scripts/conf.d/net.example | 2 - net-scripts/net.modules.d/ifplugd | 5 - net-scripts/net.modules.d/netplugd | 5 - net-scripts/net.modules.d/wpa_supplicant | 4 - sbin/functions.sh | 2 - sbin/rc-update | 190 ++++++++++++------ - tarball.sh | 2 - 9 files changed, 165 insertions(+), 65 deletions(-) - - 18 Feb 2006; Christian Heim <phreak@gentoo.org>: - Merging latest changes to the baselayout-1_12 branch. This merge is based - upon revision 1911. - - ChangeLog | 4 ++++ - ChangeLog.vserver | 10 ++++++++++ - net-scripts/net.modules.d/helpers.d/functions | 2 +- - tarball.sh | 2 +- - 4 files changed, 16 insertions(+), 2 deletions(-) - - 17 Feb 2006; Christian Heim <phreak@gentoo.org>: - Merging latest changes to the baselayout-1_12 branch. This merge is based - upon revision 1909. - - ChangeLog | 17 ++++- - ChangeLog.vserver | 15 ++++ - net-scripts/conf.d/net.example | 55 ++++++++++++++---- - net-scripts/net.modules.d/helpers.d/dhcp | 4 - - net-scripts/net.modules.d/helpers.d/functions | 4 - - net-scripts/net.modules.d/iproute2 | 28 --------- - net-scripts/net.modules.d/pppd | 8 +- - net-scripts/net.modules.d/tuntap | 43 +++++++------- - sbin/rc-daemon.sh | 6 - - 9 files changed, 108 insertions(+), 72 deletions(-) - - 14 Feb 2006; Christian Heim <phreak@gentoo.org>: - Merging latest changes to the baselayout-1_12 branch. This merge is based - upon revision 1881. - - ChangeLog | 27 +++ - ChangeLog.vserver | 28 +++ - etc/group | 4 - etc/passwd | 3 - etc/shadow | 2 - net-scripts/conf.d/net.example | 25 ++ - net-scripts/init.d/net.lo | 124 +++++++------- - net-scripts/net.modules.d/bonding | 3 - net-scripts/net.modules.d/bridge | 3 - net-scripts/net.modules.d/dhcpcd | 10 - - net-scripts/net.modules.d/essidnet | 2 - net-scripts/net.modules.d/ifconfig | 4 - net-scripts/net.modules.d/ip6to4 | 90 ++++++++++ - net-scripts/net.modules.d/iproute2 | 152 +++++++++++------- - net-scripts/net.modules.d/iptunnel | 4 - net-scripts/net.modules.d/iwconfig | 89 +++++----- - net-scripts/net.modules.d/macnet | 2 - net-scripts/net.modules.d/pppd | 64 +++---- - net-scripts/net.modules.d/tuntap | 3 - net-scripts/net.modules.d/wpa_supplicant | 51 +++--- - sbin/rc-services.sh | 6 - sbin/runscript.sh | 6 - 22 files changed, 448 insertions(+), 254 deletions(-) - - 06 Feb 2006; Christian Heim <phreak@gentoo.org>: - Merging latest changes to the baselayout-1_12 branch. This merge is based - upon revision 1851. - - ChangeLog | 17 ++++++++++ - ChangeLog.vserver | 14 +++++++++ - etc/conf.d/rc | 21 +++++++++---- - etc/services | 2 - - net-scripts/net.modules.d/iwconfig | 12 ++++--- - sbin/rc | 19 ++++++++++++ - sbin/rc-daemon.sh | 5 +-- - sbin/runscript.sh | 28 ++++++++++++------ - 8 files changed, 95 insertions(+), 23 deletions(-) - - 20 Jan 2006; Christian Heim <phreak@gentoo.org>: - Merging latest changes to the baselayout-1_12 branch. This merge is based - upon revision 1836. - - ChangeLog | 18 ++++++++++++------ - ChangeLog.vserver | 12 ++++++++++++ - net-scripts/net.modules.d/iwconfig | 2 +- - sbin/rc-daemon.sh | 4 ++-- - sbin/runscript.sh | 16 +++++++++++++--- - tarball.sh | 2 +- - 6 files changed, 41 insertions(+), 13 deletions(-) - - 19 Jan 2006;Christian Heim <phreak@gentoo.org>: - Merging latest changes to the baselayout-1_12 branch. This merge is based - upon revision 1832. - - ChangeLog | 10 - ChangeLog.vserver | 14 + - net-scripts/init.d/net.lo | 29 +- - net-scripts/net.modules.d/ifconfig | 8 - net-scripts/net.modules.d/iproute2 | 9 - sbin/depscan.sh | 6 - sbin/rc-services.sh | 47 ++-- - sbin/runscript.sh | 203 +++++++----------- - 8 files changed, 173 insertions(+), 153 deletions(-) - - 17 Jan 2006; Christian Heim <phreak@gentoo.org>: - Merging latest changes to the baselayout-1_12 branch. This merge is based - upon revision 1828. - - ChangeLog | 13 +++ - ChangeLog.vserver | 12 +++ - net-scripts/init.d/net.lo | 9 +- - sbin/depscan.sh | 2 - sbin/rc-services.sh | 16 +++- - sbin/runscript.sh | 59 +++++++++--------- - 6 files changed, 70 insertions(+), 41 deletions(-) - - 15 Jan 2006; Christian Heim <phreak@gentoo.org>: - Merging latest changes to the baselayout-1_12 branch. This merge is based - upon revision 1822. - - ChangeLog | 24 + - ChangeLog.vserver | 20 + - bin/rc-status | 3 - net-scripts/init.d/net.lo | 9 - net-scripts/net.modules.d/bonding | 4 - net-scripts/net.modules.d/bridge | 4 - net-scripts/net.modules.d/helpers.d/functions | 6 - net-scripts/net.modules.d/ifconfig | 7 - net-scripts/net.modules.d/iproute2 | 5 - sbin/functions.sh | 2 - sbin/rc | 4 - sbin/rc-daemon.sh | 26 - - sbin/rc-services.sh | 27 - - sbin/runscript.sh | 258 ++++++++++-------- - 14 files changed, 242 insertions(+), 157 deletions(-) - - 11 Jan 2006; Christian Heim <phreak@gentoo.org>: - Merging latest changes to the baselayout-1_12 branch. This merge is based - upon revision 1802. - - ChangeLog | 10 + - ChangeLog.vserver | 15 ++ - etc/conf.d/rc | 14 - - net-scripts/init.d/net.lo | 2 - net-scripts/net.modules.d/bonding | 16 +- - sbin/rc-daemon.sh | 9 + - sbin/rc-services.sh | 6 - sbin/runscript.sh | 133 ++++++++++++------ - 8 files changed, 152 insertions(+), 53 deletions(-) - - 10 Jan 2006; Christian Heim <phreak@gentoo.org>: - Merging latest changes to the baselayout-1_12 branch. This merge is based - upon revision 1799. - - ChangeLog | 40 ++ - ChangeLog.vserver | 19 + - bin/rc-status | 8 - net-scripts/conf.d/wireless.example | 15 - net-scripts/net.modules.d/bonding | 8 - net-scripts/net.modules.d/helpers.d/module-loader | 4 - net-scripts/net.modules.d/iwconfig | 48 +-- - net-scripts/net.modules.d/wpa_supplicant | 4 - sbin/depscan.sh | 4 - sbin/functions.sh | 8 - sbin/rc | 21 - - sbin/rc-services.sh | 50 +-- - sbin/runscript.sh | 274 ++++++++---------- - 13 files changed, 285 insertions(+), 215 deletions(-) - - 06 Jan 2006; Christian Heim <phreak@gentoo.org>: - Merging latest changes to the baselayout-1_12 branch. This merge is based - upon revision 1792. - - ChangeLog | 23 +++++++- - ChangeLog.vserver | 51 +++++++++++++++++- - etc/profile | 14 ++-- - init.d/bootmisc | 2 - init.d/domainname | 4 - - init.d/halt.sh | 2 - init.d/hostname | 2 - init.d/local | 2 - init.d/reboot.sh | 2 - init.d/rmnologin | 2 - init.d/shutdown.sh | 2 - net-scripts/conf.d/net.example | 4 - - net-scripts/init.d/net.lo | 14 ++-- - net-scripts/net.modules.d/adsl | 2 - net-scripts/net.modules.d/apipa | 2 - net-scripts/net.modules.d/arping | 2 - net-scripts/net.modules.d/bonding | 2 - net-scripts/net.modules.d/bridge | 10 ++- - net-scripts/net.modules.d/dhclient | 2 - net-scripts/net.modules.d/dhcpcd | 2 - net-scripts/net.modules.d/essidnet | 4 - - net-scripts/net.modules.d/helpers.d/dhclient-wrapper | 5 + - net-scripts/net.modules.d/helpers.d/dhcp | 2 - net-scripts/net.modules.d/helpers.d/dhcp-state | 2 - net-scripts/net.modules.d/helpers.d/dhcpcd-wrapper | 2 - net-scripts/net.modules.d/helpers.d/functions | 4 - - net-scripts/net.modules.d/helpers.d/module-loader | 2 - net-scripts/net.modules.d/helpers.d/pppd-wrapper | 2 - net-scripts/net.modules.d/helpers.d/pump-wrapper | 2 - net-scripts/net.modules.d/helpers.d/udhcpc-wrapper | 2 - net-scripts/net.modules.d/iproute2 | 1 - net-scripts/net.modules.d/wpa_supplicant | 10 ++- - sbin/functions.sh | 2 - sbin/rc | 4 - - sbin/rc-daemon.sh | 12 ++-- - sbin/rc-help.sh | 4 - - sbin/rc-update | 2 - sbin/runscript.sh | 2 - src/Makefile | 2 - src/awk/genenviron.awk | 2 - src/core/ChangeLog | 2 - 41 files changed, 147 insertions(+), 69 deletions(-) - - 22 Dec 2005; Christian Heim <phreak@gentoo.org>: - Merging latest changes to the baselayout branch. This merge is based - upon revision 1768. - - ChangeLog | 22 +++++++ - ChangeLog.vserver | 19 ++++++ - etc/conf.d/rc | 6 ++ - etc/profile | 14 ++--- - net-scripts/conf.d/net.example | 46 +++++++++++----- - net-scripts/init.d/net.lo | 9 ++- - net-scripts/net.modules.d/dhclient | 7 -- - net-scripts/net.modules.d/dhcpcd | 3 - - net-scripts/net.modules.d/helpers.d/dhcp | 13 ---- - net-scripts/net.modules.d/helpers.d/dhcp-state | 2 - net-scripts/net.modules.d/iwconfig | 50 +++++------------- - net-scripts/net.modules.d/udhcpc | 3 - - sbin/functions.sh | 1 - 13 files changed, 98 insertions(+), 82 deletions(-) - - 09 Dec 2005; Christian Heim <phreak@gentoo.org>: - Merging latest changes to the baselayout branch. This merge is based - upon revision 1753. - - ChangeLog | 5 ++++ - ChangeLog.vserver | 16 +++++++++++++ - net-scripts/init.d/net.lo | 9 ------- - net-scripts/net.modules.d/dhclient | 8 ------ - net-scripts/net.modules.d/dhcpcd | 7 ------ - net-scripts/net.modules.d/helpers.d/dhcp-state | 4 --- - net-scripts/net.modules.d/iwconfig | 11 --------- - net-scripts/net.modules.d/pump | 7 ------ - net-scripts/net.modules.d/udhcpc | 7 ------ - net-scripts/net.modules.d/wpa_supplicant | 21 +++--------------- - 10 files changed, 26 insertions(+), 69 deletions(-) - - 06 Dec 2005; Christian Heim <phreak@gentoo.org>: - Merging latest changes to the baselayout branch. This merge is based - upon revision 1733. - - ChangeLog | 8 ++++++++ - ChangeLog.vserver | 14 ++++++++++++++ - net-scripts/conf.d/net.example | 5 ++++- - net-scripts/net.modules.d/dhclient | 10 +++++++--- - net-scripts/net.modules.d/dhcpcd | 18 +++++++++++------- - net-scripts/net.modules.d/helpers.d/dhcp | 11 +++++++---- - net-scripts/net.modules.d/helpers.d/dhcpcd-wrapper | 4 +++- - net-scripts/net.modules.d/pump | 9 +++++---- - net-scripts/net.modules.d/udhcpc | 8 ++++++-- - 9 files changed, 65 insertions(+), 22 deletions(-) - - 03 Dec 2005; Christian Heim <phreak@gentoo.org>: - Readding check_statedir and the corresponding calls. Also adding net.lo - which seems to be missing from my previous commit. - - Files changed: - ChangeLog.vserver | 9 - net-scripts/init.d/net.lo | 982 ++++++++++++++++++ - sbin/rc | 28 - 3 files changed, 1019 insertions(+) - - 02 Dec 2005; Christian Heim <phreak@gentoo.org>: - Starting over again with baselayout revision 1649. - - Files changed: - ChangeLog.vserver | 60 ++++ - bin/rc-status | 6 - etc/conf.d/clock | 27 - - etc/conf.d/consolefont | 16 - - etc/conf.d/keymaps | 26 - - etc/conf.d/rc | 84 ------ - etc/filesystems | 14 - - etc/fstab | 30 -- - etc/inittab | 25 + - etc/issue | 3 - etc/issue.devfix | 21 - - etc/issue.logo | 13 - etc/modules.autoload.d/kernel-2.4 | 11 - etc/modules.autoload.d/kernel-2.6 | 10 - etc/modules.d/aliases | 46 --- - etc/modules.d/i386 | 4 - etc/sysctl.conf | 52 --- - init.d/bootmisc | 60 +--- - init.d/checkfs | 54 --- - init.d/checkroot | 124 --------- - init.d/clock | 144 ---------- - init.d/consolefont | 68 ----- - init.d/domainname | 2 - init.d/dummy | 13 - init.d/halt.sh | 181 ------------- - init.d/hostname | 4 - init.d/keymaps | 79 ----- - init.d/localmount | 47 --- - init.d/modules | 122 --------- - init.d/netmount | 106 ------- - init.d/numlock | 34 -- - init.d/reboot.sh | 2 - init.d/rmnologin | 4 - init.d/shutdown.sh | 2 - init.d/urandom | 37 -- - mkrelease.sh | 62 ++++ - man/modules-update.8 | 51 --- - man/modules.autoload.5 | 19 - - rc-lists/boot | 9 - rc-lists/default | 2 - rc-lists/nonetwork | 1 - sbin/MAKEDEV | 16 + - sbin/MAKEDEV-gentoo.patch | 109 -------- - sbin/functions.sh | 131 --------- - sbin/modules-update | 239 ----------------- - sbin/rc | 515 +------------------------------------- - sbin/rc-services.sh | 10 - sbin/runscript.sh | 3 - src/.cvsignore | 5 - tarball.sh | 48 --- - 50 files changed, 241 insertions(+), 2510 deletions(-) - -# vim: filetype=gentoo-changelog expandtab softtabstop=4 tabstop=4 shiftwidth=4 : @@ -156,7 +156,7 @@ install: for x in `ls src/awk` ; do \ install -m 0644 "src/awk/$$x" $(AWKDIR) ; \ if test $(LIB) != "lib" ; then \ - sed -i -e 's:/lib/rcscripts:/$(LIB)/rcscripts:' $(AWKDIR)/$$x ; \ + sed -i -e 's:/lib/rcscripts:/'$(LIB)'/rcscripts:' $(AWKDIR)/$$x ; \ fi ; \ done # init.d @@ -250,7 +250,7 @@ distforce: install -d /tmp/$(PKG) cp -axr . /tmp/$(PKG) cd /tmp/$(PKG) ; \ - rm -rf *.sh rc-lists `find . -iname .svn` `find . -iname .cvs*` sbin/MAKEDEV-gentoo.patch ; \ + rm -rf *.sh rc-lists `find . -iname .svn` sbin/MAKEDEV-gentoo.patch ; \ cd .. ; \ tar -cvjpf $(PKG).tar.bz2 $(PKG) rm -rf /tmp/$(PKG) diff --git a/etc/conf.d/clock b/etc/conf.d/clock new file mode 100644 index 0000000..2cb04c0 --- /dev/null +++ b/etc/conf.d/clock @@ -0,0 +1,27 @@ +# /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". Note that if you dual boot with Windows, then +# you should set it 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/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/rc b/etc/conf.d/rc index dc18886..217562d 100644 --- a/etc/conf.d/rc +++ b/etc/conf.d/rc @@ -1,15 +1,20 @@ # /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=0 - # Set to "yes" if you want the rc system to try and start services -# in parallel for a slight speed improvement. +# in parallel for a slight speed improvement. NOTE: When RC_PARALLEL_STARTUP +# is enabled, init script output is replaced with simple "service foo +# starting/stopping" messages so that output is not mixed up. +# You can stop this from happening on the command line by passing --verbose +# to the init script or by setting RC_VERBOSE="yes" below. RC_PARALLEL_STARTUP="no" +# Set RC_INTERACTIVE to "yes" and you'll be able to press the I key during +# boot so you can choose to start specific services. Set to "no" to disable +# this feature. + +RC_INTERACTIVE="yes" + # Do we allow services to be hotplugged? If not, set to RC_HOTPLUG="no" # NOTE: This does not affect anything hotplug/udev related, just the # starting/stopping of the init.d service triggered by hotplug. @@ -49,18 +54,47 @@ RC_PLUG_SERVICES="" RC_NET_STRICT_CHECKING="none" -# RC_DOWN_INTERFACE allows you to specify if RC will bring the interface -# compeletly down when it stops. The default is yes, but there are some -# instances where you may not want this to happen such as using Wake On LAN. - -RC_DOWN_INTERFACE="yes" - # RC_VERBOSE will make init scripts more verbose. Only networking scripts # really use this at this time, and this is useful for trouble shooting # any issues you may have. +# This is also used to re-enable init script output for init scripts +# started or stopped from the command line. RC_VERBOSE="no" +# 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. Note that this probably +# won't work correctly with boot splash. + +RC_BOOTLOG="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" + + + + + # # Controlling start-stop-daemon behavior diff --git a/etc/filesystems b/etc/filesystems new file mode 100644 index 0000000..0bb9c3c --- /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 know what you are doing! +* diff --git a/etc/fstab b/etc/fstab new file mode 100644 index 0000000..2b3edf5 --- /dev/null +++ b/etc/fstab @@ -0,0 +1,27 @@ +# /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 + +# 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/inittab b/etc/inittab index 6f7795a..8cbe900 100644 --- a/etc/inittab +++ b/etc/inittab @@ -13,8 +13,8 @@ si::sysinit:/sbin/rc sysinit rc::bootwait:/sbin/rc boot l0:0:wait:/sbin/rc shutdown -l1:S1:wait:/sbin/rc default -l2:2:wait:/sbin/rc default +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 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 @@ +[0;35;40m . +[0;35;40m .vir. d$b +[0;35;40m .d$$$$$$b. .cd$$b. .d$$b. d$$$$$$$$$$$b .d$$b. .d$$b. +[0;35;40m $$$$( )$$$b d$$$()$$$. d$$$$$$$b Q$$$$$$$P$$$P.$$$$$$$b. .$$$$$$$b. +[0;35;40m Q$$$$$$$$$$B$$$$$$$$P" d$$$PQ$$$$b. $$$$. .$$$P' `$$$ .$$$P' `$$$ +[0;35;40m "$$$$$$$P Q$$$$$$$b d$$$P Q$$$$b $$$$b $$$$b..d$$$ $$$$b..d$$$ +[0;35;40m d$$$$$$P" "$$$$$$$$ Q$$$ Q$$$$ $$$$$ `Q$$$$$$$P `Q$$$$$$$P +[0;35;40m $$$$$$$P `""""" "" "" Q$$$P "Q$$$P" "Q$$$P" +[0;35;40m `Q$$P" """ +[0;37;40m + +This is \n.\O (\s \m \r) \t + diff --git a/etc/rc.conf b/etc/rc.conf index 3be0f86..b1c90e5 100644 --- a/etc/rc.conf +++ b/etc/rc.conf @@ -12,3 +12,28 @@ UNICODE="no" 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/sysctl.conf b/etc/sysctl.conf new file mode 100644 index 0000000..b3a209e --- /dev/null +++ b/etc/sysctl.conf @@ -0,0 +1,54 @@ +# /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 + +# Enable SYN cookies (yum!) +# http://cr.yp.to/syncookies.html +#net.ipv4.tcp_syncookies = 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 + +# You should compile nfsd into the kernel or add it +# to modules.autoload for this to work properly +# 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 index e14825b..652495b 100755 --- a/init.d/bootmisc +++ b/init.d/bootmisc @@ -3,7 +3,8 @@ # Distributed under the terms of the GNU General Public License v2 depend() { - use hostname + use clock hostname + need localmount before logger } @@ -19,7 +20,7 @@ start() { cp /etc/nologin /etc/nologin.boot &> /dev/null fi - if ! touch /var/run/.keep 2> /dev/null ; then + if [[ -z ${CDBOOT} ]] && ! touch /var/run/.keep 2> /dev/null ; then ewarn "Skipping /var and /tmp initialization (ro root?)" return 0 fi @@ -37,23 +38,25 @@ start() { ebegin "Cleaning /var/lock, /var/run" rm -rf /var/run/console.lock /var/run/console/* - # - # 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}" + 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 - fi - done + done + fi # Create the .keep to stop portage from removing /var/lock > /var/lock/.keep @@ -62,7 +65,7 @@ start() { # # Clean up /tmp directory # - if [[ -d /tmp ]] ; then + if [[ -z ${CDBOOT} ]] && [[ -d /tmp ]] ; then cd /tmp if [[ ${WIPE_TMP} == "yes" ]] ; then ebegin "Wiping /tmp directory" @@ -104,6 +107,13 @@ start() { 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 diff --git a/init.d/checkfs b/init.d/checkfs deleted file mode 120000 index 2995a4d..0000000 --- a/init.d/checkfs +++ /dev/null @@ -1 +0,0 @@ -dummy
\ No newline at end of file diff --git a/init.d/checkroot b/init.d/checkroot deleted file mode 120000 index 2995a4d..0000000 --- a/init.d/checkroot +++ /dev/null @@ -1 +0,0 @@ -dummy
\ No newline at end of file diff --git a/init.d/clock b/init.d/clock deleted file mode 120000 index 2995a4d..0000000 --- a/init.d/clock +++ /dev/null @@ -1 +0,0 @@ -dummy
\ No newline at end of file diff --git a/init.d/consolefont b/init.d/consolefont deleted file mode 120000 index 2995a4d..0000000 --- a/init.d/consolefont +++ /dev/null @@ -1 +0,0 @@ -dummy
\ No newline at end of file diff --git a/init.d/dummy b/init.d/dummy deleted file mode 100755 index de50a10..0000000 --- a/init.d/dummy +++ /dev/null @@ -1,13 +0,0 @@ -#!/sbin/runscript -# Copyright 1999-2005 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -start() { - return 0 -} - -stop() { - return 0 -} - -# vim:ts=4 diff --git a/init.d/hostname b/init.d/hostname index 0a9ec3a..deb3d7e 100755 --- a/init.d/hostname +++ b/init.d/hostname @@ -2,6 +2,10 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +depend() { + need checkroot +} + start() { if [[ -f /etc/hostname ]] ; then ewarn "You should stop using /etc/hostname and use /etc/conf.d/hostname" diff --git a/init.d/keymaps b/init.d/keymaps deleted file mode 120000 index 2995a4d..0000000 --- a/init.d/keymaps +++ /dev/null @@ -1 +0,0 @@ -dummy
\ No newline at end of file diff --git a/init.d/localmount b/init.d/localmount deleted file mode 120000 index 2995a4d..0000000 --- a/init.d/localmount +++ /dev/null @@ -1 +0,0 @@ -dummy
\ No newline at end of file diff --git a/init.d/modules b/init.d/modules deleted file mode 120000 index 2995a4d..0000000 --- a/init.d/modules +++ /dev/null @@ -1 +0,0 @@ -dummy
\ No newline at end of file diff --git a/init.d/netmount b/init.d/netmount deleted file mode 120000 index 2995a4d..0000000 --- a/init.d/netmount +++ /dev/null @@ -1 +0,0 @@ -dummy
\ No newline at end of file diff --git a/init.d/numlock b/init.d/numlock deleted file mode 120000 index 2995a4d..0000000 --- a/init.d/numlock +++ /dev/null @@ -1 +0,0 @@ -dummy
\ No newline at end of file diff --git a/init.d/reboot.sh b/init.d/reboot.sh index b1b7cb0..146ca5f 100755 --- a/init.d/reboot.sh +++ b/init.d/reboot.sh @@ -1,7 +1,7 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -/sbin/reboot -d +/sbin/reboot -dpk # hmm, if the above failed, that's kind of odd ... # so let's force a reboot diff --git a/init.d/rmnologin b/init.d/rmnologin index cad2245..0537b5f 100755 --- a/init.d/rmnologin +++ b/init.d/rmnologin @@ -2,6 +2,10 @@ # Copyright 1999-2006 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 diff --git a/init.d/shutdown.sh b/init.d/shutdown.sh index d3cde8f..bb9c458 100755 --- a/init.d/shutdown.sh +++ b/init.d/shutdown.sh @@ -1,7 +1,10 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -/sbin/halt -d +opts="-hd" +[[ ${INIT_HALT} != "HALT" ]] && opts="${opts}p" + +/sbin/halt "${opts}" # hmm, if the above failed, that's kind of odd ... # so let's force a halt diff --git a/init.d/urandom b/init.d/urandom deleted file mode 120000 index 2995a4d..0000000 --- a/init.d/urandom +++ /dev/null @@ -1 +0,0 @@ -dummy
\ No newline at end of file diff --git a/net-scripts/conf.d/net.example b/net-scripts/conf.d/net.example index 1366eea..3038451 100644 --- a/net-scripts/conf.d/net.example +++ b/net-scripts/conf.d/net.example @@ -340,7 +340,7 @@ # If you wish to control the configuration of each vlan through a seperate # script, or wish to rename the vlan interface to something that vconfig # cannot then you need to do this. -#vlan_start_eth0="no +#vlan_start_eth0="no" # If you do the above then you may want to depend on eth0 like so # depend_vlan1() { @@ -398,7 +398,6 @@ # against the specified username #username_ppp0='user' #password_ppp0='password' -# # NOTE: You can set a blank password like so #password_ppp0= # @@ -406,10 +405,12 @@ # and may seem daunting, it is recommended that you read the pppd man page # before enabling any of them #pppd_ppp0=( -# "updetach" # WARNING: If you don't specify this then we will -# # not wait for the actual PPP link to go up # "maxfail 0" # WARNING: It's not recommended you use change this # # if you don't specify maxfail then we assume 0 +# "updetach" # If not set, "/etc/init.d/net.ppp0 start" will return +# # immediately, without waiting the link to come up +# # for the first time. +# # Do not use it for dial-on-demand links! # "debug" # Enables syslog debugging # "noauth" # Do not require the peer to authenticate itself # "defaultroute" # Make this PPP interface the default route @@ -667,7 +668,7 @@ #modules_eth0=( "!plug" ) # To use specific ifplugd options, fex specifying wiress mode -#ifplugd_eth0="--api-mode wlan" +#ifplugd_eth0="--api-mode=wlan" # man ifplugd for more options ############################################################################## diff --git a/net-scripts/init.d/net.lo b/net-scripts/init.d/net.lo index 94b85bc..cab348d 100755 --- a/net-scripts/init.d/net.lo +++ b/net-scripts/init.d/net.lo @@ -84,8 +84,8 @@ calculate_metric() { local iface="$1" metric="$2" # Have we already got a metric? - local m="$( awk '$1=="'${iface}'" && $2=="00000000" { print $7 }' \ - /proc/net/route )" + local m=$(awk '$1=="'${iface}'" && $2=="00000000" { print $7 }' \ + /proc/net/route) if [[ -n ${m} ]] ; then echo "${m}" return 0 @@ -101,7 +101,7 @@ calculate_metric() { done < /proc/net/route # Now, sort our metrics - metrics="$(echo -e "${metrics}" | sort -n)" + metrics=$(echo -e "${metrics}" | sort -n) # Now, find the lowest we can use local gotbase=false @@ -118,7 +118,7 @@ calculate_metric() { # # Returns the CIDR of a given netmask netmask2cidr() { - local binary="" i bin + local binary= i= bin= for i in ${1//./ }; do bin="" @@ -146,11 +146,11 @@ is_function() { # wraps function calls - for example function_wrap(this, that) # maps function names this_* to that_* function_wrap() { - local i + local i= is_function "${2}_depend" && return - for i in $( typeset -f | grep -o '^'"${1}"'_[^ ]*' ); do + for i in $(typeset -f | grep -o '^'"${1}"'_[^ ]*'); do eval "${2}${i#${1}}() { ${i} \"\$@\"; }" done } @@ -170,7 +170,7 @@ function_wrap() { # "192.168.3.2/24 brd +" # "192.168.3.3/24 brd +" expand_parameters() { - local x="$( eval echo ${@// /_} )" + local x=$(eval echo ${@// /_}) local -a a=( ${x} ) a=( "${a[@]/#/\"}" ) @@ -185,14 +185,14 @@ expand_parameters() { configure_variables() { local iface="$1" option1="$2" option2="$3" - local mod func x i - local -a ivars ovars1 ovars2 - local ifvar="$(bash_variable "${iface}")" + local mod= func= x= i= + local -a ivars=() ovars1=() ovars2=() + local ifvar=$(bash_variable "${iface}") for mod in ${MODULES[@]}; do is_function ${mod}_variables || continue for v in $(${mod}_variables) ; do - x="" + x= [[ -n ${option2} ]] && x="${v}_${option2}[@]" [[ -z ${!x} ]] && x="${v}_${option1}[@]" [[ -n ${!x} ]] && eval "${v}_${ifvar}=( \"\${!x}\" )" @@ -311,9 +311,9 @@ modules_check_installed() { # bool modules_check_user(void) modules_check_user() { - local iface="$1" ifvar="$(bash_variable "${IFACE}")" - local i j k l nmods="${#MODULES[@]}" - local -a umods + local iface="$1" ifvar=$(bash_variable "${IFACE}") + local i= j= k= l= nmods="${#MODULES[@]}" + local -a umods=() # Has the interface got any specific modules? umods="modules_${ifvar}[@]" @@ -376,7 +376,7 @@ modules_check_user() { fi if is_function "${umods[i]}_provide" ; then - mod="$(${umods[i]}_provide )" + mod=$(${umods[i]}_provide) else mod="${umods[i]}" fi @@ -419,7 +419,7 @@ modules_check_user() { # # Sort our modules modules_sort() { - local i j nmods=${#MODULES[@]} m + local i= j= nmods=${#MODULES[@]} m= local -a provide=() provide_list=() after=() dead=() sorted=() sortedp=() # Make our provide list @@ -469,7 +469,7 @@ modules_sort() { # We then use the below code to provide a topologial sort module_after_visit() { - local name=$1 i x + local name="$1" i= x= for ((i=0; i<nmods; i++)); do [[ ${MODULES[i]} == "$1" ]] && break @@ -496,12 +496,12 @@ modules_sort() { # bool modules_check_depends(bool showprovides) modules_check_depends() { - local showprovides="${1:-false}" nmods="${#MODULES[@]}" i j needmod - local missingdeps p interface=false + local showprovides="${1:-false}" nmods="${#MODULES[@]}" i= j= needmod= + local missingdeps= p= interface=false for (( i=0; i<nmods; i++ )); do if is_function "${MODULES[i]}_need" ; then - for needmod in $( ${MODULES[i]}_need ); do + for needmod in $(${MODULES[i]}_need); do missingdeps=true for (( j=0; j<nmods; j++ )); do if [[ ${needmod} == "${MODULES[j]}" \ @@ -518,7 +518,7 @@ modules_check_depends() { fi if is_function "${MODULES[i]}_functions" ; then - for f in $( ${MODULES[i]}_functions ); do + for f in $(${MODULES[i]}_functions); do if ! is_function "${f}" ; then eerror "${MODULES[i]}: missing required function \"${f}\"" return 1 @@ -547,10 +547,10 @@ modules_check_depends() { # Loads the defined handler and modules for the interface # Returns 0 on success, otherwise 1 modules_load() { - local iface="$1" starting="${2:-true}" MODULE p=false i j k - local -a x + local iface="$1" starting="${2:-true}" MODULE= p=false i= j= k= + local -a x=() local RC_INDENTATION="${RC_INDENTATION}" - local -a PROVIDES WRAP_MODULES + local -a PROVIDES=() WRAP_MODULES=() if ! is_loopback "${iface}" ; then x="modules_force_${iface}[@]" @@ -592,7 +592,7 @@ modules_load() { # If no provide is given, assume module name if is_function "${MODULES[i]}_provide" ; then - PROVIDES[i]="$(${MODULES[i]}_provide)" + PROVIDES[i]=$(${MODULES[i]}_provide) else PROVIDES[i]="${MODULES[i]}" fi @@ -655,8 +655,8 @@ modules_load() { iface_start() { local iface="$1" mod config_counter="-1" x config_worked=false local RC_INDENTATION="${RC_INDENTATION}" - local -a config fallback fallback_route conf a b - local ifvar="$(bash_variable "$1")" i j metric=0 + local -a config=() fallback=() fallback_route=() conf=() a=() b=() + local ifvar=$(bash_variable "$1") i= j= metric=0 # pre Start any modules with for mod in ${MODULES[@]}; do @@ -809,7 +809,7 @@ iface_start() { # iface_start ran. Instead query for current configuration and bring # down the interface. iface_stop() { - local iface="$1" i aliases need_begin=false mod + local iface="$1" i= aliases= need_begin=false mod= local RC_INDENTATION="${RC_INDENTATION}" # pre Stop any modules @@ -825,7 +825,7 @@ iface_stop() { # Collect list of aliases for this interface. # List will be in reverse order. if interface_exists "${iface}" ; then - aliases="$(interface_get_aliases_rev "${iface}")" + aliases=$(interface_get_aliases_rev "${iface}") fi # Stop aliases before primary interface. @@ -875,7 +875,7 @@ iface_stop() { # We cannot check that the device exists ourselves as modules like # tuntap make create it. run_start() { - local iface="$1" IFVAR="$(bash_variable "$1")" + local iface="$1" IFVAR=$(bash_variable "$1") # We do this so users can specify additional addresses for lo if they # need too - additional routes too @@ -914,7 +914,7 @@ run_start() { # If config is set to noop and the interface is up with an address # then we don't start it - local config + local config= config="config_${IFVAR}[@]" config=( "${!config}" ) if [[ ${config[0]} == "noop" ]] && interface_is_up "${iface}" true ; then @@ -962,12 +962,12 @@ run_start() { # stop returns non-zero to indicate failure bringing down device. # In all other cases stop returns 0 to indicate success. run_stop() { - local iface="$1" IFVAR="$(bash_variable "$1")" x + local iface="$1" IFVAR=$(bash_variable "$1") x # Load our ESSID variable so users can use it in predown() instead # of having to write code. - local ESSID="$(get_options ESSID)" ESSIDVAR - [[ -n ${ESSID} ]] && ESSIDVAR="$(bash_variable "${ESSID}")" + local ESSID=$(get_options ESSID) ESSIDVAR= + [[ -n ${ESSID} ]] && ESSIDVAR=$(bash_variable "${ESSID}") # Call user-defined predown function if it exists if is_function predown ; then @@ -1021,7 +1021,7 @@ run_stop() { run() { local iface="$1" cmd="$2" r=1 RC_INDENTATION="${RC_INDENTATION}" local starting=true - local -a MODULES mods + local -a MODULES=() mods=() local IN_BACKGROUND="${IN_BACKGROUND}" if [[ ${IN_BACKGROUND} == "true" || ${IN_BACKGROUND} == "1" ]] ; then diff --git a/net-scripts/net/adsl.sh b/net-scripts/net/adsl.sh index 2e1423b..97d620c 100644 --- a/net-scripts/net/adsl.sh +++ b/net-scripts/net/adsl.sh @@ -22,7 +22,7 @@ adsl_check_installed() { # # Checks to see if the ADSL script has been created or not adsl_setup_vars() { - local iface="$1" startstop="$2" cfgexe + local iface="$1" startstop="$2" cfgexe= if [[ -x /usr/sbin/pppoe-start ]]; then exe="/usr/sbin/pppoe-${startstop}" @@ -52,7 +52,7 @@ adsl_setup_vars() { # # Returns 0 (true) when successful, non-zero otherwise adsl_start() { - local iface="$1" exe cfgfile user ifvar="$(bash_variable "$1")" + local iface="$1" exe= cfgfile= user= ifvar=$(bash_variable "$1") adsl_setup_vars "${iface}" start || return 1 @@ -74,7 +74,7 @@ adsl_start() { # Returns 0 when there is no ADSL to stop or we stop ADSL successfully # Otherwise 1 adsl_stop() { - local iface="$1" exe cfgfile + local iface="$1" exe= cfgfile= adsl_check_installed || return 1 [[ ! -f "/var/run/rp-pppoe-${iface}.pid" ]] && return 0 diff --git a/net-scripts/net/apipa.sh b/net-scripts/net/apipa.sh index 5ccdc18..b482e4b 100644 --- a/net-scripts/net/apipa.sh +++ b/net-scripts/net/apipa.sh @@ -14,7 +14,7 @@ apipa_depend() { # # Tries to detect a config based on arpinging things apipa_start() { - local iface="$1" i1 i2 addr i=0 + local iface="$1" i1= i2= addr= i=0 interface_exists "$1" true || return 1 diff --git a/net-scripts/net/arping.sh b/net-scripts/net/arping.sh index 01d9256..0200e63 100644 --- a/net-scripts/net/arping.sh +++ b/net-scripts/net/arping.sh @@ -28,7 +28,7 @@ arping_sleep() { local iface="$1" [[ ${ARPING_SLEPT} == "1" ]] && return - local ifvar="$(bash_variable "${iface}")" + local ifvar=$(bash_variable "${iface}") local s="arping_sleep_${ifvar}" s="${!s}" if [[ -z ${s} ]] ; then @@ -60,22 +60,22 @@ arping_address_exists() { arping_sleep - local ifvar="$(bash_variable "${iface}")" + local ifvar=$(bash_variable "${iface}") w="arping_wait_${ifvar}" w="${!w}" [[ -z ${w} ]] && w="${arping_wait:-3}" if [[ -x /sbin/arping ]] ; then - foundmac="$(arping -c 2 -w "${w}" -D -f -I "${iface}" \ + foundmac=$(arping -c 2 -w "${w}" -D -f -I "${iface}" \ "${ip}" 2>/dev/null \ - | sed -n 's/.*\[\([^]]*\)\].*/\U\1/p')" + | sed -n 's/.*\[\([^]]*\)\].*/\U\1/p') elif [[ -x /usr/sbin/arping2 ]] ; then for (( i=0; i<w; i++ )) ; do - foundmac="$(arping2 -r -0 -c 1 -i "${iface}" \ - "${ip}" 2>/dev/null)" + foundmac=$(arping2 -r -0 -c 1 -i "${iface}" \ + "${ip}" 2>/dev/null) if [[ $? == "0" ]] ; then - foundmac="$(echo "${foundmac}" \ - | tr '[:lower:]' '[:upper:]')" + foundmac=$(echo "${foundmac}" \ + | tr '[:lower:]' '[:upper:]') break fi foundmac= @@ -99,8 +99,8 @@ arping_address_exists() { # arpings a list of gateways # If one is foung then apply it's configuration arping_start() { - local iface="$1" gateways x conf i - local ifvar="$(bash_variable "${iface}")" + local iface="$1" gateways= x= conf= i= + local ifvar=$(bash_variable "${iface}") einfo "Pinging gateways on ${iface} for configuration" @@ -116,8 +116,8 @@ arping_start() { local -a a=( ${x//,/ } ) local ip="${a[0]}" mac="${a[1]}" extra= if [[ -n ${mac} ]] ; then - mac="$(echo "${mac}" | tr '[:lower:]' '[:upper:]')" - extra="(MAC ${mac})" + mac=$(echo "${mac}" | tr '[:lower:]' '[:upper:]') + extra=(MAC ${mac}) fi vebegin "${ip} ${extra}" diff --git a/net-scripts/net/bonding.sh b/net-scripts/net/bonding.sh index 2b8a086..b206624 100644 --- a/net-scripts/net/bonding.sh +++ b/net-scripts/net/bonding.sh @@ -38,8 +38,8 @@ bonding_exists() { # # Bonds the interface bonding_pre_start() { - local iface="$1" s ifvar="$(bash_variable "$1")" - local -a slaves + local iface="$1" s= ifvar=$(bash_variable "$1") + local -a slaves=() slaves="slaves_${ifvar}[@]" [[ -z ${!slaves} ]] && return 0 @@ -86,16 +86,16 @@ bonding_pre_start() { # # Always returns 0 (true) bonding_stop() { - local iface="$1" slaves s + local iface="$1" slaves= s= # return silently if this is not a bonding interface ! bonding_exists "${iface}" && return 0 # don't trust the config, get the active list instead - slaves="$( \ + slaves=$( \ sed -n -e 's/^Slave Interface: //p' "/proc/net/bonding/${iface}" \ | tr '\n' ' ' \ - )" + ) [[ -z ${slaves} ]] && return 0 # remove all slaves diff --git a/net-scripts/net/br2684ctl.sh b/net-scripts/net/br2684ctl.sh index e325817..50e4e7e 100644 --- a/net-scripts/net/br2684ctl.sh +++ b/net-scripts/net/br2684ctl.sh @@ -19,7 +19,7 @@ br2684ctl_check_installed() { # bool br2684ctl_start(char *iface) br2684ctl_pre_start() { - local iface="$1" ifvar="$(bash_variable "$1")" opts= + local iface="$1" ifvar=$(bash_variable "$1") opts= local number="${iface#${iface%%[0-9]}}" opts="br2684ctl_${ifvar}" diff --git a/net-scripts/net/bridge.sh b/net-scripts/net/bridge.sh index 2d4e6f5..cf8a981 100644 --- a/net-scripts/net/bridge.sh +++ b/net-scripts/net/bridge.sh @@ -70,10 +70,10 @@ bridge_exists() { # 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 opts + local iface="$1" ifvar=$(bash_variable "$1") x= i= opts= ebegin "Creating bridge ${iface}" - x="$(brctl addbr "${iface}" 2>&1)" + x=$(brctl addbr "${iface}" 2>&1) if [[ -n ${x} ]] ; then if [[ ${x//Package not installed/} != "${x}" ]] ; then eend 1 "Bridging (802.1d) support is not present in this kernel" @@ -87,7 +87,7 @@ bridge_create() { for i in "${!opts}" ; do x="${i/ / ${iface} }" [[ ${x} == "${i}" ]] && x="${x} ${iface}" - x="$(brctl ${x} 2>&1 1>/dev/null)" + x=$(brctl ${x} 2>&1 1>/dev/null) [[ -n ${x} ]] && ewarn "${x}" done eend 0 @@ -97,11 +97,11 @@ bridge_create() { # # Adds the port to the bridge bridge_add_port() { - local iface="$1" port="$2" e + local iface="$1" port="$2" e= interface_set_flag "${port}" promisc true interface_up "${port}" - e="$(brctl addif "${iface}" "${port}" 2>&1)" + e=$(brctl addif "${iface}" "${port}" 2>&1) if [[ -n ${e} ]] ; then interface_set_flag "${port}" promisc false echo "${e}" >&2 @@ -124,7 +124,7 @@ bridge_delete_port() { # 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 + local iface="$1" ports= briface= i= ifvar=$(bash_variable "$1") opts= ports="bridge_${ifvar}[@]" briface="bridge_add_${ifvar}" opts="brctl_${ifvar}[@]" @@ -171,18 +171,18 @@ bridge_pre_start() { # Removes the device # returns 0 bridge_stop() { - local iface="$1" ports i deletebridge=false extra="" + 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}")" + 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}")" + iface=$(bridge_get_bridge "${iface}") [[ -z ${iface} ]] && return 0 extra=" from ${iface}" fi diff --git a/net-scripts/net/ccwgroup.sh b/net-scripts/net/ccwgroup.sh index 3eca965..7091719 100644 --- a/net-scripts/net/ccwgroup.sh +++ b/net-scripts/net/ccwgroup.sh @@ -10,7 +10,7 @@ ccwgroup_expose() { } ccwgroup_pre_start() { - local iface="$1" ifvar="$(bash_variable "$1")" + local iface="$1" ifvar=$(bash_variable "$1") local ccw="ccwgroup_${ifvar}[@]" local -a ccwgroup=( "${!ccw}" ) @@ -33,16 +33,16 @@ ccwgroup_pre_stop() { save_options ccwgroup_device "" [[ ! -L /sys/class/net/"${iface}"/driver ]] && return 0 - local driver="$(readlink /sys/class/net/"${iface}"/driver)" + local driver=$(readlink /sys/class/net/"${iface}"/driver) [[ ${driver} != *"/bus/ccwgroup/"* ]] && return 0 - local device="$(readlink /sys/class/net/"${iface}"/device)" + local device=$(readlink /sys/class/net/"${iface}"/device) device="${device##*/}" save_options ccwgroup_device "${device}" } ccwgroup_post_stop() { - local iface="$1" device="$(get_options ccwgroup_device)" + local iface="$1" device=$(get_options ccwgroup_device) [[ -z ${device} ]] && return 0 diff --git a/net-scripts/net/dhclient.sh b/net-scripts/net/dhclient.sh index 0e54d21..10dfa59 100644 --- a/net-scripts/net/dhclient.sh +++ b/net-scripts/net/dhclient.sh @@ -43,7 +43,7 @@ dhclient_stop() { [[ ! -f ${pidfile} ]] && return 0 ebegin "Stopping dhclient on ${iface}" - local ifvar="$(bash_variable "${iface}")" + local ifvar=$(bash_variable "${iface}") local d="dhcp_${ifvar}" [[ -z ${!d} ]] && d="dhcp" if [[ " ${!d} " == *" release "* ]] ; then @@ -60,7 +60,7 @@ dhclient_stop() { # # Returns 0 (true) when a DHCP address is obtained, otherwise 1 dhclient_start() { - local iface="$1" ifvar="$(bash_variable "$1")" dhconf= + local iface="$1" ifvar=$(bash_variable "$1") dhconf= local pidfile="/var/run/dhclient-${iface}.pid" interface_exists "${iface}" true || return 1 @@ -95,7 +95,7 @@ dhclient_start() { # Send our hostname by editing cffile if [[ " ${!d} " != *" nosendhost "* ]] ; then - local hname="$(hostname)" + local hname=$(hostname) if [[ ${hname} != "(none)" && ${hname} != "localhost" ]]; then dhconf="${dhconf} interface \"${iface}\" {\n" dhconf="${dhconf} send host-name \"${hname}\"\n;" @@ -110,7 +110,7 @@ dhclient_start() { eend $? || return 1 # DHCP succeeded, show address retrieved - local addr="$(interface_get_address "${iface}")" + local addr=$(interface_get_address "${iface}") einfo "${iface} received address ${addr}" return 0 diff --git a/net-scripts/net/dhcpcd.sh b/net-scripts/net/dhcpcd.sh index 3cf6267..6e6055d 100644 --- a/net-scripts/net/dhcpcd.sh +++ b/net-scripts/net/dhcpcd.sh @@ -43,13 +43,13 @@ dhcpcd_check_installed() { # Returns 0 (true) when a DHCP address dropped # otherwise return 1 dhcpcd_stop() { - local iface=$1 signal pidfile="/var/run/dhcpcd-$1.pid" d + local iface=$1 signal= pidfile="/var/run/dhcpcd-$1.pid" d= [[ ! -f ${pidfile} ]] && return 0 ebegin "Stopping dhcpcd on ${iface}" - local ifvar="$(bash_variable "${iface}")" + local ifvar=$(bash_variable "${iface}") d="dhcp_${ifvar}" d=" ${!d} " [[ ${d} == " " ]] && d=" ${dhcp} " @@ -68,8 +68,8 @@ dhcpcd_stop() { # # Returns 0 (true) when a DHCP address is obtained, otherwise 1 dhcpcd_start() { - local iface="$1" opts pidfile="/var/run/dhcpcd-$1.pid" - local ifvar="$(bash_variable "${iface}")" metric d + local iface="$1" opts= pidfile="/var/run/dhcpcd-$1.pid" + local ifvar=$(bash_variable "${iface}") metric= d= interface_exists "${iface}" true || return 1 @@ -88,7 +88,7 @@ dhcpcd_start() { # We transmit the hostname by default if [[ " ${d} " != *" nosendhost "* && " ${opts} " != *" -h "* ]]; then - local hname="$(hostname)" + local hname=$(hostname) [[ -n ${hname} && ${hname} != "(none)" && ${hname} != "localhost" ]] \ && opts="-h \"${hname}\" ${opts}" fi @@ -107,7 +107,7 @@ dhcpcd_start() { eend $? || return 1 # DHCP succeeded, show address retrieved - local addr="$( interface_get_address "${iface}" )" + local addr=$(interface_get_address "${iface}") einfo "${iface} received address ${addr}" return 0 diff --git a/net-scripts/net/essidnet.sh b/net-scripts/net/essidnet.sh index 689a6ea..4e37ec5 100644 --- a/net-scripts/net/essidnet.sh +++ b/net-scripts/net/essidnet.sh @@ -30,9 +30,9 @@ essidnet_pre_start() { wireless_exists "${iface}" || return 0 - local mac="$(wireless_get_ap_mac_address "${iface}")" - local ESSID="$(wireless_get_essid "${iface}")" - local essid="$(bash_variable "${ESSID}")" + 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 diff --git a/net-scripts/net/ifconfig.sh b/net-scripts/net/ifconfig.sh index 6ced9e2..ddae01a 100644 --- a/net-scripts/net/ifconfig.sh +++ b/net-scripts/net/ifconfig.sh @@ -44,7 +44,7 @@ ifconfig_check_installed() { # # Returns 1 if the interface exists, otherwise 0 ifconfig_exists() { - local e="$(ifconfig -a | grep -o "^$1")" report="${2:-false}" + local e=$(ifconfig -a | grep -o "^$1") report="${2:-false}" [[ -n ${e} ]] && return 0 if ${report} ; then @@ -60,7 +60,7 @@ ifconfig_exists() { # Returns the netmask of a given CIDR cidr2netmask() { local cidr="$1" netmask="" done=0 i sum=0 cur=128 - local octets frac + local octets= frac= (( octets=cidr/8 )) (( frac=cidr%8 )) @@ -129,7 +129,7 @@ ifconfig_set_flag() { ifconfig_get_address() { local -a x=( $( ifconfig "$1" \ | sed -n -e 's/.*inet addr:\([^ ]*\).*Mask:\([^ ]*\).*/\1 \2/p' ) ) - x[1]="$(netmask2cidr "${x[1]}")" + x[1]=$(netmask2cidr "${x[1]}") [[ -n ${x[0]} ]] && echo "${x[0]}/${x[1]}" } @@ -144,8 +144,8 @@ ifconfig_is_ethernet() { # # Fetch the mac address assingned to the network card ifconfig_get_mac_address() { - local mac="$(ifconfig "$1" | sed -n -e \ - 's/.*HWaddr[ \t]*\<\(..:..:..:..:..:..\)\>.*/\U\1/p')" + local mac=$(ifconfig "$1" | sed -n -e \ + 's/.*HWaddr[ \t]*\<\(..:..:..:..:..:..\)\>.*/\U\1/p') [[ ${mac} != '00:00:00:00:00:00' \ && ${mac} != '44:44:44:44:44:44' \ && ${mac} != 'FF:FF:FF:FF:FF:FF' ]] \ @@ -167,7 +167,7 @@ ifconfig_set_name() { [[ -z $2 ]] && return 1 local current="$1" new="$2" - local mac="$(ifconfig_get_mac_address "${current}")" + local mac=$(ifconfig_get_mac_address "${current}") if [[ -z ${mac} ]]; then eerror "${iface} does not have a MAC address" return 1 @@ -192,7 +192,7 @@ ifconfig_get_aliases_rev() { # (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}" + local iface="$1" i= onlyinet="${2:-false}" # We don't remove addresses from aliases [[ ${iface} == *:* ]] && return 0 @@ -221,7 +221,7 @@ ifconfig_del_addresses() { # # Returns config and config_fallback for the given interface ifconfig_get_old_config() { - local iface="$1" ifvar="$(bash_variable "$1")" i inet6 + local iface="$1" ifvar=$(bash_variable "$1") i= inet6= config="ifconfig_${ifvar}[@]" config=( "${!config}" ) @@ -235,7 +235,7 @@ ifconfig_get_old_config() { i="iface_${ifvar}" if [[ -n ${!i} && -z ${config} ]]; then # Make sure these get evaluated as arrays - local -a aliases broadcasts netmasks + local -a aliases=() broadcasts=() netmasks=() # Start with the primary interface config=( ${!i} ) @@ -292,7 +292,7 @@ ifconfig_pre_start() { interface_exists "${iface}" || return 0 - local ifvar="$(bash_variable "$1")" mtu + local ifvar=$(bash_variable "$1") mtu= # MTU support mtu="mtu_${ifvar}" @@ -311,7 +311,7 @@ ifconfig_pre_start() { # 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 + local iface="$1" ifvar=$(bash_variable "$1") routes= x= metric= mtu= cidr= metric="metric_${ifvar}" ifconfig_exists "${iface}" || return 0 @@ -374,7 +374,7 @@ ifconfig_post_start() { # # Adds the given address to the interface ifconfig_add_address() { - local iface="$1" i=0 r e real_iface="$(interface_device "$1")" + local iface="$1" i=0 r= e= real_iface=$(interface_device "$1") ifconfig_exists "${real_iface}" true || return 1 @@ -390,17 +390,17 @@ ifconfig_add_address() { # 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=$(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 + local ip="${config[0]%%/*}" cidr="${config[0]##*/}" netmask= if [[ -n ${cidr} && ${cidr} != "${ip}" ]]; then - netmask="$(cidr2netmask "${cidr}")" + netmask=$(cidr2netmask "${cidr}") config[0]="${ip} netmask ${netmask}" fi diff --git a/net-scripts/net/ifplugd.sh b/net-scripts/net/ifplugd.sh index 110b443..85a12c3 100644 --- a/net-scripts/net/ifplugd.sh +++ b/net-scripts/net/ifplugd.sh @@ -34,7 +34,7 @@ ifplugd_check_installed() { # # Start ifplugd on an interface ifplugd_pre_start() { - local iface="$1" ifvar="$(bash_variable "$1")" timeout opts + local iface="$1" ifvar=$(bash_variable "$1") timeout= opts= local pidfile="/var/run/ifplugd.${iface}.pid" # We don't start ifplugd if we're being called from the background @@ -50,7 +50,7 @@ ifplugd_pre_start() { # 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}")" + local mac=$(interface_get_mac_address "${iface}") if [[ -z ${mac} ]] ; then vewarn "ifplugd only works on interfaces with a valid MAC address" return 0 @@ -112,7 +112,7 @@ ifplugd_pre_start() { local i=0 while true ; do if service_started "net.${iface}" ; then - local addr="$(interface_get_address "${iface}")" + local addr=$(interface_get_address "${iface}") einfo "${iface} configured with address ${addr}" exit 0 fi diff --git a/net-scripts/net/ip6to4.sh b/net-scripts/net/ip6to4.sh index cd3f1f6..cfdc466 100644 --- a/net-scripts/net/ip6to4.sh +++ b/net-scripts/net/ip6to4.sh @@ -26,7 +26,7 @@ ip6to4_expose() { # Returns 0 on success, otherwise 1. ip6to4_start() { local iface="$1" addr="" - local ifvar="$(bash_variable "${iface}")" + local ifvar=$(bash_variable "${iface}") # Ensure the interface is sit0 if we're using ifconfig if [[ " ${MODULES[@]} " == *" ifconfig "* && ${iface} != "sit0" ]] ; then @@ -59,14 +59,14 @@ ip6to4_start() { [[ ${ip} == "127."* ]] && continue [[ ${ip} == "10."* ]] && continue [[ ${ip} == "192.168."* ]] && continue - local i + local i= for ((i=16; i<32; i++)); do [[ ${ip} == "172.${i}."* ]] && break done [[ ${i} -lt 32 ]] && continue veinfo "IPv4 address on ${!host}: ${ip}" - local ip6="$(printf "2002:%02x%02x:%02x%02x::1" ${ip//./ })" + local ip6=$(printf "2002:%02x%02x:%02x%02x::1" ${ip//./ }) veinfo "Derived IPv6 address: ${ip6}" # Now apply our IPv6 address to our config diff --git a/net-scripts/net/ipppd.sh b/net-scripts/net/ipppd.sh index 943f558..cc84c20 100644 --- a/net-scripts/net/ipppd.sh +++ b/net-scripts/net/ipppd.sh @@ -30,7 +30,7 @@ ipppd_check_installed() { # # Returns 0 (true) when successful, non-zero otherwise ipppd_pre_start() { - local iface="$1" opts itype="$(interface_type "$1")" + local iface="$1" opts= itype=$(interface_type "$1") local pidfile="/var/run/ipppd-${iface}.pid" # Check that we are a valid isdn interface @@ -39,7 +39,7 @@ ipppd_pre_start() { # Check that the interface exists interface_exists "${iface}" true || return 1 - local ifvar="$(bash_variable "${iface}")" + local ifvar=$(bash_variable "${iface}") # Might or might not be set in conf.d/net opts="ipppd_${ifvar}" @@ -68,5 +68,4 @@ ipppd_stop() { eend $? } -# vim:ts=4 # vim: set ts=4 : diff --git a/net-scripts/net/iproute2.sh b/net-scripts/net/iproute2.sh index f600704..4642326 100644 --- a/net-scripts/net/iproute2.sh +++ b/net-scripts/net/iproute2.sh @@ -46,7 +46,7 @@ iproute2_check_installed() { # # Returns 1 if the interface exists, otherwise 0 iproute2_exists() { - local e="$( ip addr show label "$1" )" report="${2:-false}" + local e=$( ip addr show label "$1" ) report="${2:-false}" [[ -n ${e} ]] && return 0 if ${report} ; then @@ -109,8 +109,8 @@ iproute2_is_ethernet() { # # Fetch the mac address assingned to the network card iproute2_get_mac_address() { - local mac="$( ip link show "$1" | sed -n -e \ - '/link\// s/^.*\<\(..:..:..:..:..:..\)\>.*/\U\1/p' )" + local mac=$( ip link show "$1" | sed -n -e \ + '/link\// s/^.*\<\(..:..:..:..:..:..\)\>.*/\U\1/p' ) [[ ${mac} != '00:00:00:00:00:00' \ && ${mac} != '44:44:44:44:44:44' \ && ${mac} != 'FF:FF:FF:FF:FF:FF' ]] \ @@ -138,7 +138,7 @@ iproute2_set_name() { # 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" )" + local iface=$( interface_device "$1" ) ip addr show dev "${iface}" | grep -o "${iface}:[0-9].*" | tac } @@ -147,7 +147,7 @@ iproute2_get_aliases_rev() { # Remove addresses from interface. # If onlyinet is true, then we only remove IPv4 / inet addresses. iproute2_del_addresses() { - local pre="" + local pre= ${2:-false} && pre="-f inet" ip ${pre} addr flush label "$1" scope global &>/dev/null ip ${pre} addr flush label "$1" scope site &>/dev/null @@ -159,7 +159,7 @@ iproute2_del_addresses() { # # Returns config and config_fallback for the given interface iproute2_get_old_config() { - local ifvar="$( bash_variable "$1" )" inet6="" t="" + local ifvar=$( bash_variable "$1" ) inet6= t= # iproute2-style config vars t="ipaddr_${ifvar}[@]" @@ -191,7 +191,7 @@ iproute2_get_old_config() { # # Returns 0 (true) when successful, non-zero (false) on failure iproute2_iface_stop() { - local label="$1" iface="$( interface_device "$1" )" + local label="$1" iface=$( interface_device "$1" ) # Shut down the link if this isn't an alias or vlan if [[ ${label} == "${iface}" ]] ; then @@ -206,7 +206,7 @@ iproute2_iface_stop() { # Adds an the specified address to the interface # returns 0 on success and non-zero on failure iproute2_add_address() { - local iface="$1" x="" + local iface="$1" x= iproute2_exists "${iface}" true || return 1 @@ -263,7 +263,7 @@ iproute2_pre_start() { interface_exists "${iface}" || return 0 - local ifvar="$( bash_variable "$1" )" + local ifvar=$( bash_variable "$1" ) # MTU support local mtu="mtu_${ifvar}" @@ -277,7 +277,7 @@ iproute2_pre_start() { # Runs any post_start stuff on our interface and adds routes # Always returns 0 iproute2_post_start() { - local iface="$1" ifvar="$( bash_variable "$1" )" x="" + local iface="$1" ifvar=$( bash_variable "$1" ) x= iproute2_exists "${iface}" || return 0 @@ -338,7 +338,7 @@ iproute2_post_start() { # void iproute2_post_stop(char* interface) iproute2_post_stop() { - local iface="$1" rule="" + local iface="$1" rule= iproute2_exists "${iface}" || return diff --git a/net-scripts/net/iptunnel.sh b/net-scripts/net/iptunnel.sh index 3a3568d..f85e70a 100644 --- a/net-scripts/net/iptunnel.sh +++ b/net-scripts/net/iptunnel.sh @@ -21,8 +21,8 @@ iptunnel_expose() { # # Create the device, give it the right perms iptunnel_pre_start() { - local iface="$1" opts ifvar="$(bash_variable "$1")" - + local iface="$1" opts= ifvar=$(bash_variable "$1") + # Get our options eval opts="iptunnel_${ifvar}" [[ -z ${!opts} ]] && return 0 diff --git a/net-scripts/net/iwconfig.sh b/net-scripts/net/iwconfig.sh index f3b1206..8c9a4f9 100644 --- a/net-scripts/net/iwconfig.sh +++ b/net-scripts/net/iwconfig.sh @@ -59,6 +59,9 @@ iwconfig_check_installed() { # # Checks to see if wireless extensions are enabled on the interface iwconfig_exists() { + # Support new sysfs layout + [[ -L /sys/class/net/$1/wiphy ]] && return 0 + [[ ! -e /proc/net/wireless ]] && return 1 grep -q "^[ \t]*$1:" /proc/net/wireless } @@ -68,12 +71,12 @@ iwconfig_exists() { # 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" + 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' )" + mode=$(iwconfig "$1" | sed -n -e 's/^.*Security mode:\(.*[^ ]\).*/\1/p') [[ -n ${mode} ]] && mode=" - ${mode}" fi @@ -84,10 +87,10 @@ iwconfig_get_wep_status() { # # Gets the current ESSID of the iface iwconfig_get_essid() { - local i essid + local i= essid= for (( i=0; i<5; i++ )); do - essid="$( iwgetid --raw "$1" )" + essid=$( iwgetid --raw "$1" ) if [[ -n ${essid} ]] ; then echo "${essid}" return 0 @@ -124,20 +127,20 @@ iwconfig_get_type() { # # Output how our wireless interface has been configured iwconfig_report() { - local iface="$1" essid mac m="connected to" + local iface="$1" essid= mac= m="connected to" - essid="$( iwconfig_get_essid "${iface}" )" + essid=$(iwconfig_get_essid "${iface}") - local wep_status="$( iwconfig_get_wep_status "${iface}" )" - local channel="$( iwgetid --raw --channel "${iface}" )" + local wep_status=$(iwconfig_get_wep_status "${iface}") + local channel=$(iwgetid --raw --channel "${iface}") [[ -n ${channel} ]] && channel="on channel ${channel} " essid="${essid//\\\\/\\\\}" - local mode="$( iwconfig_get_mode "${iface}" )" + local mode=$(iwconfig_get_mode "${iface}") if [[ ${mode} == "master" ]]; then m="configured as" else - mac="$( iwconfig_get_ap_mac_address "${iface}" )" + mac=$(iwconfig_get_ap_mac_address "${iface}") [[ -n ${mac} ]] && mac=" at ${mac}" fi @@ -152,7 +155,7 @@ iwconfig_report() { # 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 + local mac="$1" key= key="mac_key_${mac//:/}" [[ -z ${!key} ]] && key="key_${ESSIDVAR}" echo "${!key:-off}" @@ -162,8 +165,8 @@ iwconfig_get_wep_key() { # # Applies the user configuration to the interface iwconfig_user_config() { - local iface="$1" conf aconf ifvar="$2" - [[ -z ${ifvar} ]] && ifvar="$( bash_variable "$1" )" + local iface="$1" conf= aconf= ifvar="$2" + [[ -z ${ifvar} ]] && ifvar=$(bash_variable "$1") # Apply the user configuration conf="iwconfig_${ifvar}" @@ -193,8 +196,8 @@ iwconfig_user_config() { # # 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" )" + 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" @@ -202,11 +205,11 @@ iwconfig_setup_specific() { return 1 fi dessid="${ESSID//\\\\/\\\\}" - ESSIDVAR="$( bash_variable "${ESSID}" )" - key="$( iwconfig_get_wep_key )" + ESSIDVAR=$(bash_variable "${ESSID}") + key=$(iwconfig_get_wep_key) # We only change the mode if it's not the same - local cur_mode="$( iwconfig_get_mode "${iface}" )" + 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}\"" @@ -249,7 +252,7 @@ iwconfig_setup_specific() { # 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 mac=$(iwconfig_get_ap_mac_address "$1") i= local -a invalid_macs=( "00:00:00:00:00:00" "44:44:44:44:44:44" @@ -268,10 +271,10 @@ iwconfig_associate_mac() { # # Returns true if the link quality is not 0 or 0. iwconfig_associate_quality() { - local quality="$( \ + local quality=$( \ sed -n -e 's/^.*'"$1"': *[0-9]* *\([0-9]*\).*/\1/p' \ /proc/net/wireless - )" + ) [[ ${quality} != "0" ]] return "$?" } @@ -280,12 +283,12 @@ iwconfig_associate_quality() { # # Returns true if the interface has associated with an Access Point iwconfig_test_associated() { - local iface="$1" ttype ifvar="$( bash_variable "$1" )" x + local iface="$1" ttype= ifvar=$(bash_variable "$1") x= # Some drivers don't set MAC to a bogus value when assocation is lost/fails # whereas they do set link quality to 0 x="associate_test_${ifvar}" - ttype="$( echo "${!x:-mac}" | tr '[:upper:]' '[:lower:]' )" + ttype=$(echo "${!x:-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\"" @@ -307,7 +310,7 @@ iwconfig_test_associated() { # 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" )" + local iface="$1" i=0 timeout= ifvar=$(bash_variable "$1") timeout="associate_timeout_${ifvar}" [[ -z ${!timeout} ]] && timeout="sleep_associate_${ifvar}" timeout="${!timeout:-10}" @@ -334,11 +337,14 @@ iwconfig_wait_for_association() { iwconfig_associate() { local iface="$1" mode="${2:-managed}" local mac="$3" wep_required="$4" w="(WEP Disabled)" - local dessid="${ESSID//\\\\/\\\\}" key + local dessid="${ESSID//\\\\/\\\\}" key= - if ! iwconfig "${iface}" mode "${mode}" ; then - eerror "Unable to change mode to ${mode}" - return 1 + local cur_mode=$(iwconfig_get_mode "${iface}") + if [[ ${cur_mode} != "${mode}" ]]; then + if ! iwconfig "${iface}" mode "${mode}" ; then + eerror "Unable to change mode to ${mode}" + return 1 + fi fi if [[ ${ESSID} == "any" ]]; then @@ -346,8 +352,8 @@ iwconfig_associate() { dessid="any" unset ESSIDVAR else - ESSIDVAR="$( bash_variable "${ESSID}" )" - key="$( iwconfig_get_wep_key "${mac}" )" + ESSIDVAR=$(bash_variable "${ESSID}") + key=$(iwconfig_get_wep_key "${mac}") if [[ ${wep_required} == "on" && ${key} == "off" ]]; then ewarn "WEP key is not set for \"${dessid}\" - not connecting" return 1 @@ -364,9 +370,11 @@ iwconfig_associate() { return 1 fi fi - [[ ${key} != "off" ]] && w="$( iwconfig_get_wep_status "${iface}" )" + [[ ${key} != "off" ]] && w=$(iwconfig_get_wep_status "${iface}") fi + [[ -n ${mac} ]] && iwconfig "${iface}" ap "${mac}" + if ! iwconfig "${iface}" essid "${ESSID}" ; then if [[ ${ESSID} != "any" ]]; then ewarn "${iface} does not support setting ESSID to \"${dessid}\"" @@ -397,7 +405,7 @@ iwconfig_associate() { veend 0 if [[ ${ESSID} == "any" ]]; then - ESSID="$( iwconfig_get_essid "${iface}" )" + ESSID=$(iwconfig_get_essid "${iface}") iwconfig_associate "${iface}" return $? fi @@ -418,11 +426,11 @@ iwconfig_associate() { # # Fills 3 arrays with information from a wireless scan iwconfig_scan() { - local iface="$1" mode x ifvar="$( bash_variable "$1" )" + local iface="$1" mode= x= ifvar=$(bash_variable "$1") # First, we may need to change mode to scan in x="scan_mode_${ifvar}" - mode="$( echo "${!x}" | tr '[:upper:]' '[:lower:]' )" + mode=$(echo "${!x}" | tr '[:upper:]' '[:lower:]') if [[ -n ${mode} ]]; then if ! iwconfig "${iface}" mode "${mode}" ; then ewarn "${iface} does not support setting the mode to \"${mode}\"" @@ -447,22 +455,23 @@ iwconfig_scan() { x="sleep_scan_${ifvar}" [[ -z ${!x} || ${!x} -gt 0 ]] && sleep "${!x:-1}" - local error=true i=-1 line - local -a mac essid enc qual mode + 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:]' )" + mac[i]=$(echo "${line#*: }" | tr '[:lower:]' '[:upper:]') + qual[i]=0 ;; *ESSID:*) essid[i]="${line#*\"}" essid[i]="${essid[i]%*\"}" ;; *Mode:*) - mode[i]="$(echo "${line#*:}" | tr '[:upper:]' '[:lower:]' )" + mode[i]=$(echo "${line#*:}" | tr '[:upper:]' '[:lower:]') [[ ${mode[i]} == "master" ]] && mode[i]="managed" ;; *'Encryption key:'*) @@ -475,7 +484,7 @@ iwconfig_scan() { qual[i]="${qual[i]:-0}" ;; esac - done < <( iwlist "${iface}" scan 2>/dev/null ) + done < <(iwlist "${iface}" scan 2>/dev/null) if ${error}; then ewarn "${iface} does not support scanning" @@ -509,11 +518,11 @@ iwconfig_scan() { # Change back mode if needed x="mode_${ifvar}" - x="$( echo "${!x:-managed}" | tr '[:upper:]' '[:lower:]' )" + x=$(echo "${!x:-managed}" | tr '[:upper:]' '[:lower:]') [[ ${mode} != "${x}" ]] && iwconfig "${iface}" mode "${x}" # Strip any duplicates - local i j x="${#mac[@]}" y + local i= j= x="${#mac[@]}" y= for (( i=0; i<x-1; i++ )) ; do [[ -z ${mac[i]} ]] && continue for (( j=i+1; j<x; j++)) ; do @@ -542,8 +551,7 @@ iwconfig_scan() { [[ ${mode[i]} == "ad-hoc" ]] && (( qual[i]-=10000 )) sortline="${sortline}${qual[i]} ${i}\n" done - - sortline=( $( echo -e "${sortline}" | sort -nr ) ) + sortline=( $(echo -e "${sortline}" | sort -nr) ) for (( i=0; i<${#mac[@]}; i++ )); do (( x=(i * 2) + 1 )) @@ -561,8 +569,8 @@ iwconfig_scan() { # 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 + local i= k= m= remove= + local -a u=() [[ -z ${mac_APs} ]] && ewarn " no access points found" @@ -636,7 +644,7 @@ iwconfig_scan_report() { # 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 + local iface=$1 essid= i= [[ -z ${preferred_aps} ]] && return 1 @@ -664,7 +672,7 @@ iwconfig_force_preferred() { # Connects to preferred_aps in order if they were picked up # by our scan iwconfig_connect_preferred() { - local iface="$1" essid i + local iface="$1" essid= i= for essid in "${preferred_aps[@]}"; do for ((i=0; i<${#essid_APs[@]}; i++)); do @@ -685,7 +693,7 @@ iwconfig_connect_preferred() { # Connects to any AP's found that are not in # our preferred list iwconfig_connect_not_preferred() { - local iface=$1 i ap has_preferred + local iface=$1 i= ap= has_preferred= for ((i=0; i<${#mac_APs[@]}; i++)); do has_preferred=false @@ -713,11 +721,10 @@ iwconfig_defaults() { local iface="$1" # Set some defaults + iwconfig "${iface}" txpower auto 2>/dev/null iwconfig "${iface}" rate auto 2>/dev/null iwconfig "${iface}" rts auto 2>/dev/null iwconfig "${iface}" frag auto 2>/dev/null - iwconfig "${iface}" txpower auto 2>/dev/null - } # void iwconfig_strip_associated(char *iface) @@ -726,15 +733,15 @@ iwconfig_defaults() { # 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 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}" )" + e=$(iwconfig_get_essid "${i}") local -a u=() for ((j=0; j<${#mac_APs[@]}; j++)); do if [[ ${essid_APs[j]} == "${e}" ]]; then @@ -770,18 +777,15 @@ iwconfig_strip_associated() { # 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}" + local iface="$1" e= x= ifvar=$(bash_variable "$1") + local -a essid_APs=() mac_APs=() mode_APs=() enc_APs=() ESSID="essid_${ifvar}" ESSID="${!ESSID}" # Setup ad-hoc mode? x="mode_${ifvar}" - x="$( echo "${!x:-managed}" | tr '[:upper:]' '[:lower:]' )" + x=$(echo "${!x:-managed}" | tr '[:upper:]' '[:lower:]') if [[ ${x} == "ad-hoc" || ${x} == "master" ]]; then iwconfig_setup_specific "${iface}" "${x}" return $? @@ -794,7 +798,7 @@ iwconfig_configure() { # 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}" )" + 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}\"" @@ -802,9 +806,6 @@ iwconfig_configure() { 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 @@ -830,10 +831,8 @@ iwconfig_configure() { # Are we forcing preferred only? x="associate_order_${ifvar}" [[ -n ${!x} ]] && associate_order="${!x}" - associate_order="$( - echo "${associate_order:-any}" \ - | tr '[:upper:]' '[:lower:]' - )" + associate_order=$(echo "${associate_order:-any}" \ + | tr '[:upper:]' '[:lower:]') if [[ ${associate_order} == "forcepreferredonly" ]]; then iwconfig_force_preferred "${iface}" && return 0 @@ -845,7 +844,7 @@ iwconfig_configure() { # other wireless cards in the system if requested x="unique_ap_${ifvar}" [[ -n ${!x} ]] && unique_ap="${!x}" - unique_ap="$( echo "${unique_ap:-no}" | tr '[:upper:]' '[:lower:]' )" + unique_ap=$(echo "${unique_ap:-no}" | tr '[:upper:]' '[:lower:]') [[ ${unique_ap} != "no" ]] && iwconfig_strip_associated "${iface}" iwconfig_connect_preferred "${iface}" && return 0 @@ -898,6 +897,9 @@ iwconfig_pre_start() { return 0 fi + iwconfig_defaults "${iface}" + iwconfig_user_config "${iface}" + # Set the base metric to be 2000 metric=2000 @@ -913,11 +915,12 @@ iwconfig_pre_start() { 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}" )" + # 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 @@ -933,14 +936,17 @@ iwconfig_pre_start() { eerror "Failed to configure wireless for ${iface}" iwconfig_defaults "${iface}" + iwconfig "${iface}" txpower off 2>/dev/null unset ESSID ESSIDVAR interface_down "${iface}" return 1 } iwconfig_post_stop() { + ${IN_BACKGROUND} && return 0 interface_exists "${iface}" || return 0 - iwconfig_defaults "${iface}" + iwconfig_defaults "${iface}" + iwconfig "${iface}" txpower off 2>/dev/null } # vim: set ts=4 : diff --git a/net-scripts/net/macchanger.sh b/net-scripts/net/macchanger.sh index 6331997..c02b3ff 100644 --- a/net-scripts/net/macchanger.sh +++ b/net-scripts/net/macchanger.sh @@ -24,7 +24,7 @@ macchanger_pre_start() { # We don't change MAC addresses from background ${IN_BACKGROUND} && return 0 - local iface="$1" mac opts ifvar="$(bash_variable "$1")" + local iface="$1" mac= opts= ifvar=$(bash_variable "$1") mac="mac_${ifvar}" [[ -z ${!mac} ]] && return 0 @@ -36,7 +36,7 @@ macchanger_pre_start() { # The interface needs to be up for macchanger to work most of the time interface_down "${iface}" - mac="$(echo "${!mac}" | tr '[:upper:]' '[:lower:]')" + 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]) @@ -44,7 +44,7 @@ macchanger_pre_start() { interface_set_mac_address "${iface}" "${mac}" eend "$?" if [[ $? == "0" ]] ; then - mac="$(interface_get_mac_address "${iface}")" + mac=$(interface_get_mac_address "${iface}") eindent einfo "changed to ${mac}" eoutdent @@ -76,14 +76,14 @@ macchanger_pre_start() { return 1 fi - mac="$( /sbin/macchanger ${opts} "${iface}" \ - | sed -n -e 's/^Faked MAC:.*\<\(..:..:..:..:..:..\)\>.*/\U\1/p' )" + 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' )" + mac=$(/sbin/macchanger ${opts} "${iface}" \ + | sed -n -e 's/^Faked MAC:.*\<\(..:..:..:..:..:..\)\>.*/\U\1/p' ) fi if [[ -z ${mac} ]] ; then diff --git a/net-scripts/net/macnet.sh b/net-scripts/net/macnet.sh index 86a3453..eca6b74 100644 --- a/net-scripts/net/macnet.sh +++ b/net-scripts/net/macnet.sh @@ -29,7 +29,7 @@ macnet_pre_start() { # address isn't consistent - mainly wireless cards with firmware uploading. interface_up "${iface}" - local mac="$(interface_get_mac_address "${iface}")" + local mac=$(interface_get_mac_address "${iface}") [[ -z ${mac} ]] && return 0 vebegin "Configuring ${iface} for MAC address ${mac}" 2>/dev/null diff --git a/net-scripts/net/netplugd.sh b/net-scripts/net/netplugd.sh index ac2690f..ebdd02a 100644 --- a/net-scripts/net/netplugd.sh +++ b/net-scripts/net/netplugd.sh @@ -45,7 +45,7 @@ netplugd_pre_start() { # 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}")" + local mac=$(interface_get_mac_address "${iface}") if [[ -z ${mac} ]] ; then vewarn "netplug only works on interfaces with a valid MAC address" return 0 @@ -91,7 +91,7 @@ netplugd_pre_start() { local i=0 while true ; do if service_started "net.${iface}" ; then - local addr="$( interface_get_address "${iface}" )" + local addr=$(interface_get_address "${iface}") einfo "${iface} configured with address ${addr}" exit 0 fi diff --git a/net-scripts/net/pppd.sh b/net-scripts/net/pppd.sh index 24a3d25..6a630d0 100644 --- a/net-scripts/net/pppd.sh +++ b/net-scripts/net/pppd.sh @@ -23,79 +23,6 @@ pppd_check_installed() { return 0 } -# char *pppd_regex_escape(char *string) -# -# Returns the supplied string with any special regex -# characters escaped so they don't provide regex intructions -# This may be a candidate for adding to /sbin/functions.sh or -# net-scripts functions at some point -pppd_regex_escape() { - local escaped_result="$*" - escaped_result="${escaped_result//\\/\\\\}" - escaped_result="${escaped_result//./\\.}" - escaped_result="${escaped_result//+/\\+}" - escaped_result="${escaped_result//(/\\(}" - escaped_result="${escaped_result//)/\\)}" - escaped_result="${escaped_result//[/\\[}" - escaped_result="${escaped_result//]/\\]}" - escaped_result="${escaped_result//\{/\\\{}" - escaped_result="${escaped_result//\}/\\\}}" - escaped_result="${escaped_result//\?/\\\?}" - escaped_result="${escaped_result//\*/\\\*}" - escaped_result="${escaped_result//\//\\/}" - escaped_result="${escaped_result//|/\\|}" - escaped_result="${escaped_result//&/\\&}" - escaped_result="${escaped_result//~/\\~}" - escaped_result="${escaped_result//^/\\^}" - escaped_result="${escaped_result//$/\\$}" - echo "${escaped_result}" -} - -# bool pppd_update_secrets_file(char* filepath, char* username, \ -# char* remotename, char* password) -# -# Add/update PAP/CHAP authentication information -pppd_update_secrets_file() { - local filepath="$1" username="$2" remotename="$3" password="$4" - if [[ ! -s ${filepath} ]] ; then - echo '#'client$'\t'server$'\t'secret$'\t'IP addresses > "${filepath}" \ - && chmod 0600 "${filepath}" \ - || return 1 - fi - - #escape username and remotename, used in following sed calls - local regex_username="$(pppd_regex_escape "${username}")" - local regex_remotename="$(pppd_regex_escape "${remotename}")" - local regex_password - local regex_filter="[ \t]*\"?${regex_username}\"?[ \t]*\"?${regex_remotename}\"?[ \t]*" - - #read old password, including " chars - #for being able to distinct when we need to add or update auth info - local old_password="$( - sed -r -e "/^${regex_filter}\".*\"[ \t]*\$/\ - {s/^${regex_filter}(\".*\")[ \t]*\$/\1/;q;};\ - d;" \ - "${filepath}" - )" - - if [[ -z "${old_password}" ]] ; then - regex_username="${username//\\/\\\\}" - regex_remotename="${remotename//\\/\\\\}" - regex_password="${password//\\/\\\\}" - regex_password=${password//"/\\\\"} - sed -r -i -e "\$a\"${regex_username}\" ${regex_remotename} \"${regex_password}\"" ${filepath} - vewarn "Authentication info has been added to ${filepath}" - elif [[ "\"${password//\"/\\\"}\"" != "${old_password}" ]] ; then - regex_password="${password//\\/\\\\}" - regex_password="${regex_password//\//\\/}" - regex_password="${regex_password//&/\\&}" - regex_password=${regex_password//\"/\\\\\"} - sed -r -i -e "s/^(${regex_filter}\").*(\"[ \t]*)\$/\1${regex_password}\2/" ${filepath} - vewarn "Authentication info has been updated in ${filepath}" - fi - return 0 -} - # bool pppd_start(char *iface) # # Start PPP on an interface by calling pppd @@ -104,7 +31,7 @@ pppd_update_secrets_file() { pppd_start() { ${IN_BACKGROUND} && return 0 - local iface="$1" ifvar="$(bash_variable "$1")" opts="" link + local iface="$1" ifvar=$(bash_variable "$1") opts= link= i= if [[ ${iface%%[0-9]*} != "ppp" ]] ; then eerror "PPP can only be invoked from net.ppp[0-9]" return 1 @@ -132,23 +59,6 @@ pppd_start() { return 1 fi - # Might or might not be set in conf.d/net - local user password i - username="username_${ifvar}" - password="password_${ifvar}" - - #Add/update info in PAP/CHAP secrets files - if [[ -n ${!username} ]] \ - && [[ -n ${!password} || -z ${!password-x} ]] ; then - for i in chap pap ; do - if ! pppd_update_secrets_file "/etc/ppp/${i}-secrets" \ - "${!username}" "${iface}" "${!password}" ; then - eerror "Failed to update /etc/ppp/${i}-secrets" - return 1 - fi - done - fi - # Load any commandline options opts="pppd_${ifvar}[@]" opts="${!opts}" @@ -161,6 +71,26 @@ pppd_start() { fi done + # Might be set in conf.d/net + local username= password= + username="username_${ifvar}" + password="password_${ifvar}" + if [[ -n ${!username} ]] \ + && [[ -n ${!password} || -z ${!password-x} ]] ; then + local fd=3 + # fd 3 maybe in use, so find another one + while [[ -e /proc/$$/fd/${fd} ]] ; do + ((fd++)) + # Don't use fd 5 + [[ ${fd} == 5 ]] && ((fd++)) + done + + password="${!password//\\/\\\\}" + password="${password//\"/\\\"}" + opts="${opts} plugin passwordfd.so passwordfd ${fd}" + eval exec "${fd}< <(echo -e -n \"${password}\")" + fi + # Check for mtu/mru local mtu="mtu_${ifvar}" if [[ -n ${!mtu} ]] ; then @@ -201,7 +131,7 @@ pppd_start() { chatopts="${chatopts} -U '${phone_number[1]}'" fi fi - opts="${opts} connect $(requote "${chatopts} $(requote "${!chat}")")" + opts="${opts} connect $(requote "${chatopts} $(requote "${!chat}")")" # " fi # Add plugins @@ -209,6 +139,7 @@ pppd_start() { for i in "${!plugins}" ; do local -a plugin=( ${i} ) # Bound to be some users who do this + [[ ${plugin[0]} == "passwordfd" ]] && continue # Disable [[ ${plugin[0]} == "pppoe" ]] && plugin[0]="rp-pppoe" [[ ${plugin[0]} == "pppoa" ]] && plugin[0]="pppoatm" [[ ${plugin[0]} == "capi" ]] && plugin[0]="capiplugin" @@ -250,7 +181,8 @@ pppd_start() { ebegin "Running pppd" mark_service_inactive "net.${iface}" eval start-stop-daemon --start --exec /usr/sbin/pppd \ - --pidfile "/var/run/ppp-${iface}.pid" -- "${opts}" >/dev/null + --pidfile "/var/run/ppp-${iface}.pid" -- "${opts}" >/dev/null + if [[ $? != "0" ]] ; then eend $? "Failed to start PPP" mark_service_starting "net.${iface}" @@ -258,7 +190,7 @@ pppd_start() { fi if [[ " ${opts} " == *" updetach "* ]] ; then - local addr="$(interface_get_address "${iface}")" + local addr=$(interface_get_address "${iface}") einfo "${iface} received address ${addr}" else einfo "Backgrounding ..." diff --git a/net-scripts/net/pump.sh b/net-scripts/net/pump.sh index 51fc6ad..26b1a15 100644 --- a/net-scripts/net/pump.sh +++ b/net-scripts/net/pump.sh @@ -39,7 +39,7 @@ pump_check_installed() { # Return 0 if pump is not running or we stop it successfully # Otherwise 1 pump_stop() { - local iface="$1" count e + local iface="$1" count= e= # We check for a pump process first as querying for status # causes pump to spawn a process @@ -62,7 +62,7 @@ pump_stop() { # 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 + local iface="$1" opts= d= ifvar=$(bash_variable "$1") search= interface_exists "${iface}" true || return 1 @@ -93,7 +93,7 @@ pump_start() { eend $? || return $? # pump succeeded, show address retrieved - local addr="$(interface_get_address "${iface}")" + local addr=$(interface_get_address "${iface}") einfo "${iface} received address ${addr}" return 0 diff --git a/net-scripts/net/rename.sh b/net-scripts/net/rename.sh index f3de442..2331f79 100644 --- a/net-scripts/net/rename.sh +++ b/net-scripts/net/rename.sh @@ -22,8 +22,7 @@ rename_expose() { # # Checks to see if we have to rename the interface rename_pre_start() { - local iface="$1" newname="" mac ifvar="$(bash_variable "$1")" - + local iface="$1" newname= mac= ifvar=$(bash_variable "$1") interface_exists "${iface}" || return 0 newname="rename_${ifvar}" diff --git a/net-scripts/net/system.sh b/net-scripts/net/system.sh index c32bb74..d4e6742 100644 --- a/net-scripts/net/system.sh +++ b/net-scripts/net/system.sh @@ -19,7 +19,7 @@ system_expose() { } system_dns() { - local iface="$1" ifvar="$(bash_variable "$1")" x= domain= search= + local iface="$1" ifvar=$(bash_variable "$1") x= domain= search= local buffer= local -a servers=() @@ -52,7 +52,7 @@ system_dns() { } system_ntp() { - local iface="$1" ifvar="$(bash_variable "$1")" x= buffer= + local iface="$1" ifvar=$(bash_variable "$1") x= buffer= local -a servers=() servers="ntp_servers_${ifvar}[@]" @@ -76,7 +76,7 @@ system_ntp() { } system_nis() { - local iface="$1" ifvar="$(bash_variable "$1")" domain= x= buffer= + local iface="$1" ifvar=$(bash_variable "$1") domain= x= buffer= local -a servers=() servers="nis_servers_${ifvar}[@]" diff --git a/net-scripts/net/tuntap.sh b/net-scripts/net/tuntap.sh index 597cb12..921438e 100644 --- a/net-scripts/net/tuntap.sh +++ b/net-scripts/net/tuntap.sh @@ -55,7 +55,7 @@ tuntap_exists() { # # Create the device, give it the right perms tuntap_pre_start() { - local iface="$1" ifvar="$(bash_variable "$1")" + local iface="$1" ifvar=$(bash_variable "$1") local tuntap="tuntap_${ifvar}" [[ -z ${!tuntap} ]] && return 0 diff --git a/net-scripts/net/udhcpc.sh b/net-scripts/net/udhcpc.sh index 6fc1a19..909c784 100644 --- a/net-scripts/net/udhcpc.sh +++ b/net-scripts/net/udhcpc.sh @@ -38,14 +38,14 @@ udhcpc_check_installed() { # 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 + local iface="$1" pidfile="/var/run/udhcpc-$1.pid" d= [[ ! -f ${pidfile} ]] && return 0 ebegin "Stopping udhcpc on ${iface}" - local pid="$(<"${pidfile}")" e=true + local pid=$(<"${pidfile}") e=true - local ifvar="$(bash_variable "${iface}")" + local ifvar=$(bash_variable "${iface}") d="dhcp_${ifvar}" [[ -z ${!d} ]] && d="dhcp" @@ -69,12 +69,12 @@ udhcpc_stop() { # # Returns 0 (true) when a DHCP address is obtained, otherwise 1 udhcpc_start() { - local iface="$1" opts pidfile="/var/run/udhcpc-$1.pid" + local iface="$1" opts= pidfile="/var/run/udhcpc-$1.pid" local cachefile="/var/cache/udhcpc-$1.lease" d interface_exists "${iface}" true || return 1 - local ifvar="$(bash_variable "${iface}" )" opts + local ifvar=$(bash_variable "${iface}" ) opts= opts="udhcpc_${ifvar}" opts="${!opts}" @@ -83,7 +83,7 @@ udhcpc_start() { if [[ " ${!d} " != *" nosendhost "* ]]; then if [[ ! " ${opts}" =~ " -([hH] |-hostname=)" ]]; then - local hname="$(hostname)" + local hname=$(hostname) [[ -n ${hname} && ${hname} != "(none)" && ${hname} != "localhost" ]] \ && opts="${opts} --hostname=${hname}" fi @@ -118,7 +118,7 @@ udhcpc_start() { # Try and load the cache if it exists if [[ -f ${cachefile} ]]; then if [[ " ${opts}" != *" --request="* && " ${opts} " != *" -r "* ]]; then - local x="$(<"${cachefile}")" + local x=$(<"${cachefile}") # Check for a valid ip [[ ${x} == *.*.*.* ]] && opts="${opts} --request=${x}" fi @@ -138,7 +138,7 @@ udhcpc_start() { eend $? || return 1 # DHCP succeeded, show address retrieved - local addr="$(interface_get_address "${iface}")" + local addr=$(interface_get_address "${iface}") einfo "${iface} received address ${addr}" return 0 diff --git a/net-scripts/net/vlan.sh b/net-scripts/net/vlan.sh index f6c1e26..bf2e1fe 100644 --- a/net-scripts/net/vlan.sh +++ b/net-scripts/net/vlan.sh @@ -66,7 +66,7 @@ vlan_check_kernel() { # # Setup vconfig vlan_pre_start() { - local iface="$1" opts i x e ifvar="$(bash_variable "$1")" + local iface="$1" opts= i= x= e= ifvar=$(bash_variable "$1") opts="vconfig_${ifvar}[@]" [[ -z ${!opts} ]] && return 0 @@ -82,7 +82,7 @@ vlan_pre_start() { x="${opts[i]/ / ${iface} }" [[ ${x} == "${opts[i]}" ]] && x="${x} ${iface}" fi - e="$(vconfig ${x} 2>&1 1>/dev/null)" + e=$(vconfig ${x} 2>&1 1>/dev/null) [[ -z ${e} ]] && continue eerror "vconfig ${x}" eerror "${e}" @@ -98,8 +98,8 @@ vlan_pre_start() { # # Always returns 0 (true) vlan_post_start() { - local iface="$1" vlan vlans vlans_old ifname ifvar="$(bash_variable "$1")" - vlans="vlans_${ifvar}[@]" + local iface="$1" ifvar=$(bash_variable "$1") + local vlan= vlans= vlans_old= ifname= vlans="vlans_${ifvar}[@]" local start="vlan_start_${ifvar}" # BACKWARD COMPATIBILITY: check for old vlan variable name @@ -114,7 +114,7 @@ vlan_post_start() { # 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)" + e=$(vconfig add "${iface}" "${vlan}" 2>&1 1>/dev/null) if [[ -n ${e} ]] ; then eend 1 "${e}" continue @@ -127,11 +127,12 @@ vlan_post_start() { [[ -n ${!start} && ${!start} != "yes" ]] && continue # We need to work out the interface name of our new vlan id - ifname="$( \ + ifname=$( \ sed -n -e 's/^\([^ \t]*\) *| '"${vlan}"' *| .*'"${iface}"'$/\1/p' \ /proc/net/vlan/config - )" - iface_start "${ifname}" + ) + mark_service_started "net.${ifname}" + iface_start "${ifname}" || mark_service_stopped "net.${ifname}" done return 0 @@ -143,14 +144,16 @@ vlan_post_start() { # # Always returns 0 (true) vlan_stop() { - local iface="$1" vlan + 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 + if iface_stop "${vlan}" ; then + mark_service_stopped "net.${vlan}" + vconfig rem "${vlan}" >/dev/null + fi done return 0 diff --git a/net-scripts/net/wpa_supplicant.sh b/net-scripts/net/wpa_supplicant.sh index 4ecff2d..a366577 100644 --- a/net-scripts/net/wpa_supplicant.sh +++ b/net-scripts/net/wpa_supplicant.sh @@ -56,6 +56,9 @@ wpa_supplicant_check_installed() { # # Checks to see if wireless extensions are enabled on the interface wpa_supplicant_exists() { + # Support new sysfs layout + [[ -L /sys/class/net/$1/wiphy ]] && return 0 + [[ ! -e /proc/net/wireless ]] && return 1 grep -q "^[ \t]*$1:" /proc/net/wireless } @@ -64,10 +67,10 @@ wpa_supplicant_exists() { # # Gets the current ESSID of iface wpa_supplicant_get_essid() { - local i essid + local i= essid= for (( i=0; i<5; i++ )); do - essid="$( wpa_cli -i"$1" status | sed -n -e 's/^ssid=//p' )" + essid=$( wpa_cli -i"$1" status | sed -n -e 's/^ssid=//p' ) if [[ -n ${essid} ]] ; then echo "${essid}" return 0 @@ -92,7 +95,7 @@ wpa_supplicant_get_ap_mac_address() { # Note that just because we are associated does not mean we are using the # correct encryption keys wpa_supplicant_associated() { - local -a status + local -a status=() eval status=( $(wpa_cli -i"$1" status \ | sed -n -e 's/^\(key_mgmt\|wpa_state\|EAP state\)=\([^=]\+\).*/\U\"\2\"/p') ) @@ -116,7 +119,7 @@ wpa_supplicant_associated() { # # Kills any existing wpa_supplicant process on the interface wpa_supplicant_kill() { - local iface="$1" report="${2:-false}" pidfile + local iface="$1" report="${2:-false}" pidfile= # Shutdown wpa_cli first, if it's running # This is important as future versions of wpa_supplicant @@ -147,7 +150,7 @@ wpa_supplicant_kill() { # Returns 0 if wpa_supplicant associates and authenticates to an AP # otherwise, 1 wpa_supplicant_associate() { - local iface="$1" ifvar="$(bash_variable "$1")" timeout + local iface="$1" ifvar=$(bash_variable "$1") timeout= timeout="associate_timeout_${ifvar}" [[ -z ${!timeout} ]] && timeout="wpa_timeout_${ifvar}" timeout="${!timeout:--1}" @@ -200,15 +203,15 @@ wpa_supplicant_associate() { # 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="" actfile="" cfgfile="" + local iface="$1" opts= timeout= actfile= cfgfile= # We don't configure wireless if we're being called from # the background unless we're not currently running if ${IN_BACKGROUND} ; then if service_started_daemon "net.${iface}" /sbin/wpa_supplicant ; then if wpa_supplicant_exists "${iface}" ; then - ESSID="$( wpa_supplicant_get_essid "${iface}" )" - ESSIDVAR="$( bash_variable "${ESSID}" )" + ESSID=$(wpa_supplicant_get_essid "${iface}") + ESSIDVAR=$(bash_variable "${ESSID}") save_options "ESSID" "${ESSID}" metric=2000 fi @@ -218,7 +221,7 @@ wpa_supplicant_pre_start() { save_options "ESSID" "" - local ifvar="$( bash_variable "${iface}" )" + local ifvar=$(bash_variable "${iface}") opts="wpa_supplicant_${ifvar}" opts=" ${!opts} " [[ ${opts} != *" -D"* ]] \ @@ -234,15 +237,6 @@ wpa_supplicant_pre_start() { fi 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 - # 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. @@ -253,6 +247,15 @@ wpa_supplicant_pre_start() { fi 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 + ebegin "Starting wpa_supplicant on ${iface}" cfgfile="${opts##* -c}" @@ -275,7 +278,7 @@ wpa_supplicant_pre_start() { fi # Work out where the ctrl_interface dir is if it's not specified - local ctrl_dir="$( sed -n -e 's/[ \t]*#.*//g;s/[ \t]*$//g;s/^ctrl_interface=//p' "${cfgfile}" )" + local ctrl_dir=$(sed -n -e 's/[ \t]*#.*//g;s/[ \t]*$//g;s/^ctrl_interface=//p' "${cfgfile}") if [[ -z ${ctrl_dir} ]] ; then ctrl_dir="${opts##* -C}" if [[ -n ${ctrl_dir} && ${ctrl_dir} != "${opts}" ]] ; then @@ -330,11 +333,11 @@ wpa_supplicant_pre_start() { # Only report wireless info for wireless interfaces if wpa_supplicant_exists "${iface}" ; then # Set ESSID for essidnet and report - ESSID="$( wpa_supplicant_get_essid "${iface}" )" - ESSIDVAR="$( bash_variable "${ESSID}" )" + ESSID=$(wpa_supplicant_get_essid "${iface}" ) + ESSIDVAR=$(bash_variable "${ESSID}") save_options "ESSID" "${ESSID}" - local -a status + local -a status=() eval 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]}" @@ -353,7 +356,7 @@ wpa_supplicant_pre_start() { fi if [[ -n ${actfile} ]] ; then - local addr="$(interface_get_address "${iface}")" + local addr=$(interface_get_address "${iface}") einfo "${iface} configured with address ${addr}" exit 0 fi diff --git a/rc-lists/boot b/rc-lists/boot index 4229ac4..d705afe 100644 --- a/rc-lists/boot +++ b/rc-lists/boot @@ -1,4 +1,13 @@ bootmisc +checkroot +consolefont +keymaps +modules rmnologin +urandom +checkfs +clock domainname hostname +localmount +net.lo diff --git a/rc-lists/default b/rc-lists/default index 4083037..d6763ae 100644 --- a/rc-lists/default +++ b/rc-lists/default @@ -1 +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 index a826c33..6261a95 100755 --- a/sbin/MAKEDEV +++ b/sbin/MAKEDEV @@ -570,12 +570,7 @@ do makedev tty c 5 0 $tty $0 $opts fd $0 $opts ptmx - # Just generate a few pty's, since openvz depends on those - # for vzctl enter - for i in `seq 0 5`; do - makedev ptyp$i c 2 $i $tty - makedev ttyp$i c 3 $i $tty - done + $0 $opts pty ;; generic-*) echo "$0: no support for generic on this arch" >&2 diff --git a/sbin/MAKEDEV-gentoo.patch b/sbin/MAKEDEV-gentoo.patch new file mode 100644 index 0000000..bbca882 --- /dev/null +++ b/sbin/MAKEDEV-gentoo.patch @@ -0,0 +1,109 @@ +--- MAKEDEV ++++ MAKEDEV +@@ -102,8 +102,8 @@ + + if [ "$opt_V" ] + then +- echo "This is Debian MAKEDEV. For version info, try 'dpkg --list makedev'" +- echo "See /usr/share/doc/makedev/ for more information on Debian MAKEDEV." ++ echo "This is MAKEDEV based on Debian's makedev_2.3.1-78." ++ echo "See the MAKEDEV(8) manpage for more information." + exit 0 + fi + +@@ -308,60 +308,25 @@ + done + } + ++get_arch() { ++ case `uname -m` in ++ arm*) echo arm;; ++ i?86) echo i386;; ++ ppc*) echo powerpc;; ++ s390*) echo s390;; ++ sh*) echo sh;; ++ x86_64) echo i386;; ++ # alpha|hppa|ia64|m68k|mips|sparc ++ *) echo $a;; ++ esac ++} ++ + for arg in $* + do + # 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 +- ;; +- amd64) +- $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 +- ;; +- ppc64) +- $0 $opts generic-powerpc +- ;; +- s390) +- $0 $opts generic-s390 +- ;; +- sh*) +- $0 $opts generic-sh +- ;; +- sparc) +- $0 $opts generic-sparc +- ;; +- *) +- echo "$0: no support for generic on this arch" >&2 +- exit 1 +- ;; +- esac ++ $0 $opts generic-`get_arch` + ;; + generic-alpha) + $0 $opts std +@@ -596,6 +562,10 @@ + symlink mouse sunmouse + makedev openprom c 10 139 root root 0664 + ;; ++ generic-*) ++ echo "$0: no support for generic on this arch" >&2 ++ exit 1 ++ ;; + local) + $0.local $opts + ;; +@@ -690,8 +660,7 @@ + done + ;; + adb) +- # pick the right arch device using dpkg's knowledge +- case `dpkg --print-installation-architecture` in ++ case `get_arch` in + powerpc) + # ADB bus devices (char) + makedev adb c 56 0 $mouse diff --git a/sbin/functions.sh b/sbin/functions.sh index 7af6843..4aaa716 100644 --- a/sbin/functions.sh +++ b/sbin/functions.sh @@ -9,6 +9,9 @@ RC_GOT_FUNCTIONS="yes" # Check /etc/conf.d/rc for a description of these ... declare -r svclib="/lib/rcscripts" declare -r svcdir="${svcdir:-/var/lib/init.d}" +svcmount="no" +svcfstype="${svcfstype:-tmpfs}" +svcsize="${svcsize:-1024}" # Different types of dependencies deptypes="need use" @@ -31,10 +34,15 @@ RC_ENDCOL="yes" # # Default values for rc system # -RC_TTY_NUMBER="${RC_TTY_NUMBER:-0}" +RC_TTY_NUMBER="0" RC_PARALLEL_STARTUP="${RC_PARALLEL_STARTUP:-no}" RC_NET_STRICT_CHECKING="${RC_NET_STRICT_CHECKING:-none}" -RC_DOWN_INTERFACE="${RC_DOWN_INTERFACE:-yes}" +RC_USE_FSTAB="${RC_USE_FSTAB:-no}" +RC_USE_CONFIG_PROFILE="${RC_USE_CONFIG_PROFILE:-yes}" +RC_FORCE_AUTO="${RC_FORCE_AUTO:-no}" +RC_DEVICES="static" +RC_DOWN_INTERFACE="no" +RC_VOLUME_ORDER="" # # Default values for e-message indentation and dots @@ -65,6 +73,10 @@ import_addon() { 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(...) # @@ -73,6 +85,7 @@ splash() { profiling() { return 0 } +import_addon profiling-functions.sh # void bootlog(...) # @@ -80,6 +93,7 @@ profiling() { bootlog() { return 0 } +[[ ${RC_BOOTLOG} == "yes" ]] && import_addon bootlogger.sh # void get_bootconfig() # @@ -88,8 +102,34 @@ bootlog() { # parameters. # get_bootconfig() { - export BOOTLEVEL="boot" - export DEFAULTLEVEL="default" + 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 } @@ -97,6 +137,19 @@ get_bootconfig() { 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" && -n ${DEFAULTLEVEL} ]] && \ + [[ -d "/etc/runlevels/${BOOTLEVEL}.${DEFAULTLEVEL}" || \ + -L "/etc/runlevels/${BOOTLEVEL}.${DEFAULTLEVEL}" ]] ; then + export BOOTLEVEL="${BOOTLEVEL}.${DEFAULTLEVEL}" + fi + if [[ -z ${SOFTLEVEL} ]] ; then if [[ -f "${svcdir}/softlevel" ]] ; then export SOFTLEVEL=$(< "${svcdir}/softlevel") @@ -276,6 +329,11 @@ _eend() { [[ ${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 @@ -420,7 +478,30 @@ get_KV() { # EXAMPLE: if get_bootparam "nodevfs" ; then .... # get_bootparam() { - return 1 + 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, @@ -469,7 +550,23 @@ dolisting() { # Returns a config file name with the softlevel suffix # appended to it. For use with multi-config services. add_suffix() { - echo "$1" + if [[ ${RC_USE_CONFIG_PROFILE} != "yes" ]] ; then + echo "$1" + return 0 + fi + + local suffix="${SOFTLEVEL}" + [[ ${SOFTLEVEL} == "${BOOTLEVEL}" \ + || ${SOFTLEVEL} == "reboot" \ + || ${SOFTLEVEL} == "shutdown" \ + || ${SOFTLEVEL} == "single" ]] \ + && suffix="${DEFAULTLEVEL}" + if [[ -e "$1.${suffix}" ]] ; then + echo "$1.${suffix}" + else + echo "$1" + fi + return 0 } @@ -496,8 +593,12 @@ NET_FS_LIST="afs cifs coda davfs fuse gfs ncpfs nfs nfs4 ocfs2 shfs smbfs" # is_net_fs() { local fstype - # /proc/mounts is always accurate - fstype=$( sed -n -e '/^rootfs/!s:.* '"$1"' \([^ ]*\).*:\1:p' /proc/mounts ) + # /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 $? } @@ -520,7 +621,17 @@ is_union_fs() { # EXAMPLE: if is_uml_sys ; then ... # is_uml_sys() { - return 1 + grep -qs 'UML' /proc/cpuinfo +} + +# bool is_openvz_sys() +# +# return 0 if the currently running system is an OpenVZ VPS +# +# EXAMPLE: if is_openvz_sys ; then ... +# +is_openvz_sys() { + grep -qs '^envID:[[:space:]]*[1-9]' /proc/self/status } # bool is_vserver_sys() @@ -530,7 +641,18 @@ is_uml_sys() { # EXAMPLE: if is_vserver_sys ; then ... # is_vserver_sys() { - return 0 + grep -qs '^s_context:[[:space:]]*[1-9]' /proc/self/status || \ + grep -qs '^VxID:[[:space:]]*[1-9]' /proc/self/status +} + +# bool is_vps_sys() +# +# return 0 if the currently running system is a Linux VServer or OpenVZ +# +# EXAMPLE: if is_vps_sys ; then ... +# +is_vps_sys() { + is_vserver_sys || is_openvz_sys } # bool is_xenU_sys() @@ -540,7 +662,10 @@ is_vserver_sys() { # EXAMPLE: if is_xenU_sys ; then ... # is_xenU_sys() { - return 1 + [[ ! -d /proc/xen ]] && return 1 + [[ ! -r /proc/xen/capabilities ]] && return 1 + grep -q "control_d" /proc/xen/capabilities && return 1 + return 0 } # bool get_mount_fstab(path) @@ -552,7 +677,10 @@ is_xenU_sys() { # mount -n ${cmd} # get_mount_fstab() { - echo + gawk '$1 ~ "^#" { next } + $2 == "'$*'" { stab="-t "$3" -o "$4" "$1" "$2; } + END { print stab; } + ' /etc/fstab } # char *reverse_list(list) @@ -575,14 +703,6 @@ start_addon() { return 0 } -# void start_volumes() -# -# Starts all volumes in RC_VOLUME_ORDER. -# -start_volumes() { - return 0 -} - # void stop_addon(addon) # # Stops addon. @@ -593,14 +713,6 @@ stop_addon() { return 0 } -# void stop_volumes() -# -# Stops all volumes in RC_VOLUME_ORDER (reverse order). -# -stop_volumes() { - return 0 -} - # bool is_older_than(reference, files/dirs to check) # # return 0 if any of the files/dirs are newer than @@ -702,7 +814,6 @@ if [[ -z ${EBUILD} ]] ; then declare -r BOOTLEVEL DEFAULTLEVEL SOFTLEVEL fi else - setup_defaultlevels # Should we use colors ? if [[ $* != *depend* ]] ; then # Check user pref in portage @@ -4,15 +4,62 @@ trap ":" INT QUIT TSTP source /sbin/functions.sh +# Only source this when this is a livecd booting ... +[ -f /sbin/livecd-functions.sh ] && source /sbin/livecd-functions.sh umask 022 +# Quick test to see if we can be interactive or not +if [[ ${RC_INTERACTIVE:-yes} == "yes" ]] ; then + if tty -s && stty -a | grep -q " icanon" ; then + RC_INTERACTIVE="yes" + else + RC_INTERACTIVE="no" + fi +fi + +try() { + local errstr + local retval=0 + + if [ -c /dev/null ]; then + errstr="$((eval $*) 2>&1 >/dev/null)" + else + errstr="$((eval $*) 2>&1)" + fi + retval=$? + if [ "${retval}" -ne 0 ] + then + splash "critical" & + + echo -e "${ENDCOL}${NORMAL}[${BAD} oops ${NORMAL}]" + echo + eerror "The \"${1}\" command failed with error:" + echo + echo "${errstr#*: }" + echo + eerror "Since this is a critical task, startup cannot continue." + echo + einfo "Halting" + /sbin/halt -f + fi + + return ${retval} +} + # Check that $1 exists ... check_statedir() { [ -z "$1" ] && return 0 + if [ ! -d "$1" ] ; then if ! mkdir -p "$1" &>/dev/null ; then - echo + splash "critical" & + echo eerror "For Gentoo to function properly, \"$1\" needs to exist." + eerror "Please mount your root partition read/write, and execute:" + echo + eerror " # mkdir -p $1" + echo; echo + einfo "Halting" /sbin/halt -f fi fi @@ -20,6 +67,76 @@ check_statedir() { return 0 } +# void noblock_read(var) +# +# reads a line of input into var like regular read +# but it does not block waiting for input +# +noblock_read() { + local old_tty_settings="$(stty -g)" + stty -icanon min 0 time 0 + read "$@" + stty "${old_tty_settings}" +} + +# bool user_want_interactive(void) +# +# return 0 if user wants interactive mode +# +user_want_interactive() { + [[ ${RC_INTERACTIVE} != "yes" ]] && return 1 + + local user_input + noblock_read user_input + [[ ${user_input} == *"I"* || ${user_input} == *"i"* ]] +} + +# void do_interactive +# +# starts, skips, continues or drops to the shell +# depending on user selection +# +do_interactive() { + local service="$2" + + user_want_interactive && svcinteractive="yes" + if [[ ${svcinteractive} != "yes" || ! -e "/etc/init.d/${service}" ]] ; then + "$@" + return $? + fi + + local start_text="Start service" + local skip_text="Skip service" + local continue_text="Continue boot process" + local shell_text="Exit to shell" + + echo + echo "About to start the service ${service}" + PS3="Enter your selection: " + select action in "${start_text}" "${skip_text}" "${continue_text}" \ + "${shell_text}" + do + case ${action} in + "${start_text}") + "$@" + break + ;; + "${skip_text}") + break + ;; + "${continue_text}") + svcinteractive="no" + "$@" + break + ;; + "${shell_text}") + echo + sulogin "${CONSOLE}" + ;; + esac + done +} + get_critical_services() { local x= CRITICAL_SERVICES= @@ -31,7 +148,7 @@ get_critical_services() { CRITICAL_SERVICES="${CRITICAL_SERVICES} ${x##*/}" done else - CRITICAL_SERVICES="hostname" + CRITICAL_SERVICES="checkroot modules checkfs localmount clock" fi export CRITICAL_SERVICES @@ -57,11 +174,15 @@ argv1="$1" # First time boot stuff goes here. Note that 'sysinit' is an internal runlevel # used to bring up local filesystems, and should not be started with /sbin/rc # directly ... -if [[ ${argv1} = "sysinit" ]] +if [[ ( ${RUNLEVEL} == "S" || ${RUNLEVEL} == "1" ) && ${argv1} = "sysinit" ]] then # Setup initial $PATH just in case PATH="/bin:/sbin:/usr/bin:/usr/sbin:${PATH}" + # Help users recover their systems incase these go missing + [ -c /dev/null ] && dev_null=1 || dev_null=0 + [ -c /dev/console ] && dev_console=1 || dev_console=0 + # Set the console loglevel to 1 for a cleaner boot # the logger should anyhow dump the ring-0 buffer at start to the # logs, and that with dmesg can be used to check for problems @@ -71,32 +192,172 @@ then echo -e "${GOOD}Gentoo Linux${GENTOO_VERS}; ${BRACKET}http://www.gentoo.org/${NORMAL}" echo -e " Copyright 1999-2006 Gentoo Foundation; Distributed under the GPLv2" echo - + if [[ ${RC_INTERACTIVE} == "yes" ]] ; then + echo -e "Press ${GOOD}I${NORMAL} to enter interactive boot mode" + echo + fi check_statedir /proc + + ebegin "Mounting proc at /proc" + if [[ ${RC_USE_FSTAB} = "yes" ]] ; then + mntcmd=$(get_mount_fstab /proc) + else + unset mntcmd + fi + is_vserver_sys || try mount -n ${mntcmd:--t proc proc /proc -o noexec,nosuid,nodev} + eend $? + + # Read off the kernel commandline to see if there's any special settings + # especially check to see if we need to set the CDBOOT environment variable + # Note: /proc MUST be mounted + [ -f /sbin/livecd-functions.sh ] && livecd_read_commandline + + if ! is_vps_sys && [ "$(get_KV)" -ge "$(KV_to_int '2.6.0')" ] ; then + if [[ -d /sys ]] ; then + ebegin "Mounting sysfs at /sys" + if [[ ${RC_USE_FSTAB} = "yes" ]] ; then + mntcmd=$(get_mount_fstab /sys) + else + unset mntcmd + fi + try mount -n ${mntcmd:--t sysfs sysfs /sys -o noexec,nosuid,nodev} + eend $? + else + ewarn "No /sys to mount sysfs needed in 2.6 and later kernels!" + fi + fi + check_statedir /dev - # OpenVZ needs to mount proc from inside - if [[ ! -e /proc/self ]]; then - mount -t proc none /proc + # Fix weird bug where there is a /dev/.devfsd in a unmounted /dev + devfs_automounted="no" + if [ -e "/dev/.devfsd" ] + then + mymounts="$(awk '($3 == "devfs") { print "yes"; exit 0 }' /proc/mounts)" + if [ "${mymounts}" != "yes" ] + then + rm -f /dev/.devfsd + else + devfs_automounted="yes" + fi fi - - # OpenVZ also needs devpts for vzctl enter - if [[ ! -e /dev/pts/0 ]]; then + + # Try to figure out how the user wants /dev handled + # - check $RC_DEVICES from /etc/conf.d/rc + # - check boot parameters + # - make sure the required binaries exist + # - make sure the kernel has support + if [ "${RC_DEVICES}" = "static" ] + then + ebegin "Using existing device nodes in /dev" + eend 0 + else + fellback_to_devfs="no" + case "${RC_DEVICES}" in + devfs) devfs="yes" + udev="no" + ;; + udev) devfs="yes" + udev="yes" + fellback_to_devfs="yes" + ;; + auto|*) devfs="yes" + udev="yes" + ;; + esac + + # Check udev prerequisites and kernel params + if [ "${udev}" = "yes" ] + then + if get_bootparam "noudev" || \ + [ ! -x /sbin/udev -o ${devfs_automounted} = "yes" ] || \ + [ "$(get_KV)" -lt "$(KV_to_int '2.6.0')" ] + then + udev="no" + fi + fi + + # Check devfs prerequisites and kernel params + if [ "${devfs}" = "yes" ] + then + if get_bootparam "nodevfs" || [ "${udev}" = "yes" ] + then + devfs="no" + fi + fi + + # Actually start setting up /dev now + if [[ ${udev} == "yes" ]] ; then + start_addon udev + + # With devfs, /dev can be mounted by the kernel ... + elif [[ ${devfs} == "yes" ]] ; then + start_addon devfs + + # Did the user want udev in the config file but for + # some reason, udev support didnt work out ? + if [[ ${fellback_to_devfs} == "yes" ]] ; then + ewarn "You wanted udev but support for it was not available!" + ewarn "Please review your system after it's booted!" + fi + fi + + # OK, if we got here, things are probably not right :) + if [[ ${devfs} == "no" && ${udev} == "no" ]] ; then + clear + echo + einfo "The Gentoo Linux system initialization scripts have detected that" + einfo "your system does not support UDEV. Since Gentoo Linux has been" + einfo "designed with dynamic /dev in mind, it is highly suggested that you" + einfo "emerge sys-fs/udev and configure your system to use it." + einfo "Please read the Gentoo Handbook for more information!" + echo + einfo " http://www.gentoo.org/doc/en/handbook/" + echo + einfo "Thanks for using Gentoo! :)" + echo + read -t 15 -p "(hit Enter to continue or wait 15 seconds ...)" + fi + fi + + # From linux-2.5.68 we need to mount /dev/pts again ... + if ! is_vserver_sys && [ "$(get_KV)" -ge "$(KV_to_int '2.5.68')" ] + then have_devpts="$(awk '($2 == "devpts") { print "yes"; exit 0 }' /proc/filesystems)" - if [ "${have_devpts}" = "yes" ]; then - # Make sure we have /dev/pts - mkdir -p /dev/pts &>/dev/null || \ - ewarn "Could not create /dev/pts!" + if [ "${have_devpts}" = "yes" ] + then + # Only try to create /dev/pts if we have /dev mounted dynamically, + # else it might fail as / might be still mounted readonly. + if [ ! -d /dev/pts ] && \ + [ "${devfs}" = "yes" -o "${udev}" = "yes" ] + then + # Make sure we have /dev/pts + mkdir -p /dev/pts &>/dev/null || \ + ewarn "Could not create /dev/pts!" + fi - if [[ -d /dev/pts ]]; then + if [[ -d /dev/pts ]] ; then ebegin "Mounting devpts at /dev/pts" - mount -n -t devpts -o gid=5,mode=0620 devpts /dev/pts + if [[ ${RC_USE_FSTAB} = "yes" ]] ; then + mntcmd=$(get_mount_fstab /dev/pts) + else + unset mntcmd + fi + try mount -n ${mntcmd:--t devpts devpts /dev/pts -o gid=5,mode=0620,noexec,nosuid} eend $? fi fi fi + # Start logging console output since we have all /dev stuff setup + bootlog start + + # Start RAID/LVM/EVMS/DM volumes for /usr, /var, etc. + for x in ${RC_VOLUME_ORDER} ; do + start_addon "${x}" + done + # We set the forced softlevel from the kernel command line # It needs to be run right after proc is mounted for the # boot runlevel @@ -139,23 +400,86 @@ then # defaults. get_critical_services + splash "rc_init" "${argv1}" + + export START_CRITICAL="yes" + # We do not want to break compatibility, so we do not fully integrate # these into /sbin/rc, but rather start them by hand ... for x in ${CRITICAL_SERVICES} do + splash "svc_start" "${x}" if ! start_critical_service "${x}" ; then + splash "critical" &>/dev/null & + echo eerror "One or more critical startup scripts failed to start!" eerror "Please correct this, and reboot ..." echo; echo - einfo "Rebooting" + einfo "Halting" /sbin/halt -f fi + + splash "svc_started" "${x}" "0" done + unset START_CRITICAL + + # /var/log should be writable now, so starting saving the boot output + bootlog sync + + # have to run this after /var/run is mounted rw #85304 + if [ -x /sbin/irqbalance -a "$(get_KV)" -ge "$(KV_to_int '2.5.0')" ] + then + ebegin "Starting irqbalance" + /sbin/irqbalance + eend $? + fi + # Check that $svcdir exists ... check_statedir "${svcdir}" - + + # Should we use tmpfs/ramfs/ramdisk for caching dependency and + # general initscript data? Note that the 'gentoo=<fs>' kernel + # option should override any other setting ... + for fs in tmpfs ramfs ramdisk + do + if get_bootparam "${fs}" + then + svcmount="yes" + svcfstype="${fs}" + break + fi + done + if [ "${svcmount}" = "yes" ] + then + ebegin "Mounting ${svcfstype} at ${svcdir}" + case "${svcfstype}" in + ramfs) + try mount -t ramfs svcdir "${svcdir}" \ + -o rw,mode=0755,size="${svcsize}"k + ;; + ramdisk) + try dd if=/dev/zero of=/dev/ram0 bs=1k count="${svcsize}" + try /sbin/mke2fs -i 1024 -vm0 /dev/ram0 "${svcsize}" + try mount -t ext2 /dev/ram0 "${svcdir}" -o rw + ;; + tmpfs|*) + try mount -t tmpfs svcdir "${svcdir}" \ + -o rw,mode=0755,size="${svcsize}"k + ;; + esac + eend 0 + fi + + # If booting off CD, we want to update inittab before setting the runlevel + if [ -f "/sbin/livecd-functions.sh" -a -n "${CDBOOT}" ] + then + ebegin "Updating inittab" + livecd_fix_inittab + eend $? + /sbin/telinit q &>/dev/null + fi # Clear $svcdir from stale entries, but leave the caches around, as it # should help speed things up a bit @@ -182,6 +506,20 @@ then done ) + # If the user's /dev/null or /dev/console are missing, we + # should help them out and explain how to rectify the situation + if [ ${dev_null} -eq 0 -o ${dev_console} -eq 0 ] \ + && [ -e /usr/share/baselayout/issue.devfix ] + then + # Backup current /etc/issue + if [ -e /etc/issue -a ! -e /etc/issue.devfix ] + then + mv /etc/issue /etc/issue.devfix + fi + + cp /usr/share/baselayout/issue.devfix /etc/issue + fi + # Setup login records ... this has to be done here because when # we exit this runlevel, init will write a boot record to utmp # If /var/run is readonly, then print a warning, not errors @@ -197,13 +535,30 @@ then ewarn "Skipping /var/run/utmp initialization (ro root?)" fi + # Check and save if the user wants interactive + user_want_interactive && svcinteractive="yes" + echo "${svcinteractive:-no}" > "${svcdir}/interactive" + + # sysinit is now done, so allow init scripts to run normally + [[ -e /dev/.rcsysinit ]] && rm -f /dev/.rcsysinit + + # All done logging + bootlog quit + exit 0 fi # Sysinit ends here -if [[ ${argv1} == "boot" ]] +if [[ ( ${RUNLEVEL} == "S" || ${RUNLEVEL} == "1" ) && ${argv1} == "boot" ]] then setup_defaultlevels + if [ -n "${DEFAULTLEVEL}" -a "${DEFAULTLEVEL}" != "default" ] + then + # Setup our default runlevel runlevel that will be run + # the first time /sbin/rc is called with argv1 != sysinit|boot + echo "${DEFAULTLEVEL}" > "${svcdir}/ksoftlevel" + fi + # $BOOT can be used by rc-scripts to test if it is the first time # the 'boot' runlevel is executed export BOOT="yes" @@ -211,6 +566,26 @@ then # We reset argv1 to the bootlevel given on the kernel command line # if there is one argv1="${BOOTLEVEL}" + +elif [[ ${RUNLEVEL} != "S" && ${RUNLEVEL} != "1" && -e ${svcdir}/ksoftlevel ]] +then + argv1="$(< ${svcdir}/ksoftlevel)" + rm -f "${svcdir}/ksoftlevel" +elif [[ ${RUNLEVEL} != "S" && ${RUNLEVEL} != "1" && ${argv1} == "single" ]] +then + /sbin/telinit S + exit 0 +elif [[ ( ${RUNLEVEL} == "S" || ${RUNLEVEL} == "1" ) && ${argv1} != "single" ]] +then + level=$(awk -v level="${argv1}" ' + $2 == level { + split($0, fields, ":") + print fields[2] + exit + }' /etc/inittab 2>/dev/null) + [[ -z ${level} ]] && level=3 + /sbin/telinit "${level}" + exit 0 fi # Ensure that critical services are in the boot runlevel @@ -218,6 +593,8 @@ get_critical_services check_critical_services source "${svclib}/sh/rc-services.sh" +[[ -e "${svcdir}/interactive" ]] \ + && svcinteractive="$(<${svcdir}/interactive)" if [ -f "${svcdir}/softlevel" ] then @@ -252,10 +629,18 @@ else rm -rf "${svcdir}"/failed/* fi +splash "rc_init" "${argv1}" + + if [ "${SOFTLEVEL}" = "reboot" -o "${SOFTLEVEL}" = "shutdown" ] then myscripts= +elif [ "${SOFTLEVEL}" = "single" ] +then + + myscripts="${CRITICAL_SERVICES}" + elif [ ! -d "/etc/runlevels/${SOFTLEVEL}" ] then eerror "ERROR: runlevel ${SOFTLEVEL} does not exist; exiting ..." @@ -336,7 +721,8 @@ dep_stop() { && return 0 if [[ ${SOFTLEVEL} != "reboot" \ - && ${SOFTLEVEL} != "shutdown" ]] ; then + && ${SOFTLEVEL} != "shutdown" \ + && ${SOFTLEVEL} != "single" ]] ; then service_coldplugged "${service}" && return 0 if net_service "${service}" ; then [[ -z ${OLDSOFTLEVEL} ]] \ @@ -367,7 +753,8 @@ dep_stop() { } # Stop services -if [[ ${SOFTLEVEL} != "reboot" && \ +if [[ ${SOFTLEVEL} != "single" && \ + ${SOFTLEVEL} != "reboot" && \ ${SOFTLEVEL} != "shutdown" ]] then for i in $(get_stop_services) ; do @@ -420,11 +807,16 @@ if [[ ${SOFTLEVEL} == "reboot" || ${SOFTLEVEL} == "shutdown" ]] ; then # Call halt.sh with LC_ALL=C so that bash doesn't load any locales # which could interfere with unmounting /usr LC_ALL=C exec /etc/init.d/halt.sh "${SOFTLEVEL}" - + # Should never get here exit 0 fi +if [[ ${SOFTLEVEL} == "single" ]] ; then + /sbin/halt -f + exit 0 +fi + # Move the old softscritps directory to a different one # and make the new softscripts directory the current @@ -451,23 +843,50 @@ get_start_services() { # Start scripts for i in $(get_start_services) ; do if service_stopped "${i}" ; then - start_service "${i}" + do_interactive start_service "${i}" fi done # Wait for any services that may still be running ... -[ "${RC_PARALLEL_STARTUP}" = "yes" ] && wait +[[ ${RC_PARALLEL_STARTUP} == "yes" ]] && wait # Clean the old runlevel rm -rf "${svcdir}/softscripts.old" &>/dev/null +# Depends gets nuked, so update them +# (this problem should be solved now, but i think it will be a good idea +# to recreate the deps after a change in runlevel) + +#/sbin/depscan.sh &>/dev/null + +# We want devfsd running after a change of runlevel (this is mostly if we return +# from runlevel 'single') +if [ -z "`ps --no-heading -C 'devfsd'`" -a \ + -n "`gawk '/\/dev devfs/ { print }' /proc/mounts 2>/dev/null`" ] +then + if [ "${RC_DEVFSD_STARTUP}" != "no" ] + then + /sbin/devfsd /dev &>/dev/null + fi +fi + # Runlevel end, so clear stale fail list rm -rf "${svcdir}/failed" &>/dev/null # If we were in the boot runlevel, it is done now ... -[[ -n ${BOOT} ]] && unset BOOT +if [[ -n ${BOOT} ]]; then + unset BOOT + # Save our interactive mode into the default runlevel + user_want_interactive && svcinteractive="yes" + echo "${svcinteractive}" > "${svcdir}/interactive" +else + # As we're not boot, we remove the interactive file + [[ -e "${svcdir}/interactive" ]] && rm -f "${svcdir}/interactive" +fi # Remove the cached CONSOLETYPE unset CONSOLETYPE +splash "rc_exit" + # vim:ts=4 diff --git a/sbin/rc-services.sh b/sbin/rc-services.sh index 26cd7dc..ef4ccf1 100755 --- a/sbin/rc-services.sh +++ b/sbin/rc-services.sh @@ -396,10 +396,13 @@ start_service() { if is_fake_service "${service}" "${SOFTLEVEL}" ; then mark_service_started "${service}" + splash "svc_start" "${service}" + splash "svc_started" "${service}" "0" return 0 fi begin_service "${service}" || return 0 + splash "svc_start" "${service}" if [[ ${RC_PARALLEL_STARTUP} != "yes" || \ ${START_CRITICAL} == "yes" ]] ; then # if we can not start the services in parallel @@ -407,6 +410,8 @@ start_service() { ( "/etc/init.d/${service}" start ) service_started "${service}" || service_inactive "${service}" retval=$? + end_service "${service}" "${retval}" + splash "svc_started" "${service}" "${retval}" return "${retval}" else # if parallel startup is allowed, start it in background @@ -414,6 +419,8 @@ start_service() { "/etc/init.d/${service}" start service_started "${service}" || service_inactive "${service}" retval=$? + end_service "${service}" "${retval}" + splash "svc_started" "${service}" "${retval}" ) & return 0 fi @@ -439,12 +446,15 @@ stop_service() { is_runlevel_stop && level="${OLDSOFTLEVEL}" if is_fake_service "${service}" "${level}" ; then + splash "svc_stop" "${service}" mark_service_stopped "${service}" + splash "svc_stopped" "${service}" "0" return 0 fi begin_service "${service}" || return 0 + splash "svc_stop" "${service}" if [[ ${RC_PARALLEL_STARTUP} != "yes" || \ ${STOP_CRITICAL} == "yes" ]] ; then # if we can not start the services in parallel @@ -452,6 +462,8 @@ stop_service() { ( "/etc/init.d/${service}" stop ) service_stopped "${service}" retval=$? + end_service "${service}" "${retval}" + splash "svc_stopped" "${service}" "${retval}" return "${retval}" else # if parallel startup is allowed, start it in background @@ -459,6 +471,8 @@ stop_service() { ( "/etc/init.d/${service}" stop ) service_stopped "${service}" retval=$? + end_service "${service}" "${retval}" + splash "svc_stopped" "${service}" "${retval}" ) & return 0 fi @@ -774,12 +788,12 @@ trace_dependencies() { fi fi - if is_runlevel_stop ; then + if is_net_up || is_runlevel_stop ; then for x in $(dolisting "${svcdir}/started/net.*") \ $(dolisting "${svcdir}/inactive/net.*") ; do net_services="${net_services} ${x##*/}" done - elif is_runlevel_start || ! is_net_up ; then + else for x in $(dolisting "/etc/runlevels/${BOOTLEVEL}/net.*") \ $(dolisting "/etc/runlevels/${SOFTLEVEL}/net.*") ; do net_services="${net_services} ${x##*/}" diff --git a/sbin/runscript.sh b/sbin/runscript.sh index d6ca8a7..19b5f58 100755 --- a/sbin/runscript.sh +++ b/sbin/runscript.sh @@ -76,12 +76,6 @@ svcrestart="no" # Functions to control daemons [[ ${RC_GOT_DAEMON} != "yes" ]] && source "${svclib}/sh/rc-daemon.sh" -if [[ ${SVCNAME%%.*} == "net" && ${SVCNAME#*.} != "${SVCNAME}" ]] ; then - NETSERVICE="yes" -else - NETSERVICE="no" -fi - # Source configuration files. # (1) Source /etc/conf.d/net if it is a net.* service # (2) Source /etc/conf.d/${SVCNAME} to get initscript-specific @@ -89,7 +83,7 @@ fi # (3) Source /etc/rc.conf to pick up potentially overriding # configuration, if the system administrator chose to put it # there (if it exists). -if [[ ${NETSERVICE} == "yes" ]] ; then +if net_service "${SVCNAME}" ; then conf="$(add_suffix /etc/conf.d/net)" [[ -e ${conf} ]] && source "${conf}" fi @@ -196,23 +190,16 @@ svc_stop() { service_message "Service ${SVCNAME} stopping" if in_runlevel "${SVCNAME}" "${BOOTLEVEL}" && \ - [[ ${SOFTLEVEL} != "reboot" && ${SOFTLEVEL} != "shutdown" ]] ; then + [[ ${SOFTLEVEL} != "reboot" && ${SOFTLEVEL} != "shutdown" && \ + ${SOFTLEVEL} != "single" ]] ; then ewarn "WARNING: you are stopping a boot service." fi - + if [[ ${svcpause} != "yes" && ${RC_NO_DEPS} != "yes" ]] ; then - if [[ ${NETSERVICE} == "yes" ]] ; then - # A net.* service - if in_runlevel "${SVCNAME}" "${BOOTLEVEL}" || \ - in_runlevel "${SVCNAME}" "${mylevel}" ; then - # Only worry about net.* services if this is the last one - # running or if RC_NET_STRICT_CHECKING is set ... - ! is_net_up && mydeps="net" - fi - mydeps="${mydeps} ${SVCNAME}" - else - mydeps="${SVCNAME}" + if net_service "${SVCNAME}" ; then + is_net_up || mydeps="net" fi + mydeps="${mydeps} ${SVCNAME}" fi # Save the IN_BACKGROUND var as we need to clear it for stopping depends @@ -221,11 +208,8 @@ svc_stop() { for mydep in ${mydeps} ; do for x in $(needsme "${mydep}") ; do - # Service not currently running, continue - if service_started "${x}" ; then - stop_service "${x}" - service_list=( "${service_list[@]}" "${x}" ) - fi + service_started "${x}" && stop_service "${x}" + service_list=( "${service_list[@]}" "${x}" ) done done @@ -258,7 +242,11 @@ svc_stop() { exit "$@" } # Stop einfo/ebegin/eend from working as parallel messes us up - [[ ${RC_PARALLEL_STARTUP} == "yes" ]] && RC_QUIET_STDOUT="yes" + if [[ ${RC_PARALLEL_STARTUP} == "yes" ]] ; then + [[ ${RC_VERBOSE} != "yes" \ + || -e ${svcdir}/exclusive/${SVCNAME} ]] \ + && RC_QUIET_STDOUT="yes" + fi stop ) retval="$?" @@ -295,7 +283,7 @@ svc_stop() { else mark_service_stopped "${SVCNAME}" fi - service_message "Stopped service ${SVCNAME}" + service_message "Service ${SVCNAME} stopped" fi # Reset the trap @@ -356,7 +344,8 @@ svc_start() { # Start dependencies, if any. if ! is_runlevel_start ; then for x in ${startupservices} ; do - if [[ ${x} == "net" && ${NETSERVICE} != "yes" ]] && ! is_net_up ; then + if [[ ${x} == "net" ]] && ! net_service "${SVCNAME}" \ + && ! is_net_up ; then for y in ${netservices} ; do service_stopped "${y}" && start_service "${y}" done @@ -372,6 +361,9 @@ svc_start() { # have a "before" dep but we don't dep on them. if is_runlevel_start ; then startupservices="${startupservices} $(valid_iafter "${SVCNAME}")" + if net_service "${SVCNAME}" ; then + startupservices="${startupservices} $(valid_iafter "net")" + fi fi if [[ " ${startupservices} " == *" net "* ]] ; then @@ -429,9 +421,13 @@ svc_start() { # Apply any ulimits if defined [[ -n ${RC_ULIMIT} ]] && ulimit ${RC_ULIMIT} - + # Stop einfo/ebegin/eend from working as parallel messes us up - [[ ${RC_PARALLEL_STARTUP} == "yes" ]] && RC_QUIET_STDOUT="yes" + if [[ ${RC_PARALLEL_STARTUP} == "yes" ]] ; then + [[ ${RC_VERBOSE} != "yes" \ + || -e ${svcdir}/exclusive/${SVCNAME} ]] \ + && RC_QUIET_STDOUT="yes" + fi start ) @@ -601,7 +597,7 @@ for arg in $* ; do if [[ ${IN_BACKGROUND} == "true" ]] ; then for x in $(dolisting "${svcdir}/snapshot/$$/") ; do - if service_stopped "${x##*/}" ; then + if [[ -x ${x} ]] && service_stopped "${x##*/}" ; then svc_schedule_start "${SVCNAME}" "${x##*/}" fi done @@ -663,7 +659,7 @@ for arg in $* ; do # Restart dependencies as well for x in $(dolisting "${svcdir}/snapshot/$$/") ; do - if service_stopped "${x##*/}" ; then + if [[ -x ${x} ]] && service_stopped "${x##*/}" ; then if service_inactive "${SVCNAME}" \ || service_wasinactive "${SVCNAME}" ; then svc_schedule_start "${SVCNAME}" "${x##*/}" @@ -688,7 +684,7 @@ for arg in $* ; do retval="$?" svcpause="no" ;; - --quiet|--nocolor|--nodeps) + --quiet|--nocolor|--nodeps|--verbose) ;; help) exec "${svclib}"/sh/rc-help.sh "${myscript}" help @@ -35,7 +35,6 @@ cp -ax net-scripts/conf.d ${DEST}/etc ln -sfn net.lo ${DEST}/init.d/net.eth0 cp ChangeLog ${DEST} -cp ChangeLog.vserver ${DEST} chown -R root:root ${DEST} chmod 0755 ${DEST}/sbin/* |