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