Age | Commit message (Collapse) | Author | Files |
|
Move it into a function to allow clean error detection of all steps performed
and also to be able to reuse this in rc.single.
|
|
Use correct patterns and get rid of the /dev/null redirection workaround needed when trying to remove '..'.
|
|
For checking whether a daemon is started via the DAEMONS array we use ck_autostart() now.
So make in_array() generic as the name suggests instead of removing '@'-prefixes from array members behind ones back.
Suggested-by: Dave Reisner <d@falconindy.com>
|
|
This is just a bit simpler.
in_array() should be fixed to be non daemon specific in a later patch.
|
|
Revert to using in_array() instead of is_in_array() which actually doesn't exist.
|
|
|
|
No need to set $PATH any more now that is in functions
|
|
There are only two possible situations:
a) /var/run is a symlink to /run: Conditional result is always 'false' even without checking /var/run/daemons (which doesn't exist).
b) /var/run is a directory: Conditional result is always 'true' because any symlink was removed when cleaning /var/run.
So following changes can be made:
* /var/run/daemons can be removed unconditionally because a symlink doesn't survive cleaning of /var/run anyway.
* The check whether /var/run/daemons is a symlink can be dropped because it has actually no effect.
Furthermore we can refactor to use the same conditional used for cleaning /var/run because we can't create the symlink if /var/run is not a directory.
|
|
Currently $NETFS is used only for fsck and mount in rc.sysinit.
Since we moved it into functions, we can use it in netfs too to get rid of redundancy.
functions:
* Move 'nosysfs' from $NETFS into the mount -a type list because thats obviously the only meaningfull place.
* Add 'nofuse.glusterfs' to $NETFS to match the lists in netfs.
* Remove all 'no'-prefixes from $NETFS to make it more useful and readable.
* Add 'no'-prefixes to fsck and mount -a commands by parameter substitution.
netfs:
* Instead of the literals use $NETFS from functions which contains the same types now
|
|
Get rid of simple if-clauses and provide meaningfull exit code.
Maybe someone wants to abort suspend to disk/ram or something if umount fails
or even start this in a loop.
|
|
We set $PATH in functions now, so use it.
|
|
|
|
killall5 returns 2 if it didn't find any processes to send to. Using this avoids sleeping longer than needed. This saves another up to six seconds of reboot/shutdown/go-single time.
|
|
The exit code returned by the given command might be useful/expected, so don't discard but return it.
|
|
Variables should be empty anyway here.
|
|
$FSCK_OUT/$FSCK_ERR might not be set when:
* unset in some custom sysinit_prefsck hook
* calling fsck() from a shutdown hook
|
|
This prevents sysinit_prefsck hooks from overwriting the value.
|
|
Genaral scheme for hook positions is now:
run_hook pre_foo
if [[$WE_WANT_TO_DO_FOO]]]; then
stat_busy "Doing foo"
if [[$PRECONDITIONS_FOR_FOO_NOT_SATISFIED]]; then
stat_fail
else
...
stat_done
fi
fi
run hook post_foo
rc.sysinit
-----------
run_hook pre_foo
[[$WE_WANT_TO_DO_FOO]] && status "Doing foo" foo
run hook post_foo
functions
------------
foo() {
[[$PRECONDITIONS_FOR_FOO_NOT_SATISFIED]] && return 1
...
}
Rationale
Following this scheme as close as possible (without duplicating code and status messages)
makes stuff more readable and uniform.
Splitting kill_everything() into two new functions stop_all_daemons() and kill_all() also
allows customization of either daemons stopping or process killing in an easy way.
Suggested-by: Tom Gundersen <teg@jklm.no>
|
|
Now that we set PATH in functions, we can use is everywhere.
|
|
Prevent any word splitting where not intended.
|
|
Braces are not needed in this case as a variable name can not begin with a number.
|
|
The general rule is now: Align stat_{fail,done} with stat_busy
|
|
Signed-off-by: Sebastien Luttringer <seblu@seblu.net>
|
|
/etc/bash_completion.d/rc.d: line 19: `_rc.d': not a valid identifier
Signed-off-by: Sebastien Luttringer <seblu@seblu.net>
|
|
|
|
|
|
|
|
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.
|
|
When using process substitution with status(), the resulting /dev/fd/* might get lost before it is actualy used. This happens in case a custom stat_busy() forks a subshell.
|
|
Note: The code
status "$text" $command > $file
writes nothing because there's a &>/dev/null within status().
|
|
|
|
|
|
Patch to fix FS#24879, clearing terminal text formatting after
nonexistent daemon script failure in rc.d.
Signed-off-by: Jacob Okamoto <jacobokamoto@gmail.com>
Signed-off-by: Tom Gundersen <teg@jklm.no>
|
|
|
|
Thanks Dave Reisner for suggestion
Signed-off-by: Sebastien Luttringer <seblu@seblu.net>
|
|
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Signed-off-by: Tom Gundersen <teg@jklm.no>
|
|
To avoid setting the kernel timezone with an out-of-date /etc/localtime, we pass TZ
directly to hwclock.
Also document how TIMEZONE and HARDWARECLOCK are optional in rc.conf
Signed-off-by: Tom Gundersen <teg@jklm.no>
|
|
This is a cleanup of a commit 171da3d. We get errors because /tmp/. and /tmp/.. cannot
be deleted on boot. Send them to /dev/null.
Signed-off-by: Tom Gundersen <teg@jklm.no>
|