aboutsummaryrefslogtreecommitdiff
path: root/functions
AgeCommit message (Collapse)AuthorFiles
2012-06-08remove checks for /var/run and /var/lock as symlinksDave Reisner1
These are shipped as symlinks by filesystem 2012.06, so these checks are no longer needed. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-06-07module-load: silenceTom Gundersen1
We don't need to see all modules inserted on every boot. Signed-off-by: Tom Gundersen <teg@jklm.no>
2012-05-29udev: fix path so systemd can drop a symlinkTom Gundersen1
Signed-off-by: Tom Gundersen <teg@jklm.no>
2012-05-29fix another wrong pathTom Gundersen1
Signed-off-by: Tom Gundersen <teg@jklm.no>
2012-05-29systemd: correct some pathsTom Gundersen1
Signed-off-by: Tom Gundersen <teg@jklm.no>
2012-05-29add support for modules-load.d directoriesDave Reisner1
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-29vconsole: use the systemd toolTom Gundersen1
Signed-off-by: Tom Gundersen <teg@jklm.no>
2012-05-29tmpfiles,sysctl,binfmt: use the systemd toolsTom Gundersen1
No point in reinventing the wheel. These and other tools are shipped in the systemd-tools package. Functionality should be unchanged, but we no longer have to maintain the code. Signed-off-by: Tom Gundersen <teg@jklm.no>
2012-05-29fix /forcefsck logic with initcpio fsck hookSébastien Luttringer1
Currently, using "shutdown -F -r now" with fsck initcpio hook doesn't make a full fsck on reboot. Initscripts hook check if /run/initramfs/root-fsck is present to add -M option to fsck which disable check of mounted filesystem. Initcpio doesn't check /forcefsck file and create root-fsck file with a simple fsck check. Signed-off-by: Sébastien Luttringer <seblu@seblu.net>
2012-04-17functions: use a pipe for umount_all instead of a PEDave Reisner1
We don't care about the side effects of the subshell created by the pipe since everything is localized within this function. Use the more "canonical" syntax. This should stop the recurring bug reports that we seem to get from people who think they understand Bash syntax, e.g. FS#27203 FS#28331 FS#29145 FS#28582 FS#27098 FS#29496 Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-01udev: change to new locationTom Gundersen1
Both the old and the new location works at the moment, but we want to remove the symlink, so change to the new location. Signed-off-by: Tom Gundersen <teg@jklm.no>
2012-03-21fsck: add return value2012.03.1Tom Gundersen1
Reported-by: Lukas Fleischer <archlinux@cryptocrack.de> Signed-off-by: Tom Gundersen <teg@jklm.no>
2012-03-17crypttab: warn if using passphrase in /etc/crypttabTom Gundersen1
There is no reason not to use a keyfile, and allowing literal passphrases in crypttab has caused issues with the parsing in the past. Furthermore, it is not supported by any other crypttab implementation (to the best of my knowledge). The use of keyfiles have been the recomendation in /etc/crypttab for as long as I can remember. We are looking at refactoring the encryption support, and I think it makes sense to drop support for this when we move to the new implementation. Cc: Thomas Bächler <thomas@archlinux.org> Cc: Matthew Monaco <matt@0x01b.net> Cc: Dave Reisner <d@falconindy.com> Signed-off-by: Tom Gundersen <teg@jklm.no>
2012-03-17crypto: move function from sysinit to functionsTom Gundersen1
No functional change, just improve readability. Signed-off-by: Tom Gundersen <teg@jklm.no>
2012-03-17sysinit: do not unconditionally modprobe any moreTom Gundersen1
dm-mod and dm-crypt will be autoloaded when needed (at least on kernels newer than 2.6.36). The rtc modules should be compiled in, as they have been in the official kernels for some time. Signed-off-by: Tom Gundersen <teg@jklm.no>
2012-03-17sysinit: remove cryptsetup compatDave Reisner1
We haven't had the static binary in nearly 2 years, so simply call this without a PATH lookup. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-03-17fsck: move FORCEFSCK/FASTBOOT logic to fsck_allTom Gundersen1
Avoid global variables, and make things clearer. Signed-off-by: Tom Gundersen <teg@jklm.no>
2012-03-17reorder fsck opts, explicitly set end of options markerDave Reisner1
Fixes FS#28947. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-03-13Merge remote-tracking branch 'seblu/master'Tom Gundersen1
Conflicts: Makefile
2012-03-13Remove NEED_ROOT crapSébastien Luttringer1
This patch revert patch 042d197b4d989ec64. NEED_ROOT was introduced to fix bug FS#24095. But in fact it doesn't solve it because nobody use it. The idea was to allow initscripts developper to have a check runned by every scripts which tell if scripts need to be run as root (most of them) or not (and the script check itself which part of him have to be run as root). All this to display a cute error message. I think this complexity is superfluous and let part of initscript will fail if rights are not enough. I must confess that we should have marked this bug as wontfix rather than do that. Signed-off-by: Sébastien Luttringer <seblu@seblu.net>
2012-03-12timezone: always symlink to zoneinfo rather than copyingTom Gundersen1
Behave as described in the manpage. This makes sure that we don't need to write to /etc unnecessarily in case of updates to zoneinfo. The reason for keeping a copy in /etc was if /usr was on a separate unmounted partition, but this is no longer supported. Reported-by: Sébastien Luttringer <seblu@seblu.net> Signed-off-by: Tom Gundersen <teg@jklm.no>
2012-03-05functions: check for length before using arrayDave Reisner1
This avoids passing an empty array to umount Signed-off-by: Dave Reisner <dreisner@archlinux.org>
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>