management_scripts/pre_init.sh
author ft
Mon, 18 Aug 2014 16:08:34 +0200
changeset 17 980ca72ff1f1
child 21 39d4f181549a
permissions -rwxr-xr-x
changed init process
added pre and post init script
     1 #!/bin/sh
     2 
     3 DEVICE="$1"
     4 
     5 # This script makes sure that the stick is unmounted and unused
     6 # Run this Script before the init process
     7 
     8 # make sure to have "/dev/sdb" (not "/dev/sdb1")
     9 #DEVICE="${DEVICE:0:8}" the bash way does not work in dash -.-
    10 DEVICE="$(echo "$DEVICE" | awk '{print substr($1,0,9)}')"
    11 
    12 # make sure the device is not mounted
    13 umount /var/run/usbmount/*
    14 sleep 1
    15 rmdir /var/run/usbmount/*
    16 umount ${DEVICE}*
    17 
    18 # search for already encrypted volumes
    19 device=$(encryptionprovider.py -g)
    20 
    21 if [ "$?" == "0" ]
    22 then
    23 	encryptionprovider.py -u $device
    24 fi