Skip to content

Instantly share code, notes, and snippets.

@fapestniegd
Created December 17, 2010 19:43
Show Gist options
  • Select an option

  • Save fapestniegd/745576 to your computer and use it in GitHub Desktop.

Select an option

Save fapestniegd/745576 to your computer and use it in GitHub Desktop.
PREREQ="mdadm"
prereqs(){
echo "$PREREQ"
}
. /scripts/functions
case $1 in
prereqs)
prereqs
exit 0
;;
esac
log_begin_msg "Starting root-on-crypt"
/sbin/modprobe usb-storage
sleep 10;
/bin/mount -t ext2 /dev/sda1 /cryptkeys/boot
if [ ! -f /cryptkeys/boot/crypttab ]; then
echo "could not read /cryptkeys/boot/crypttab"
reboot;
else
/bin/cat /cryptkeys/boot/crypttab | \
awk '{print "cryptsetup --key-file /cryptkeys"$3" luksOpen "$2" "$1}'| \
while read READY_DEVICE ; do
echo "${READY_DEVICE}"
${READY_DEVICE}
done
fi
/bin/umount /cryptkeys/boot
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment