diff options
author | davidovski <david@davidovski.xyz> | 2022-03-29 23:26:43 +0100 |
---|---|---|
committer | davidovski <david@davidovski.xyz> | 2022-03-29 23:26:43 +0100 |
commit | 33d239ecb3d66db2b005afbe68a7029c3f2d2ee0 (patch) | |
tree | 3cd159b1bee621d19c9e228d6171bf8604d86db2 /mkinitrd/mkinitramfs.sh | |
parent | dffbbe56d3f9f17da0244f75b352b87bc0e244df (diff) |
added mkinitrd
Diffstat (limited to 'mkinitrd/mkinitramfs.sh')
-rw-r--r--[-rwxr-xr-x] | mkinitrd/mkinitramfs.sh | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/mkinitrd/mkinitramfs.sh b/mkinitrd/mkinitramfs.sh index 3b0fcaf..c8836f4 100755..100644 --- a/mkinitrd/mkinitramfs.sh +++ b/mkinitrd/mkinitramfs.sh @@ -2,7 +2,8 @@ # 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 @@ -11,7 +12,7 @@ copy() { file=$(type -p $1) fi - if [ "${#file}" != "0" ]; then + if [ "$file" != "" ] ; then cp $file $WDIR/$2 else echo "Missing required file: $1 for directory $2" @@ -34,9 +35,11 @@ fi printf "Creating $INITRAMFS_FILE... " -binfiles="bash cat cp dd killall ls mkdir mknod mount " +binfiles="sh cat cp dd killall ls mkdir mknod mount " binfiles="$binfiles umount sed sleep ln rm uname" binfiles="$binfiles readlink basename" +# debug +binfiles="$binfiles less bash dmesg xargs" # Systemd installs udevadm in /bin. Other udev implementations have it in /sbin if [ -x /bin/udevadm ] ; then binfiles="$binfiles udevadm"; fi @@ -62,6 +65,7 @@ mkdir -p $WDIR/etc/{modprobe.d,udev/rules.d} touch $WDIR/etc/modprobe.d/modprobe.conf ln -s lib $WDIR/lib64 ln -s ../bin $WDIR/usr/bin +ln -s ../lib $WDIR/usr/lib # Create necessary device nodes mknod -m 640 $WDIR/dev/console c 5 1 @@ -77,7 +81,7 @@ for file in $(find /etc/udev/rules.d/ -type f) ; do done # Install any firmware present -[ -e /lib/firmware ] && cp -a /lib/firmware $WDIR/lib +[ -e /lib/firmware ] && cp /lib/firmware $WDIR/lib # Copy the RAID configuration file if present if [ -f /etc/mdadm.conf ] ; then @@ -103,8 +107,6 @@ 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 @@ -148,7 +150,7 @@ if [ -x /sbin/lvm ] ; then ln -s lvm $WDIR/sbin/vgrename ln -s lvm $WDIR/sbin/vgck # Conf file(s) - cp -a /etc/lvm $WDIR/etc + cp /etc/lvm $WDIR/etc fi # Install libraries @@ -157,14 +159,15 @@ sort $unsorted | uniq | while read library ; do [ "$library" == "linux-gate.so.1" ]; then continue fi + copy $library lib done if [ -d /lib/udev ]; then - cp -a /lib/udev $WDIR/lib + cp -r /lib/udev $WDIR/lib fi if [ -d /lib/systemd ]; then - cp -a /lib/systemd $WDIR/lib + cp -r /lib/systemd $WDIR/lib fi # Install the kernel modules if requested @@ -185,6 +188,6 @@ fi ( cd $WDIR ; find . | cpio -o -H newc --quiet | gzip -9 ) > $INITRAMFS_FILE # Remove the temporary directory and file -#rm -rf $WDIR $unsorted +rm -rf $WDIR $unsorted printf "done.\n" |