1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/pre_init.sh Tue Nov 04 18:26:39 2014 +0100
1.3 @@ -0,0 +1,59 @@
1.4 +#!/bin/sh
1.5 +
1.6 +# ------------------------------------------------------------
1.7 +# opensecurity package file
1.8 +#
1.9 +# Autor: X-Net Services GmbH <office@x-net.at>
1.10 +#
1.11 +# Copyright 2013-2014 X-Net and AIT Austrian Institute of Technology
1.12 +#
1.13 +#
1.14 +# X-Net Technologies GmbH
1.15 +# Elisabethstrasse 1
1.16 +# 4020 Linz
1.17 +# AUSTRIA
1.18 +# https://www.x-net.at
1.19 +#
1.20 +# AIT Austrian Institute of Technology
1.21 +# Donau City Strasse 1
1.22 +# 1220 Wien
1.23 +# AUSTRIA
1.24 +# http://www.ait.ac.at
1.25 +#
1.26 +#
1.27 +# Licensed under the Apache License, Version 2.0 (the "License");
1.28 +# you may not use this file except in compliance with the License.
1.29 +# You may obtain a copy of the License at
1.30 +#
1.31 +# http://www.apache.org/licenses/LICENSE-2.0
1.32 +#
1.33 +# Unless required by applicable law or agreed to in writing, software
1.34 +# distributed under the License is distributed on an "AS IS" BASIS,
1.35 +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1.36 +# See the License for the specific language governing permissions and
1.37 +# limitations under the License.
1.38 +# ------------------------------------------------------------
1.39 +
1.40 +DEVICE="$1"
1.41 +
1.42 +# This script makes sure that the stick is unmounted and unused
1.43 +# Run this Script before the init process
1.44 +
1.45 +# make sure to have "/dev/sdb" (not "/dev/sdb1")
1.46 +#DEVICE="${DEVICE:0:8}" the bash way does not work in dash -.-
1.47 +DEVICE="$(echo "$DEVICE" | awk '{print substr($1,0,9)}')"
1.48 +
1.49 +# make sure the device is not mounted
1.50 +chattr -i "/tmp/usbmount"
1.51 +umount /tmp/usbmount/*
1.52 +sleep 1
1.53 +rmdir /tmp/usbmount/*
1.54 +umount /media/usb*
1.55 +
1.56 +# search for already encrypted volumes
1.57 +device=$(encryptionprovider.py -g)
1.58 +
1.59 +if [ "$?" = "0" ]
1.60 +then
1.61 + encryptionprovider.py -u $device
1.62 +fi
1.63 \ No newline at end of file