logo

bootstrap-initrd

Linux initrd generator to bootstrap a POSIX-ish system from a reasonably small binary seed git clone https://hacktivis.me/git/make-initrd.git
commit: d52f029df67cfae4a0ffd047a4594d980a14be97
parent 9aea00be9be18972e15afe45b5c019d244d5f4f1
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Fri, 22 Mar 2019 10:54:48 +0100

make-initrd: Add die() on preparation phase

Diffstat:

Mmake-initrd.bash16++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/make-initrd.bash b/make-initrd.bash @@ -7,10 +7,18 @@ out_base=initramfs-${kv} elves="lvm busybox blkid lsblk cryptsetup mksh zfs zpool" WORKDIR="$(pwd)" -test -e $out_base && rm -fr $out_base -mkdir -p $out_base && pushd $out_base -mkdir -p usr/bin bin lib dev proc sys newroot etc -ln -s /proc/mounts etc/mtab +die() { + echo "$@" + exit 1 +} + +if test -e "$out_base"; then + rm -fr "$out_base" || die "Failed: rm -fr $out_base" +fi +mkdir -p "$out_base" || die "Failed: mkdir $out_base" +pushd "$out_base" || die "Failed: pushd $out_base" +mkdir -p usr/bin bin lib dev proc sys newroot etc || die "Failed creating base directories" +ln -s /proc/mounts etc/mtab || die "Failed symlink for /etc/mtab" if test -d /lib/modules/$kv then