management_scripts/pre_init.sh
author ft
Tue, 04 Nov 2014 14:21:53 +0100
changeset 26 7ee697669fb9
parent 21 39d4f181549a
child 27 a8c8d86b8501
permissions -rwxr-xr-x
changed workflow
     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 chattr -i "/tmp/usbmount"
    14 umount /tmp/usbmount/*
    15 sleep 1
    16 rmdir /tmp/usbmount/*
    17 umount /media/usb*
    18 
    19 # search for already encrypted volumes
    20 device=$(encryptionprovider.py -g)
    21 
    22 if [ "$?" = "0" ]
    23 then
    24 	encryptionprovider.py -u $device
    25 fi