aboutsummaryrefslogtreecommitdiff
path: root/functions
AgeCommit message (Collapse)AuthorFiles
2011-08-27Let background daemons show errors on stderrSebastien Luttringer1
Daemon running in background should let error output to be printed. Standart output is still hided to have a correct printing in default cases. This will help to detect error in daemon runned in background. This will also remove have_daemon call which is already called in start_daemon. Signed-off-by: Sebastien Luttringer <seblu@seblu.net>
2011-08-20Clean up more ANSI codes from /var/log/boot (close FS#25682)Tom Gundersen1
Signed-off-by: Eric BĂ©langer <snowmaniscool@gmail.com> Signed-off-by: Tom Gundersen <teg@jklm.no>
2011-08-20boot.log: clean ANSI codesTom Gundersen1
Suggested-by: Karol B?a?ewicz <karol.blazewicz@gmail.com> Suggested-by: Eric Bélanger <snowmaniscool@gmail.com> Signed-off-by: Tom Gundersen <teg@jklm.no>
2011-08-18functions: fix typo in warning messageTom Gundersen1
Fixes #25623. Reported-by: Segej Puykin <arch@sergej.pp.ru> Signed-off-by: Tom Gundersen <teg@jklm.no>
2011-07-28NEED_ROOT: default to off2011.07.3Tom Gundersen1
This keeps the functionality, but disables it by default. Individual scripts/functions can turn it on if they want. Signed-off-by: Tom Gundersen <teg@jklm.no>
2011-07-24arch-tmpfiles: add cmdline parametersDave Reisner1
Categorize actions as 'create' or 'remove', for finer control. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-07-24arch-tmpfiles: add new script to handle volatile file controlDave Reisner1
This is the same concept as systemd's tmpfiles handling, slightly simplified to avoid timed re-triggering of file cleaning. Most of our current file cleaning that takes place in rc.single and rc.sysinit is replaced by this, with the exception that we hold onto the /var/lock and /var/run for finer control, since we still check for the possibility of these directories being symlinks and adjust accordingly. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-07-17functions: Cosmetics: Refactor usage of local daemon variablesKurt J. Bosch1
2011-07-17Fix/unify quotingKurt J. Bosch1
The rules should be: * Use quotes when literal strings are involved. * Use quotes when ever using a substitution which might produce blanks as a possitional parameter unless word splitting is intended. * Use quotes on the right hand side within '[[ = ]]' unless pattern matching is intended. * Don't use quotes for substitutions where not needed as in assignments.
2011-07-17functions: Unify whitespace inside '(( ))'Kurt J. Bosch1
2011-07-17functions: Remove useless '$' within '(( ))'Kurt J. Bosch1
2011-07-12functions/rc.sysinit: Refactor 'Removing Leftover Files' codeKurt J. Bosch1
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.
2011-07-12functions: Make in_array() non DAEMONS specificKurt J. Bosch1
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>
2011-07-12functions: Use ck_autostart in stop_all_daemons()Kurt J. Bosch1
This is just a bit simpler. in_array() should be fixed to be non daemon specific in a later patch.
2011-07-10functions/netfs: Refactor filesystem type lists and $NETFSKurt J. Bosch1
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
2011-07-10functions: Speed up reboot/shutdown by recognizing killall5 exit code 2Kurt J. Bosch1
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.
2011-07-10functions: Make status() return the actual exit codeKurt J. Bosch1
The exit code returned by the given command might be useful/expected, so don't discard but return it.
2011-07-10functions/rc.sysinit: Refactor fsck-redirection to prevent breakageKurt J. Bosch1
$FSCK_OUT/$FSCK_ERR might not be set when: * unset in some custom sysinit_prefsck hook * calling fsck() from a shutdown hook
2011-07-10Refactor kill_everything, fsck_all and mount_all codeKurt J. Bosch1
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>
2011-07-10functions/rc.multi: Strip paths from binariesKurt J. Bosch1
Now that we set PATH in functions, we can use is everywhere.
2011-07-10functions: Add missing quotes in mount_all()Kurt J. Bosch1
Prevent any word splitting where not intended.
2011-07-10functions: Get rid of superfluous braces in udevd_modprobe()Kurt J. Bosch1
Braces are not needed in this case as a variable name can not begin with a number.
2011-07-02functions/rc.single: Clean up whitespaceKurt J. Bosch1
2011-06-28Move export PATH into functionsKurt J. Bosch1
Also sanitze the PATH for rc.single, rc.multi, rc.local and daemons.
2011-06-28functions: Make activate_vgs return 0 if noop for consistencyKurt J. Bosch1
2011-06-28Move activate_vgs and crypt stat_busy to the top for consistencyKurt J. Bosch1
2011-06-28Move fsck executable check into fsck_all() for consistencyKurt J. Bosch1
2011-06-28Refactor to get rid of simple if-constuctsKurt J. Bosch1
2011-06-28functions: Simplify kill_everything() omit_pid handlingKurt J. Bosch1
All credits go to: Dave Reisner <d@falconindy.com>
2011-06-28functions: Simplify ck_depends() for statementKurt J. Bosch1
2011-06-28Add some commentsKurt J. Bosch1
2011-06-28functions: Define $fsckret read-only because exposed to hookKurt J. Bosch1
2011-06-28Fix local statements missing in ck_depends, ck_pidfile, do_unlock, ↵Kurt J. Bosch1
kill_everything
2011-06-28Fix '>|' not used allways when redirecting to filesKurt J. Bosch1
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.
2011-06-28functions: Fix indentationKurt J. Bosch1
2011-06-24rc.multi/rc.single: Merge duplicated bootlogd stop code into a functionKurt J. Bosch1
2011-06-24rc.sysinit/rc.single: Merge UDev stuff into a functionKurt J. Bosch1
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
2011-06-24Simplify in_array functionKurt J. Bosch1
2011-06-24Some more cosmeticsKurt J. Bosch1
2011-06-24Some cosmeticsKurt J. Bosch1
2011-06-23functions: warn if daemons are started recursivelyTom Gundersen1
In particular, recomend against using ck_depends. Signed-off-by: Tom Gundersen <teg@jklm.no>
2011-06-23added get_pid() and ck_pidfile() (FS#18654)Andrwe Lord Weber1
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>
2011-06-22Move mount -a into functions to allow custom override (fsck on loop)Kurt J. Bosch1
2011-06-22Allow custom fsck on shutdown via hook (FS#18736)Kurt J. Bosch1
2011-06-22Simplify fsck functionsKurt J. Bosch1
2011-06-22Move fsck stuff into functions to allow custom overrides (FS#18736)Kurt J. Bosch1
2011-06-20status: adjust number of columns after loading modulesTom Gundersen1
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>
2011-06-19Adding hook sysinit_postmountjofko1
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>
2011-06-18Ensure rc.d scripts are run as rootSebastien Luttringer1
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>
2011-06-08Removed superfluous dollar signEric BĂ©langer1
Signed-off-by: Eric BĂ©langer <snowmaniscool@gmail.com> Signed-off-by: Tom Gundersen <teg@jklm.no>