#!/bin/sh # # # http://www.sdc.org/~leila/usb-dongle/usb-filesystem/linuxrc # # # devfs is not yet mounted, so don't use things like this: # #ROOT_DEV=/dev/loop/5 #DISK_DEV=/dev/ide/host0/bus0/target0/lun0/part4 ROOT_DEV=/dev/loop5 DISK_DEV=/dev/hda4 SECRET_START_MSG="Executing linuxrc on the USB thingy..." SECRET_PW_PROMPT="WHEE-DOGGIE-PASSWORD: " GPG_HOMEDIR=/root/.gnupg DISK_ENCRYPT_IV=/root/hard-disk-keyfile.gpg DISK_ENCRYPT_METHOD=aes-cbc-128 ################################################################### echo $SECRET_START_MSG # /proc/filesystems now needed by BB's mount. echo "Mounting proc (mount -n -t proc none /proc)..." mount -n -t proc none /proc echo "(unmounting the grub-initrd ramdisk...)" umount /initrd # echo "Remounting the USB thingy read-write..." ######## echo -n $SILLY_PROMPT /usr/bin/gpg --homedir $GPG_HOMEDIR \ --batch --no-tty --passphrase-fd 0 -q \ -d $DISK_ENCRYPT_IV | \ /sbin/losetup -e $DISK_ENCRYPT_METHOD -p 0 \ $ROOT_DEV $DISK_DEV echo "Mounting real root dev (mount $ROOT_DEV /new_root)..." mount -n $ROOT_DEV /new_root umount /proc cd /new_root echo "Running pivot_root (/sbin/pivot_root . initrd)..." /sbin/pivot_root . initrd hash -r # Use, for example /usr/bin/[ instead of /bin/[ now. # Kernel automatically mounted devfs the first time, but now we must. #if [ -c initrd/dev/.devfsd ]; then # echo "Mounting devfs (mount -n -t devfs none dev)..." # mount -n -t devfs none dev # # Old /dev (/initrd/dev) needs to be umounted after init # # is executed. Rc.sysinit can do this. #else # echo Devfs support does not seem to exist. #fi echo "Running init (exec /usr/sbin/chroot . sbin/init < dev/console 2>&1)..." exec /bin/chroot . sbin/init < dev/console 2>&1 exit 0