~ubuntu-branches/debian/sid/hal/sid

« back to all changes in this revision

Viewing changes to tools/hal-luks-teardown

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2007-10-23 12:33:58 UTC
  • Revision ID: james.westby@ubuntu.com-20071023123358-xaf8mjc5n84d5gtz
Tags: upstream-0.5.10
ImportĀ upstreamĀ versionĀ 0.5.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
# This program is free software; you can redistribute it and/or modify
7
7
# it under the terms of the GNU General Public License version 2.
8
8
 
 
9
. hal-functions
 
10
 
9
11
locked_out() {
10
12
        echo "org.freedesktop.Hal.Device.InterfaceLocked" >&2
11
13
        echo "Enclosing drive/volume is locked" >&2
12
14
        exit 1
13
15
}
14
16
 
15
 
# Check for environment variables
16
 
if [ -z "$HAL_PROP_BLOCK_DEVICE" ] || [ -z "$HAL_PROP_INFO_UDI" ] || [ -z "$HAL_PROP_VOLUME_UUID" ] ; then
 
17
unknown_error() {
17
18
        echo "org.freedesktop.Hal.Device.UnknownError" >&2
18
19
        echo "Missing or empty environment variable(s)." >&2
19
20
        echo "This script should be started by hald." >&2
20
21
        exit 1
 
22
}
 
23
 
 
24
# Check for environment variables
 
25
if [ -z "$HAL_PROP_BLOCK_DEVICE" ] || [ -z "$HAL_PROP_INFO_UDI" ] || [ -z "$HAL_PROP_VOLUME_UUID" ] ; then
 
26
    unknown_error
21
27
fi
22
28
 
23
29
# Respect the same locks as Mount()/Unmount() etc.
38
44
    fi
39
45
fi
40
46
 
41
 
if [ -n "$HALD_UNAME_S" -a -x ./$HALD_UNAME_S/hal-luks-teardown-$HALD_UNAME_S ]; then
42
 
    exec ./$HALD_UNAME_S/hal-luks-teardown-$HALD_UNAME_S $@
 
47
# TODO: this is a little sketchy; we should check for hal-storage-crypto-teardown-others?
 
48
#
 
49
IS_HOTPLUGGABLE=`hal-get-property --udi $HAL_PROP_BLOCK_STORAGE_DEVICE --key storage.hotpluggable`
 
50
if [ "$IS_HOTPLUGGABLE" == "true" ] ; then
 
51
    ACTION="org.freedesktop.hal.storage.crypto-setup-removable"
 
52
elif [ "$IS_HOTPLUGGABLE" == "false" ] ; then
 
53
    ACTION="org.freedesktop.hal.storage.crypto-setup-fixed"
43
54
else
44
 
    echo "org.freedesktop.Hal.Device.UnknownError" >&2
45
 
    echo "No back-end for your operating system" >&2
46
 
    exit 1
 
55
    unknown_error
47
56
fi
 
57
 
 
58
hal_check_priv $ACTION
 
59
hal_exec_backend