management_scripts/pre_init.sh
author ft
Tue, 09 Sep 2014 09:19:17 +0200
changeset 25 25581dcb9e62
parent 17 980ca72ff1f1
child 26 7ee697669fb9
permissions -rwxr-xr-x
changed information notifications (no popup anymore)
     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 /media/usb*
    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