added init_manager
authorft
Mon, 28 Jul 2014 15:27:10 +0200
changeset 15f6fc3ab7f0c9
parent 14 4762c3abc17a
child 16 d1a3476471ca
added init_manager
added run_initlistener
management_scripts/init_manager.sh
management_scripts/run_initlistener.sh
truecrypt_scripts/truecrypt_init.sh
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/management_scripts/init_manager.sh	Mon Jul 28 15:27:10 2014 +0200
     1.3 @@ -0,0 +1,20 @@
     1.4 +#!/bin/sh
     1.5 +
     1.6 +DEVICE="$1"
     1.7 +
     1.8 +# This script makes sure that the stick is unmounted and unused
     1.9 +# Run this Script before the init process
    1.10 +
    1.11 +# make sure the device is not mounted
    1.12 +umount /var/run/usbmount/*
    1.13 +rmdir /var/run/usbmount/*
    1.14 +sleep 1
    1.15 +umount ${DEVICE}*
    1.16 +
    1.17 +# search for already encrypted volumes
    1.18 +device=$(encryptionprovider.py -g)
    1.19 +
    1.20 +if [ "$?" == "0" ]
    1.21 +then
    1.22 +	encryptionprovider.py -u $device
    1.23 +fi
    1.24 \ No newline at end of file
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/management_scripts/run_initlistener.sh	Mon Jul 28 15:27:10 2014 +0200
     2.3 @@ -0,0 +1,16 @@
     2.4 +#!/bin/sh
     2.5 +
     2.6 +DEVICE="$1"
     2.7 +
     2.8 +encryptionprovider.py -i eth0 58081 "$DEVICE" /media/usb0
     2.9 +if [ "$?" != "0" ]
    2.10 +then
    2.11 +	# this will happen if the stick was removed
    2.12 +	exit 0
    2.13 +fi
    2.14 +
    2.15 +mkdir /var/run/usbmount/encrypted
    2.16 +/usr/bin/osecfs /etc/osecfs/osecfs_usb.cfg "/var/run/usbmount/encrypted" rw
    2.17 +
    2.18 +# now stick is encrypted and mounted. Rerun Script
    2.19 +$0 $DEVICE 
    2.20 \ No newline at end of file
     3.1 --- a/truecrypt_scripts/truecrypt_init.sh	Tue Jun 10 09:22:20 2014 +0200
     3.2 +++ b/truecrypt_scripts/truecrypt_init.sh	Mon Jul 28 15:27:10 2014 +0200
     3.3 @@ -15,13 +15,11 @@
     3.4  fi
     3.5  
     3.6  # make sure to have "/dev/sdb" (not "/dev/sdb1")
     3.7 -#DEVICE="${DEVICE:0:8}" the bash way does not word in dash -.-
     3.8 +#DEVICE="${DEVICE:0:8}" the bash way does not work in dash -.-
     3.9  DEVICE="$(echo "$DEVICE" | awk '{print substr($1,0,9)}')"
    3.10  
    3.11 -# make sure the device is not mounted
    3.12 -umount /var/run/usbmount/*
    3.13 -sleep 1
    3.14 -umount ${DEVICE}*
    3.15 +# make sure the device is not mounted (always run the init_manger script here!)
    3.16 +init_manager.sh "$DEVICE"
    3.17  
    3.18  
    3.19  if [ -z "$KEYFILE" ]