aboutsummaryrefslogtreecommitdiff
path: root/functions
AgeCommit message (Collapse)AuthorFiles
2012-02-24Revert "deal with both valid return codes of mount -a"Tom Gundersen1
This reverts commit fd54cc63cd6853b839d8a0d15ff7c8506743ac5a. The correct return codes of "mount -a" are: 0 all mounts succeeded 64 some mounts succeeded and some failed 32 all mounts failed We want to show "FAILED" on all return codes except for 0. There is a bug in the new mount where "ignored" is taken to be "failed", which gives some false negative. This will be fixed in util-linux.
2012-02-24deal with both valid return codes of mount -a2012.02.2Tom Gundersen1
Signed-off-by: Tom Gundersen <teg@jklm.no>
2012-02-03Small style cleanupLukas Fleischer1
* Add whitespace to arithmetic expressions. * Use boolean logic for semantically boolean variables. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-01-22functions: skip check for /proc/modulesDave Reisner1
kmod doesn't read from /proc/modules to get attributes like module init state, and won't act up when /proc isn't mounted or if /proc/modules doesn't exist. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-01-22functions: allow verbose output from status()Dave Reisner1
Detect -v as a parameter to status and avoid dumping everything to /dev/null. Use this to restore error output to modprobe on loading user-specified modules. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-01-18udev: don't override settle timeoutTom Gundersen1
The Arch default was 30 but upstream default was 120. This caused problems when udev-177-3 introduced a 30 second timeout for broken kernel drivers. We don't want to do this kind of fiddling in initscripts, if there is a need for overriding the timeout this should be added upstream to udev.conf. My feeling is that this is a bad idea, as there are now at least three different kinds of timeouts at play in udev, and if they are set to something incompatible it will cause unneccesary problems. Signed-off-by: Tom Gundersen <teg@jklm.no>
2012-01-14mount: no longer pass '-n' to mountTom Gundersen1
This was needed when /etc/mtab was a regular file in order to avoid writing to it when /etc/ was mounted ro. However, now it is not needed. Passing -n should have been a noop, except for the NILFS mount helper. It will only start the daemon if the -n flag is not passed. This fixes FS#22523. Tested-by: Alexander Lam <lambchop468@gmail.com> Signed-off-by: Tom Gundersen <teg@jklm.no>
2012-01-12functions: avoid usage of tacDave Reisner1
tac stupidly writes to a tempfile when the input isn't seekable, which is true in our case as it's reading from a pipe. Since the whole goal here is to avoid using disk, build an array in reverse. For whatever reason, Bash truly sucks at doing this from a execution time standpoint, but that isn't really a concern here. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-01-01timezone: correct check for when there is nothing to doTom Gundersen1
We were unconditionally copying the zoneinfo file when we should be doing nothing. Reported-by: Leonid Isaev <lisaev@umail.iu.edu> Signed-off-by: Tom Gundersen <teg@jklm.no>
2011-12-13status: break line after BKGD message2011.12.1Tom Gundersen1
This looked ok on screen due to line-wrap, but the logs were a mess. Should also avoid some lines being cut due to exceeding 256 chars. Reported-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Tom Gundersen <teg@jklm.no>
2011-12-13locale: export LANG to daemonsTom Gundersen1
This was not done in case $DAEMON_LOCALE was set and locale.conf did not exist. Fixes FS#27498. Signed-off-by: Tom Gundersen <teg@jklm.no>
2011-12-08/run: move /var/{run,lock} to /run/{,lock}Tom Gundersen1
All packages in core/extra now supports this, and keeping them separated might soon cause problems (in particular, I submitted a patch to rpcbind that would cause problems if the symlinks are not in place). Signed-off-by: Tom Gundersen <teg@jklm.no>
2011-11-26functions: read from /etc/mtab in umount_allDave Reisner1
The kernel won't store options it doesn't understand, so looking for _netdev in /proc/self/mountinfo is worthless. Note that when /etc/mtab is a symlink to /proc/self/mounts, libmount-powered mount will read from /run/mount/utab to find the _netdev option. Reported at: https://bbs.archlinux.org/viewtopic.php?pid=1021427 Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Tom Gundersen <teg@jklm.no>
2011-11-26hooks: add shutdown_preumount hookDevin J. Pohly1
This would be useful for filesystem monitoring software which needs to capture all changes to the filesystem - including the final writes to the random seed and wtmp. [tomegun: this hook is now the same as the postkillall hook, but that might change, so I agree with adding it for the sake of having sane semantics.] Signed-off-by: Devin J. Pohly <djpohly+arch@gmail.com> Signed-off-by: Tom Gundersen <teg@jklm.no>
2011-11-26fsck: skip remounting / fsck'ing the root fsTom Gundersen1
In case the initramfs already fsck'ed and mounted the root fs ro, we don't remount ro and fsck. We still remount the rootfs rw unconditionally at the end. We should probably stop doing this and require the user to specify rw/ro explicitly in fstab. We assume that the initramfs will also fsck and mount /usr, so we do not fsck any mounted fs (not restricted to the rootfs). Signed-off-by: Tom Gundersen <teg@jklm.no>
2011-11-13locale.sh: remove leftoversTom Gundersen1
We were in certain situations still writing to locale.sh. While it would not have caused any harm, it was unintended and now removed. This change means that locale.sh will no longer load the consolemap. This would only be useful if it had been reset accidentally, and logging in again would then fix a broken console. The issue is described in FS#18759. It is not clear to me if this is still an issue, or if it solved by our new utf8/non-utf8 handling. Either way, resetting the consolemap unconditionaly does not make much sense in case the user has changed it on purpose. It might make sense to factor out the vconsole initialization into a "setup/repair my console" script, similar to systemd's /lib/systemd/systemd-vconsole-setup, but that would have to wait for a future release. Reported-by: Dave Reisner <d@falconindy.com> Cc: Роман Кирилич <roman.kyrylych@gmail.com> Signed-off-by: Tom Gundersen <teg@jklm.no>
2011-11-10functions: move all logic to the end of the file2011.11.2Dave Reisner1
...where it belongs Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-11-08functions: fix a number of shortcomings in parse_envfileDave Reisner1
Embarassing. This function was just plain broken. - read/trim the correct variables - allow comments (only start of line, no midline) - allow quoting via single or double quotes. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-11-06functions: implement a environment file parserDave Reisner1
This adds a 'parse_envfile' function that reads files such as /etc/locale.conf and /etc/vconsole.conf without sourcing them as bash logic. Several benefits are realized from this: - Impossible to execute arbitrary code - Bad syntax won't prevent the entire file from being read - Possible to limit what variables are allowed Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-11-06functions: declare locale vars in an array for reuseDave Reisner1
This also fixes a bug that unintentionally sets LOCALE instead of just defaulting to a value when its empty. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-11-06functions: properly quote ${mounts[@]}Dave Reisner1
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-11-06functions: remove redundant 'return $?'Dave Reisner1
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-11-06fix non-uniform indentationDave Reisner1
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-11-05bootlog: filter out some more escapecodesTom Gundersen1
In particular "^[[119G". Signed-off-by: Tom Gundersen <teg@jklm.no>
2011-11-04swapoff: umount swap-backed fs before switching off swapTom Gundersen1
Factor out umounting. Explicitly skip umounting API directories, rather than matching on fs type. This allows us to e.g. unmount all tmpfs but leaving /run and /dev/shm alone. v3: fixed some regressions in v2, made 'API filesystems' less general v2: new umount_all implementation based on proposal by Dave and input from Anthony. Also, ignore ramfs as it is not backed by swap. Cc: Dave Reisner <d@falconindy.com> Cc: C Anthony Risinger <anthony@xtfx.me> Signed-off-by: Tom Gundersen <teg@jklm.no>
2011-10-29udev: binary moved, require 174Tom Gundersen1
2011-10-18DAEMON_LOCALE: support in the same way as locale.shTom Gundersen1
We don't have the problem with non-bash shells here, but better make the support uniform.
2011-10-18locale.sh: support /etc/locale.confTom Gundersen1
This is mainly to support non-bash shells that cannot source rc.conf. The format of /etc/locale.conf is described here: <http://0pointer.de/public/systemd-man/locale.conf.html>. If LANG is not set in locale.conf, then we fall back to LOCALE from rc.conf, as before. Signed-off-by: Tom Gundersen <teg@jklm.no>
2011-09-24respect the user's choice for /etc/localtimeDave Reisner1
This can be a symlink or a regular file, and rc.sysinit will preserve it as such. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-09-25bootlog: clean some more ANSI codes2011.09.1Tom Gundersen1
I was getting "^[71G", this fixed it. Signed-off-by: Tom Gundersen <teg@jklm.no>
2011-09-25kill: give proper error messages and increase timeoutTom Gundersen1
With the new logic we will only wait for the timeout in case of problems, we therefore increase the timeout as this will make problems more obvious. There has been reports of problems with processes not being terminated, but hopefully this should help us reproduce them. Signed-off-by: Tom Gundersen <teg@jklm.no>
2011-09-25timezone: create /etc/localtime as a symlinkDave Reisner1
Abstract out timezone setting into its own function, passing Country/Area as a parameter. Do some menial checking to make sure: - the zonefile actually exists, erroring when it doesn't - /etc/localtime is a symlink to the correct zoneinfo file, relinking when it isn't. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-09-25functions: clarify source of module loadingDave Reisner1
This isn't _all_ your modules. Just the extras specified from rc.conf. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
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.