#! /bin/sh ### BEGIN INIT INFO # Provides: tcryptdisk # Required-Start: sshd # Required-Stop: # X-Start-Before: kdm # X-Interactive: true # Default-Start: 2 3 4 5 # Default-Stop: # Short-Description: Start cryptdisk # Description: Start cryptdisk ### END INIT INFO #set -e #echo sleep 5... #/bin/sleep 5 #declare encypted partitions/mountpoints fsfs="home" usbramdev=/dev/sdc1 mfail=0 notc=0 if [ ! -f /tc/key ]; then mount -o umask=277 $usbramdev /tc if [ $? -ne 0 ]; then cp /etc/crypttab_p /etc/crypttab echo USB ram mount failed! mfail=1 else if [ ! -f /tc/key ]; then notc=1 cp /etc/crypttab_p /etc/crypttab fi fi fi case "$1" in start) succ=0 for i in $fsfs ; do /sbin/cryptdisks_start $i && /bin/mount /$i succ=$? done if [ $succ -eq 0 ] && [ $mfail -eq 0 ]; then cp /etc/crypttab_nop /etc/crypttab fi if [ $notc -eq 1 ] && [ $mfail -eq 0 ]; then #You can re-create on /tc paswsord key file here echo Please re-create on /tc paswsord key file fi ;; stop) for i in $fsfs ; do /bin/umount /$i && /sbin/cryptdisks_stop $i done ;; *) echo "Usage: /etc/init.d/blah {start|stop}" exit 1 ;; esac exit 0