Age | Commit message (Collapse) | Author | Files |
|
|
|
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.
|
|
See FS#18759 for more details.
Signed-off-by: Roman Kyrylych <roman@archlinux.org>
|
|
|
|
|
|
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>
|
|
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
|
|
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
|
|
In in_array a check might look like [ "!" = "@" ], which will fail because of the !,
so make this check look like [ "x!" = "x@" ].
Also, when an entry is prefixed with !, it should be handled as if it was not in the array.
|
|
Previous code has issues with ! and @ prefixed DAEMONS
Original-by: Florian Pritz <bluewind@xssn.at>
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
|
|
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
|
|
This corrects the usage of stty and tput under various non-TTY conditions
such as under cron and redirected output.
[Aaron: Also corrected my USECOLOR bug I introduced last patch]
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
|
|
This commit should allow rc.d scripts to be run
from non-tty's, such as a cron job
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
|
|
Flip the order in which daemons are shutdown. First we scan for
all daemons that are NOT in rc.conf and shut those down (order is
based on ls, so it is dependent on LC_COLLATE). Afterwards, we
shut down all daemons in rc.conf, in order
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
|
|
printf causes scripts to fail when argument starts with a dash
Calling stat_append "- hello" causes the following error:
/etc/rc.d/functions: line 99: printf: - : invalid option
printf: usage: printf [-v var] format [arguments]
[FAIL]
Ref: FS#15713
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
|
|
When errexit was set, sourcing functions caused a script to
exit. Fix this by using a real 'if' instead of the
[ a ] && b
syntax.
Also, fix the vim modeline :)
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
|
|
The status display functions were returning the opposite of what
they should have been. Also made cosmetic changes to the output.
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
|
|
This is useful for displaying daemon status in functions
like /etc/rc.d/$DAEMON status
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
|
|
This prevents a local TZ variable from breaking
daemon's when started by root. Daemon's should always
respect the system's /etc/localtime
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
|
|
|
|
Trivial simplification to make code more readable.
Removes one fork so booting should be "faster". Probably not mesureable
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
|
|
Signed-off-by: Anton Fiuman <llexiw@gmail.com>
|
|
This is an obvious oversight on my part - this change allows
the overridden functions to work in daemon scripts and
anything else that uses /etc/rc.d/functions by itself.
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
|
|
Example of use:
DEPENDS=('dbus' 'acpid')
. . .
ck_depends ${DEPENDS[@]}
and those daemons will be started if not running already
Signed-off-by: Roman Kyrylych <roman@archlinux.org>
|
|
Signed-off-by: Roman Kyrylych <roman@archlinux.org>
|
|
Signed-off-by: Roman Kyrylych <roman@archlinux.org>
|
|
|
|
Instead of using globbing which will fail on an empty directory, use an ls
call similar to other places in the initscripts which is not prone to
failure. (See rc.single in the daemon shutdown for example.)
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
There is no reason to use bashisms in functions, so eliminate any and use
printf instead of echo options which are not guaranteed to be implemented in
a POSIX sh.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
This is the easiest way to cleanup the script output on white terminals
without resorting to shutting off color.
It won't make everyone happy, though.
Ref: FS#1186
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
|
|
when tput returns exit code 3 - assume it output '8'
(as written in the /usr/share/terminfo/l/linux file)
Signed-off-by: Roman Kyrylych <roman@archlinux.org>
Converted to if/elsif form
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
|
|
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
|
|
|
|
(fixes #7369)
|
|
|
|
|
|
|
|
commented out the ldconfig call at startup, added support for unicode console maps, added a hotplug_ifup() function rc.d/network for hotplug's net.agent to use
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|