init: Remove unneeded test

Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
hooks/net: Refactor and remove sed cmd usage.

* ipconfig cmd writes a file in /tmp that is ready for direct evaluation.
We can use this instead of parsing the output, to do this some variable
renames are needed.

* Add /tmp as part of "base" layout since this can be used by others hooks/cmds.

Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
hooks/net: Add BOOTIF support

This feature was present in archiso_pxe_nbd for a long time.
it avoids to configure more than one device (if present) by ipconfig
with the same parameters.

Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
hooks/resume: Remove cut cmd usage

Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
install/base: Add an empty fstab

This is mainly for avoid this:
[ramfs /]# mount /dev/md0 /mnt/a
[ramfs /]# mount -o bind /mnt/a /mnt/b
[ramfs /]# mount -o bind,remount,ro /mnt/b
warning: can't open /etc/fstab: No such file or directory
[ramfs /]#

Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
init: remove size limitations from API filesystems

These are all root owned, so we don't need to be concerned about DoS
attacks via these FS's.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
init_functions: rephrase bailout message

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>
mkinitcpio: warn when no modules are added to the image

Maybe something went wrong with depmod after a kernel install, or the
user grabbed a kernel directory for an old kernel. Either way, if you're
using an initramfs, there's a very high probability that you'll have at
least 1 module on it.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
add_{file,symlink}: overwrite existing file

Now we fail silently if the file exists, which means there is no easy way to overwrite binaries.

I think it makes the most sense to do the following:
1) add all the busybox stuff as a basic system;
2) overwrite some of the links with any binaries we add to base hook;
3) allow users to write their own hooks to overwrite even more stuff.

This can now be done by this hook.

v2: make sure we are able to overwrite a symlink pointing to a directory

Signed-off-by: Tom Gundersen <teg@jklm.no>
functions: add verbose output for overwriting files

This goes in hand with an earlier commit which changed behavior to
silenltly overwrite files rather than silently fail.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
functions: don't allow add_binary to re-add deps

Since we now silently overwrite instead of silently failing on existing
files and symlinks, we have a lot of sodeps which are overwritten by
various binaries -- udevd and udevadm being one example. Nip this in
add_binary by doing our own check and preventing addition of
pre-existing files in the $BUILDROOT.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
lsinitcpio: columnize binaries output

Now that we're including symlinks to busybox on the prebuilt image, this
display needs a bit of tidying up.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
mkinitcpio: parse vars from config file last

This lets the config file be an override for any files or binaries added
by hooks.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
move all binaries to /usr/bin

Add compat symlinks from /bin, /sbin and /usr/sbin, so nothing is lost.

This will make sure that it is not possibly to install two different
versions of the same binary in PATH.

The main usecase of this is that we want to be able to override any
symlink provided by busybox by adding a binary by the same name. With
this patch we don't have to worry in case the busybox symlink and the
binary we add are in different directories; the last binary to be added
always takes precedence.

Signed-off-by: Tom Gundersen <teg@jklm.no>
busybox: create symlinks manually

This means that no "setup" of the initramfs is requried on boot,
and this should make testing a lot eaiser by just chrooting into
the ramfs to check if it works.

Signed-off-by: Tom Gundersen <teg@jklm.no>
init_functions: redirect poll_device output to stderr

Fixes FS#27385

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
mkinitcpio: add VERSION stamp to image

This is mostly a debugging aid. lsinitcpio will be taught to read this.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
lsinitcpio: read VERSION stamp out of image file

Report this version on -a if it's found.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
functions: don't fail on add_binary adding a non-binary

The function did its job, it just isn't going to add any deps. This
makes add_binary effectively a slightly more costly version of add_file.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
init: create /run/initramfs as mode 755

init doesn't set a umask, so this was previously created as world
writable and sticky.

Reported-by: Thomas Bächler <thomas@archlinux.org>
Signed-off-by: Dave Reisner <dreisner@archlinux.org>