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)
ft@17
     1
#!/bin/sh
ft@17
     2
ft@17
     3
DEVICE="$1"
ft@17
     4
ft@17
     5
# This script makes sure that the stick is unmounted and unused
ft@17
     6
# Run this Script before the init process
ft@17
     7
ft@17
     8
# make sure to have "/dev/sdb" (not "/dev/sdb1")
ft@17
     9
#DEVICE="${DEVICE:0:8}" the bash way does not work in dash -.-
ft@17
    10
DEVICE="$(echo "$DEVICE" | awk '{print substr($1,0,9)}')"
ft@17
    11
ft@17
    12
# make sure the device is not mounted
ft@17
    13
umount /var/run/usbmount/*
ft@17
    14
sleep 1
ft@17
    15
rmdir /var/run/usbmount/*
ft@21
    16
umount /media/usb*
ft@17
    17
ft@17
    18
# search for already encrypted volumes
ft@17
    19
device=$(encryptionprovider.py -g)
ft@17
    20
ft@21
    21
if [ "$?" = "0" ]
ft@17
    22
then
ft@17
    23
	encryptionprovider.py -u $device
ft@17
    24
fi