pre_init.sh
author ft
Wed, 03 Dec 2014 11:35:21 +0100
changeset 4 9c3105aa50e0
parent 0 28b7682d5476
permissions -rwxr-xr-x
chnaged init sucess message so the user has to click away the message
     1 #!/bin/sh
     2 
     3 # ------------------------------------------------------------
     4 # opensecurity package file
     5 #
     6 # Autor: X-Net Services GmbH <office@x-net.at>
     7 #
     8 # Copyright 2013-2014 X-Net and AIT Austrian Institute of Technology
     9 #
    10 #
    11 #     X-Net Technologies GmbH
    12 #     Elisabethstrasse 1
    13 #     4020 Linz
    14 #     AUSTRIA
    15 #     https://www.x-net.at
    16 #
    17 #     AIT Austrian Institute of Technology
    18 #     Donau City Strasse 1
    19 #     1220 Wien
    20 #     AUSTRIA
    21 #     http://www.ait.ac.at
    22 #
    23 #
    24 # Licensed under the Apache License, Version 2.0 (the "License");
    25 # you may not use this file except in compliance with the License.
    26 # You may obtain a copy of the License at
    27 #
    28 #    http://www.apache.org/licenses/LICENSE-2.0
    29 #
    30 # Unless required by applicable law or agreed to in writing, software
    31 # distributed under the License is distributed on an "AS IS" BASIS,
    32 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    33 # See the License for the specific language governing permissions and
    34 # limitations under the License.
    35 # ------------------------------------------------------------
    36 
    37 DEVICE="$1"
    38 
    39 # This script makes sure that the stick is unmounted and unused
    40 # Run this Script before the init process
    41 
    42 # make sure to have "/dev/sdb" (not "/dev/sdb1")
    43 #DEVICE="${DEVICE:0:8}" the bash way does not work in dash -.-
    44 DEVICE="$(echo "$DEVICE" | awk '{print substr($1,0,9)}')"
    45 
    46 # make sure the device is not mounted
    47 chattr -i "/tmp/usbmount"
    48 umount /tmp/usbmount/*
    49 sleep 1
    50 rmdir /tmp/usbmount/*
    51 umount /media/usb*
    52 
    53 # sometimes the umount fails with device bussy -> unknown why
    54 # so try until it works
    55 counter=0
    56 while ( [ -n "$(mount | grep "$DEVICE" | head -n 1 | awk '{print $3}')" ] && [ $counter -lt 10 ] )
    57 do
    58 	sleep 1
    59 	umount "$(mount | grep "$DEVICE" | head -n 1 | awk '{print $3}')"
    60 	counter=$((counter + 1))
    61 done
    62 
    63 
    64 
    65 # search for already encrypted volumes
    66 device=$(encryptionprovider.py -g)
    67 
    68 if [ "$?" = "0" ]
    69 then
    70 	encryptionprovider.py -u $device
    71 fi