aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFiles
2010-07-11Both rc.single and rc.shutdown use the same code to kill everything.Victor Lowther3
Simplify it, and move that shared code into functions. Parsing the output of ls is Bad, especially when globbing works just as well and does not get confused by odd characters in filenames. bash has arithemetic for loops. Use them instead of while loops for iterating over arrays.
2010-07-11Bashify rc.single.Victor Lowther1
2010-07-11Bashify rc.multiVictor Lowther1
Change the daemon running loop to use a case statement. This is shorter and easier to read. Quote daemon names. Someday, someone may have a daemon name with a space in it.
2010-07-11Finish bashifying functions.Victor Lowther1
Slightly simplify hook-running infrastructure. Go ahead and declare add_hook and run_hook as readonly functions to prevent hooks from overwriting them. Too bad bash does not have lexically scoped variables -- if it does, we could do the same with the hook_funcs associative array. If $CONSOLEFONT is not declared, then just return out of set_consolefont. We do this early so that the entire body of the function is not in an if block. Replace trivial use of grep with bash regex conditional. Bash has regex support, and it allows us to replace most trivial uses of sed, grep, and awk. The fewer processes we create, the faster we go, and every little bit helps. I also think it is more readable to use a bash regex for the trivial stuff. Replace if statement with parameter expansion. ${foo:+-p ${foo}} expands to nothing if foo is not set, -p $foo if foo is set. Replace slightly too long echo staement with a here document. This adds a line, but making things more readable is worth it. Make sourcing functions.d files a tiny bit shorter and faster.
2010-07-11Simplify in_array.Victor Lowther1
All that extra checking for the first character being @ is not needed, simple parameter expansion will trim it off if it is there.
2010-07-11Clean up status() function.Victor Lowther1
Calling your args with $* will do nasty things if any of your args has a space in it. "$@" will always do The Right Thing. Just test the command directly, don't run it and then grab its exit value.
2010-07-11A little creative parameter expansion simplifies stat_die().Victor Lowther1
2010-07-11Bashify initscripts.Victor Lowther1
We rely on bash specific features (arrays and associative arrays). Trying to maintain POSIX compatibility is a net performancle loss, since native bash constructs tend to perform better and lend themselves to less buggy code. Start off by adding #!/bin/bash to the top of functions to make it clear that we are not POSIX, and to help text editors perform appropriate syntax highlighting. Tighten up the console size finding code a bit, and simplify the code that clears USECOLOR. Use [[ ]] instead of [ ] for conditional checking when running in bash. It is worth 10 - 30% speedup whenever you want to compare something. Instead of calling a command and then testing for nonzero exit status, just test the command exit status directly.
2010-07-06Use findmnt to make mtab2010.07-1Gerardo Exequiel Pozzi1
Use findmnt command new in util-linux-ng 2.18 to make mtab based on /proc/self/mountinfo. Otherwise use current method. Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> (added a check whether /proc/self/mountinfo exists -- Thomas)
2010-06-09network, rc.conf: Add NETWORK_PERSIST option2010.06-2Thomas Bächler2
Setting NETWORK_PERSIST="yes" will skip network shutdown. This is needed to cleanly halt or reboot the systemif your root device is on NFS. It does not affect network profiles.
2010-06-09Initialize /etc/mtab by copying /proc/mountsThomas Bächler1
Our current process of initializing /etc/mtab is hackish and probably error-prone, replace it by simply copying /proc/mounts.
2010-06-09Rewrite early RTC device creationThomas Bächler1
Creating the RTC device will result in an error if devtmpfs is used, as it already exists after loading the module. The new code skips the mknod if the device is already present. Additionally to rtc-cmos, we now also try to load rtc and genrtc, as some custom kernels use the "old" misc RTC device instead of the newer RTC class. In this case, the created device is also different. This should fix FS#18078.
2010-06-08Do not redirect the standard error of fsck to /dev/null by defaultThomas Bächler1
This sets FSCK_STDERR to /dev/stdout, but still makes it possible to override this behaviour in a hook.
2010-06-06Add nodevtmpfs at rc.shutdown when umountGerardo Exequiel Pozzi1
To avoid message about busy filesystem. Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
2010-06-03Add --action=add to udevadm trigger2010.06-1Thomas Bächler2
This is necessary as the new udev defaults to --action=change which breaks network device renaming.
2010-06-03Only mount /proc, /sys and /dev if they haven't been mounted already, use ↵Thomas Bächler1
devtmpfs instead of tmpfs if supported by the kernel
2010-05-18Include _netdev option in NETFS list when calling fsckDan McGee1
We don't want fsck looking at any network device, and we would otherwise check things like iSCSI devices during boot before the network was up. This doesn't quite work. Fixes FS#17887. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-04Remove bashism from inittab2010.05-3Dan McGee1
Fixes FS#19311, use POSIX compliant stdout/stderr redirection. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-04Bring back \e(K to locale.shRoman Kyrylych1
See FS#18759 for more details. Signed-off-by: Roman Kyrylych <roman@archlinux.org>
2010-05-03Apply 'encryption: Look for cryptsetup in various places' to rc.shutdown as well2010.05-2Thomas Bächler1
2010-05-03encryption: Look for cryptsetup in various places2010.05-1Thomas Bächler1
The cryptsetup binary will move to /sbin/cryptsetup and the static binary will be removed. Add code that will try /sbin/cryptsetup first, then /usr/sbin/cryptsetup and fall back to the old /sbin/cryptsetup.static if everything else fails.
2010-03-20Remove obsolete consolemap activation escape sequencesKurt J. Bosch1
2010-02-16Make consolefont code deferrable to avoid destroying splashKurt J. Bosch2
2010-02-16Correct previous patch to get fsck fail into splashKurt J. Bosch1
2010-02-15Add support for the fsck progress file descriptorKurt J. Bosch1
2010-02-15Always shutdown daemons, regardless of runlevel in rc.single tooKurt J. Bosch1
2010-01-26Move single_prekillall hook after the stat_busy message (as per request by ↵Thomas Bächler1
Kurt Bosch)
2010-01-24Extend copyright date to 2010Thomas Bächler1
2010-01-24Move shutdown_prekillall hook after the stat_busy message (as per request by ↵2010.01-1Thomas Bächler1
Kurt Bosch)
2010-01-05Merge branch 'hwclock-background' of git://code.toofishes.net/dan/initscriptsThomas Bächler1
2009-12-05Check that cryptsetup mapping exists before trying to remove itSolstice d'Hiver1
Signed-off-by: Roman Kyrylych <roman@archlinux.org>
2009-11-10rc.sysinit: remove unnecessary adjtime creationDan McGee1
This is an Arch initscripts original (commit 98c76a4), but is not actually necessary for hwclock to operate correctly, so kill it. The file is created automatically when `hwclock --systohc` is invoked. Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-10rc.sysinit: add and clarify clock commentsDan McGee1
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-10rc.sysinit: background hwclock callsDan McGee1
hwclock calls appear to block somewhere between 1 and 2 seconds when we have back-to-back calls. My theory (without looking at the code) is that hwclock has to synchronize to the 1 second intervals of the hardware clock, so it can sometimes take up to a second to complete. To get around this unpleasant behavior, we can background the calls at point X in the boot sequence, and then later at point Y in the script (when we absolutely need the clock actions to be complete), we wait on the subprocess. This allows the rest of the boot sequence, after the hwclock code block, to continue until the point where we wait on the subprocess. Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-07Remove redundant call to vgscan - this also fixes a "wrong" symlink in ↵2009.11-1Thomas Bächler1
combination with the new udev-based device mapper node creation
2009-11-06Correct last commit: Unset the STARTUP=1 variable in udevadm control only ↵Thomas Bächler2
after udev has settled
2009-11-05Set STARTUP=1 environment variable on initial udev triggering, required by ↵Thomas Bächler2
latest device-mapper rules
2009-11-05Remove code to create md* devices manually, this is done by udev these daysThomas Bächler1
2009-11-05Disable special handling of ACPI modulesThomas Bächler1
2009-11-05Only load rtc-cmos if rc.conf has proper clock settingsThomas Bächler1
2009-10-07Replace 'truncate file' logic in case of noclobberAaron Griffin1
We use ": > /foo" in a few cases to truncate a file. If noclobber happens to be set, this fails, so we'll use bash's >| operator instead to force it Suggested-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2009-10-07Empty mtab instead of deleting itAaron Griffin1
This fixes an issue with mount.aufs which requires mtab to be present and apparently will not create it on its own See FS#16497 Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2009-10-06Add hvc0 to inittab (commented by default)Aaron Griffin1
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2009-10-05network: support early 'up' for dhcp interfacesAaron Griffin1
Previous commit acac4f47597320f55995bdaf692d6f2335a1d67e attempted to parse the name of the interface from the config line, but neglected to check for "dhcp" config lines, in which case the interface is the name Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2009-10-05Always shutdown daemons, regardless of runlevelAaron Griffin1
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2009-09-24network: Use real interface name for ifconfig upAaron Griffin1
Using the variable name doesn't work in cases like this: my_interface_foo="eth0 blah blah" INTERFACES=(my_interface_foo) It produces errors like so: my_interface_foo no such device Fixes FS#16114 Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2009-09-24Fix stty/tput usage for columns againJim Pryor1
Cleans up double application of earlier fixes for this issue. Instead of calling $(tput cols 2>/dev/null), we now try tput cols silently to see whether it complains. If not, then we call $(tput cols) with no redirection of stderr. This way, we can get results other than 80. eliminate color when stdout is not terminal Signed-off-by: Jim Pryor <profjim@jimpryor.net> Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2009-09-21Replace \e with \033 for printfsAaron Griffin1
\e isn't recongized in all shells. This causes issues with the locale.sh script. For completeness, \e is replaced throughout the rc.sysinit script Original-idea-by: David Khunne <stahlheinzkockhausen@googlemail.com> Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2009-08-26Make the hook-system a bit more usableThomas Bächler5
This patch makes the hook names unique, prefixing them all with the script name (without the 'rc.') It also removes the explicit declarations of all elements of the array, bash assumes "" if they are uninitialized
2009-08-25Implement a hook-system that allows to add custom code to the initscripts at ↵Thomas Bächler5
certain places A function add_hook can be called from functions.d to register a hook function. The existing hooks are based on suggestions from Michael Towers (larch) and on the implementation of initscripts-extras-fbsplash which currently uses the strings passed to stat_busy and stat_done for this. More hooks can be added if requested. The implementation uses associative arrays and will thus only work with bash 4 or later