Age | Commit message (Collapse) | Author | Files |
|
Braces are not needed in this case as a variable name can not begin with a number.
|
|
|
|
Also sanitze the PATH for rc.single, rc.multi, rc.local and daemons.
|
|
|
|
|
|
|
|
|
|
All credits go to: Dave Reisner <d@falconindy.com>
|
|
|
|
|
|
|
|
kill_everything
|
|
This avoids errors if one should set the noclobber shell option somewhere (within a daemon script or some custom function).
We already had this, but it seems gone lost mostly.
|
|
|
|
|
|
rc.single changes (when coming from multi-user):
* avoid settling UDev quietly as in rc.sysinit
* modules defined in rc.conf are loaded if missing
* minilogd is started before udevd as in rc.sysinit
rc.sysinit behaviour is unchanged
|
|
|
|
|
|
|
|
In particular, recomend against using ck_depends.
Signed-off-by: Tom Gundersen <teg@jklm.no>
|
|
Implemented suggestions of Dave.
get_pid:
Arguments: programname
Returns: PID of program
ck_pidfile:
Arguments: PID-file programname
Returns: 0 - PID in PID-file is of program
1 - PID in PID-file is not of program
Signed-off-by: Andrwe Lord Weber <archlinux@andrwe.org>
Signed-off-by: Tom Gundersen <teg@jklm.no>
|
|
|
|
|
|
|
|
|
|
In case loading modules enables a frambuffer with higher resolution than the
standard 80 columns, we recalculate the number of columns after all modules
have been loaded.
Original-patch-by: Aaron Griffin <aaronmgriffin@gmail.com>
Original-patch-by: Søren Poulsen <nikorpoulsen@gmail.com>
Signed-off-by: Tom Gundersen <teg@jklm.no>
|
|
In some cases is good to know when rc.sysinit is going to use /usr
See FS#24712
Signed-off-by: jofko <joffko@gmail.com>
[tomegun: added comment to 'functions' and changed name of hook]
Signed-off-by: Tom Gundersen <teg@jklm.no>
|
|
By default all script should be run as root.
If NEED_ROOT=0 is set before loading /etc/rc.d/functions in a rc.d scripts, this will not apply.
This allow script with only some part which require root level to call need_root() function
at beginning of those parts.
Close FS#24095
Signed-off-by: Sebastien Luttringer <seblu@seblu.net>
|
|
Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com>
Signed-off-by: Tom Gundersen <teg@jklm.no>
|
|
This patch improve coloring in light and transparent term.
It uses tput if available or default color code.
It remplace \033 by \e. It's a kind of rollback from commit 65f410,
because initscripts are now in bash, and argument
"\e isn't recongized in all shells" is not an issue anymore.
This is not done in locale.sh script which can be sourced by others shell,
so we try to be the more compliant as possible
Signed-off-by: Sebastien Luttringer <seblu@seblu.net>
|
|
(me) Update the offsets so can be merged now without any issues and respect
the indentation.
Implements FS#10536 - [initscripts] internal: save a pid from killall5
All credits to: Kurt J. Bosch
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
Signed-off-by: Tom Gundersen <teg@jklm.no>
|
|
This is allow a quick calling to /etc/rc.d scripts by calling a shell command.
By example, starting sshd and gpm can be done by typing: rc start sshd gpm
rc can also list available scripts and show which is started/stopped in DAEMONS
[tomegun: fixed detection of autostart of background services]
Signed-off-by: Sebastien Luttringer <seblu@seblu.net>
Signed-off-by: Tom Gundersen <teg@jklm.no>
|
|
A daemon is an executable _file_ in /etc/rc.d.
Directory like functions.d is not a daemon.
Signed-off-by: Sebastien Luttringer <seblu@seblu.net>
|
|
Signed-off-by: Sebastien Luttringer <seblu@seblu.net>
Signed-off-by: Tom Gundersen <teg@jklm.no>
|
|
* adhere to a consistant vim modeline
* use top-right/bottom-left braces for functions
Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Tom Gundersen <teg@jklm.no>
|
|
The else clause was missing in the return value test. This caused the status to remain
at BUSY instead of being changed to DONE for systems where CONSOLEMAP was not used.
Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com>
|
|
been activated.
|
|
|
|
This patch does 3 things:
1) Use declare -fr instead of -r, as -r does not affect functions.
2) Make sure everything is only defined once, as you cannot redefine a read-only function.
3) Fix indentation.
|
|
This is configurable by the new rc.conf option DAEMON_LOCALE.
|
|
This avoids problems with lack of rw filesystems.
Solves: #FS18153.
|
|
Split out reading /etc/crypttab and procssing the individual lines into
their own helper functions, and bashify the resulting shorter code.
Processing this file is still ugly, though. :(
|
|
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.
|
|
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.
|
|
All that extra checking for the first character being @ is not needed,
simple parameter expansion will trim it off if it is there.
|
|
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.
|
|
|
|
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>
|
|
|