install -m 0755 init $(DESTDIR)/usr/libexec/dracut/init
install -m 0755 switch_root $(DESTDIR)/usr/libexec/dracut/switch_root
install -m 0755 dracut-functions $(DESTDIR)/usr/libexec/dracut/functions
- install -m 0755 echoer $(DESTDIR)/usr/libexec/dracut/echoer
mkdir $(DESTDIR)/usr/libexec/dracut/rules.d
- for rule in rules.d/*.rules ; do install -m 0644 $$rule $(DESTDIR)/usr/libexec/dracut/rules.d ; done
+ for rule in rules.d/*.rules ; do install -m 0644 $$rule $(DESTDIR)/usr/libexec/dracut ; done
for hooks in pre-*/* ; do install -m 0755 $$hook $(DESTDIR/usr/libexec/dracut ; done
clean:
rm -f *~
initfile=$dsrc/init
switchroot=$dsrc/switch_root
rulesdir=$dsrc/rules.d
-echoer=$dsrc/echoer
hookdirs="pre-udev pre-mount pre-pivot"
initdir=$(mktemp -d -t initramfs.XXXXXX)
done
# executables that we have to have
-exe="bash mount mknod mkdir modprobe udevd udevadm nash pidof sleep chroot echo cat sed"
+exe="bash mount mknod mkdir modprobe udevd udevadm nash pidof sleep chroot echo sed"
lvmexe="lvm"
cryptexe="cryptsetup"
# and some things that are nice for debugging
-debugexe="ls ln ps grep more dmesg"
+debugexe="ls ln ps grep more dmesg cat"
# udev things we care about
udevexe="/lib/udev/vol_id /lib/udev/console_init"
# install our scripts and hooks
inst "$initfile" "/init"
inst "$switchroot" "/sbin/switch_root"
-inst "$echoer" "/echoer"
for hookdir in $hookdirs; do
for hook in "$dsrc/$hookdir"/*; do
[[ -f $hook ]] && inst "$hook" "/$hookdir/${hook##*/}"
+++ /dev/null
-#!/bin/sh
-target=$1
-shift
-echo "$@" >"$target"
\ No newline at end of file
echo ; echo
echo "Bug in initramfs /init detected. Dropping to a shell. Good luck!"
echo
- exec sh -i
+ sh -i 2>/dev/console
}
getarg() {
- local o;
- for o in $(cat /proc/cmdline); do
+ local o line
+ read -r line </proc/cmdline
+ for o in $line; do
[ "${o%%=*}" = "$1" ] && { echo $o; break; }
done
return 1
#!/bin/sh
[ -f /cryptroot ] && {
echo "Encrypted root detected."
- cryptopts=$(cat /cryptroot)
+ read cryptopts </cryptroot
/sbin/cryptsetup luksOpen $cryptopts || emergency_shell
udevadm settle --timeout=30
}
ACTION!="add|change", GOTO="luks_end"
KERNEL!="sr*", IMPORT{program}="vol_id --export $tempnode"
-ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="/echoer /cryptroot $env{DEVNAME} luks-$env{ID_FS_UUID}"
+ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="/bin/sh -c 'echo $env{DEVNAME} luks-$env{ID_FS_UUID} >/cryptroot'"
LABEL="luks_end"