summaryrefslogtreecommitdiffstats
path: root/init_functions
AgeCommit message (Collapse)AuthorFilesLines
2012-01-29init: use fastboot, not skip to avoid fsckDave Reisner1-0/+5
Move this logic inside fsck_device as well, so that fastboot skips a possible fsck on the /usr partition as well. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-01-29init_functions: avoid using fsck_ret to check 0Dave Reisner1-7/+7
our fsck_ret function would always return true when passed 0, which clearly isn't what we want. Use a simple string compare instead. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-01-13Update PS1 ramfs -> rootfsGerardo Exequiel Pozzi1-1/+1
This is cosmetic change, but using rootfs is more correct than ramfs. [Rootfs is a special instance of ramfs or tmpfs, if that is enabled] Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
2011-12-01init_functions: redirect poll_device output to stderrDave Reisner1-1/+1
Fixes FS#27385 Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-11-29init_functions: rephrase bailout messageDave Reisner1-1/+1
I think this error is more confusing to most people than it needs to be, and it's not really accurate any longer. Generalize the message and inform the user that we simply couldn't find the root device. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-11-15init_functions: simplify parse_cmdlineDave Reisner1-21/+19
Do variable name validation via the case labels rather than via PEs. This frees up the fallthrough case to simply ignore things we don't understand (and not exist). Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-11-15fsck: implement basic fsck supportDave Reisner1-4/+65
This adds support for fsck'ing root at bootstrap if the fsck binary and necessary helpers are included. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-11-15init_functions: resolve M:m to device fileDave Reisner1-3/+19
Rather than immediately defaulting to /dev/root, attempt to resolve the major/minor pair back to a block device. If we can't do this properly, then fallback to /dev/root. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-11-15init_functions: generalize resolve_deviceDave Reisner1-41/+49
This allows a caller to pass in a device by name and get a /dev node returned. Note that this is heavily limited in that only the root device can be identified by major:minor. This might break init's API, if such a thing exists. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-11-15init_functions: move root resolution to separate functionDave Reisner1-1/+5
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-11-15init: use util-linux's /bin/mountDave Reisner1-13/+2
Providing this means we no longer need blkid for FS detection, as mount will do this for us. Adds a slight bloat to the image, in exchange for a huge convenience. Messaging is changed to assume that /bin/mount will provide useful feedback for us on failure. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-11-15init_functions: refactor poll_deviceDave Reisner1-11/+12
Beyond stylistic cleanup, add a conditional to ensure that we don't show the 'waiting for device' message if it already exists. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-10-22init_functions: avoid setting var without LHS0.7.5Dave Reisner1-0/+1
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-10-22init_functions: replace grep/sed with PEsDave Reisner1-12/+13
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-10-22init_functions: tighten up mount option gatheringDave Reisner1-26/+16
* Directly assign ro or rw to the rwopt rather than using readwrite as an intermediary * Use a default expansion to cut out an if block in determining the root fstype. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-10-01init_functions: use constants on LHS of testsDave Reisner1-3/+3
If we encounter a BOOT_IMAGE var taken from grub2, the first character could be a '(' which will throw off busybox's parser and error out. Reverse the comparison so that the LHS is always a constant, which can be compared to anything (including nothing at all). Fixes FS#26119. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-06-30init_functions/default_mount_handler: use -l option for blkid to avoid ↵Thomas Bächler1-1/+1
syntax errors in a later mount command Fixes FS#24969.
2011-06-25init: declare PATH, remove absolute pathsDave Reisner1-3/+3
We were never very consistent about this anyways. Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-16use consistent vim modelinesDave Reisner1-0/+2
This also adds a /bin/bash shebang to functions. While not technically necessary, this ensures that vim gives us the correct syntax highlight file. Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-07default_mount_handler: Only try to manually create the root device if ↵Thomas Bächler1-1/+1
devtmpfs is not used.
2011-06-07init_functions: simplify mount case of root=/dev/*Dave Reisner1-9/+5
/sys/class/block contains all of our block devices, including the partitions of each parent block device, so directly check for the existance of the dev file rather than looping. Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-07init_functions: support {LABEL,UUID}= syntaxDave Reisner1-0/+9
use blkid to resolve a tag name to a block device. Signed-off-by: Dave Reisner <d@falconindy.com>
2011-04-14Rewrite parse_cmdline (again)Thomas Bächler1-21/+38
This should properly handle all ugly characters in values, omit settings any forbidden variable names and take care of double-quoted values with spaces in them. This should finally fix FS#23467, FS#22080 and FS#13900.
2011-04-10Fix problems in parsing the kernel command lineThomas Bächler1-0/+25
The kernel command line allows quoted strings with whitespace in them. Until now, such parameters would crash /init and cause a kernel panic. Move parsing into a function and use the 'set' builtin to split /proc/cmdline into arguments. Fixes FS#13900 and FS#22080.
2011-03-27poll_device: use 'echo' instead of 'msg'.Thomas Bächler1-1/+1
Fixes FS#21314
2011-02-08Revert "mkinitcpio: mount real root device instead of symlink"Thomas Bächler1-3/+0
This reverts commit 9ef825cedd8228957f9bdd8df7ae543afd7e0001. The introduced change was inconsistent with the standard 'mount' behaviour and caused lots of confusion among LVM users.
2011-01-31poll_device: Remove -hThomas Bächler1-2/+2
It seems ash follows symlinks with -b.
2010-07-12mkinitcpio: mount real root device instead of symlinkDave Reisner1-0/+3
If a symlink such as /dev/disk/by-uuid/xxxxx is provided on the kernel cmdline, resolve it and mount that device instead of the symlink. This prevents some ugliness in the output of commands such as mount or df. Signed-off-by: Dave Reisner <d@falconindy.com>
2010-05-08Port 83ef38409182a9c024809553dff8c872902d0889 to init_functions too, to ↵Thomas Bächler1-1/+1
remove more eval hacks
2010-02-21poll_device: do not wait for a device to appear if udevd is not runningThomas Bächler1-5/+7
Devices will never "magically" appear when udevd is not running. Thus, poll_device now exits instantly when a device when udevd is not running. The return value is unchanged, just the delay is removed. Assuming that the drive is available just after loading the module is unsafe. However, "fast" devices like most (all?) pata/sata seem to work this way for many people. On "slow" devices like USB, we still have to wait - those will not work without udev.
2010-02-21Allow the second parameter of poll_device to be 0 - this fixes rootdelay=0Thomas Bächler1-1/+1
2010-02-20default_mount_hook: Use major and minor variables instead of a single ↵Thomas Bächler1-7/+9
rootdev variable This is nicer and more explicit than before, based on a patch by Benjamin Richter
2010-02-20Use $(( )) instead of printf "%d"Benjamin Richter1-2/+2
2010-02-20Cosmetic change: 'msg' function does not support '\n'Thomas Bächler1-1/+1
2010-02-20Use only a single loop for searching /sys/blockBenjamin Richter1-12/+8
2010-02-16launch_interactive_shell: add "export" for PS1Thomas Bächler1-1/+1
2010-02-16Remove the special handling for the default mount procedure, move it into a ↵Thomas Bächler1-0/+68
mount handler (default_mount_handler)
2010-02-15If we could not mount the real root device, or the init program did not ↵Thomas Bächler1-1/+3
exist on it, bail out instead of panicing In these cases, we will exec /bin/sh, such that manual recovery is still possible as sh has PID 1 An expert might be able to mount and switch_root manually. In any case, this is less scary than a panic and a useless trace.
2010-02-07Remove an extra whitespace from the emergency shell promptThomas Bächler1-1/+1
2010-01-29Nicer shell prompt in the break/emergency shellThomas Bächler1-0/+4
2009-08-05Do not rely on -L test; use -h instead.Loui Chang1-2/+2
See `man dash` Signed-off-by: Loui Chang <louipc.ist@gmail.com> Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2009-06-07Don't only check for block devices, but also for symbolic links.Thomas Bächler1-2/+2
If we have a symlink, we don't check further if it points to a block device, partially due to klibc's readlink being broken.
2009-06-06Add common poll_device functionThomas Bächler1-0/+15
2009-06-06Add a new file init_functions that contains common functions used in /init ↵Thomas Bächler1-0/+8
and the hooks