summaryrefslogtreecommitdiff
path: root/mkinitrd/mkinitramfs.sh
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-03-13 18:39:11 +0000
committerdavidovski <david@davidovski.xyz>2022-03-13 18:39:11 +0000
commitbfdef0f304e13766423aaabd1022c888e3193ff6 (patch)
treeda642096d046663fdd3455e64085aa72d442f779 /mkinitrd/mkinitramfs.sh
parent9f79ba0ae923d6a66326ebb68f7e7475f8ea4d1c (diff)
fixed mkinitrd
Diffstat (limited to 'mkinitrd/mkinitramfs.sh')
-rwxr-xr-xmkinitrd/mkinitramfs.sh17
1 files changed, 8 insertions, 9 deletions
diff --git a/mkinitrd/mkinitramfs.sh b/mkinitrd/mkinitramfs.sh
index 42fad85..9acff17 100755
--- a/mkinitrd/mkinitramfs.sh
+++ b/mkinitrd/mkinitramfs.sh
@@ -1,9 +1,8 @@
-#!/bin/sh
+#!/bin/bash
# This file based in part on the mkinitramfs script for the LFS LiveCD
# written by Alexander E. Patrakov and Jeremy Huntwork.
-copy()
-{
+copy() {
local file
if [ "$2" == "lib" ]; then
@@ -12,7 +11,7 @@ copy()
file=$(type -p $1)
fi
- if [ -n $file ] ; then
+ if [ "${#file}" != "0" ]; then
cp $file $WDIR/$2
else
echo "Missing required file: $1 for directory $2"
@@ -35,7 +34,7 @@ fi
printf "Creating $INITRAMFS_FILE... "
-binfiles="sh cat cp dd killall ls mkdir mknod mount "
+binfiles="bash cat cp dd killall ls mkdir mknod mount "
binfiles="$binfiles umount sed sleep ln rm uname"
binfiles="$binfiles readlink basename"
@@ -78,7 +77,7 @@ for file in $(find /etc/udev/rules.d/ -type f) ; do
done
# Install any firmware present
-cp -a /lib/firmware $WDIR/lib
+[ -e /lib/firmware ] && cp -a /lib/firmware $WDIR/lib
# Copy the RAID configuration file if present
if [ -f /etc/mdadm.conf ] ; then
@@ -104,6 +103,8 @@ for f in $binfiles ; do
copy $d/$f bin
done
+ln -s bash $WDIR/bin/sh
+
# Add lvm if present
if [ -x /sbin/lvm ] ; then sbinfiles="$sbinfiles lvm dmsetup"; fi
@@ -156,7 +157,6 @@ sort $unsorted | uniq | while read library ; do
[ "$library" == "linux-gate.so.1" ]; then
continue
fi
-
copy $library lib
done
@@ -167,8 +167,7 @@ if [ -d /lib/systemd ]; then
cp -a /lib/systemd $WDIR/lib
fi
-# Install 100 4957 100 4957 0 0 36023 0 --:--:-- --:--:-- --:--:-- 36182
-the kernel modules if requested
+# Install the kernel modules if requested
if [ -n "$KERNEL_VERSION" ]; then
find \
/lib/modules/$KERNEL_VERSION/kernel/{crypto,fs,lib} \