8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / cmd / hal / tools / hal-functions.sh
blobc6449f6e33dd0475378cb4859eb7f23986fc7ee6
1 # -*-Shell-script-*-
3 # hal-functions.sh: This file contains functions to be used by most or all
4 # hal shell scripts
5 # hal-system-lcd-get-brightness.sh
7 # Licensed under the Academic Free License version 2.1
10 hal_check_priv() {
11 if [ "$HAVE_POLKIT" = "1" -a -n $HAL_METHOD_INVOKED_BY_SYSTEMBUS_CONNECTION_NAME ]; then
12 ACTION=$1
13 PK_RESULT=`hal-is-caller-privileged --udi $UDI --action $ACTION \
14 --caller $HAL_METHOD_INVOKED_BY_SYSTEMBUS_CONNECTION_NAME`
15 RET=$?
16 if [ "$RET" != "0" ]; then
17 echo "org.freedesktop.Hal.Device.Error" >&2
18 echo "Cannot determine if caller is privileged" >&2
19 exit 1
21 if [ "$PK_RESULT" != "yes" ] ;then
22 echo "org.freedesktop.Hal.Device.PermissionDeniedByPolicy" >&2
23 echo "$ACTION $PK_RESULT <-- (action, result)" >&2
24 exit 1
29 hal_call_backend() {
30 PROGRAM=`basename $0`
31 if [ -n "$HALD_UNAME_S" -a -x ./$HALD_UNAME_S/$PROGRAM-$HALD_UNAME_S ]; then
32 ./$HALD_UNAME_S/$PROGRAM-$HALD_UNAME_S $@
33 else
34 echo "org.freedesktop.Hal.Device.UnknownError" >&2
35 echo "No back-end for your operating system" >&2
36 exit 1
40 hal_exec_backend() {
41 PROGRAM=`basename $0`
42 if [ -n "$HALD_UNAME_S" -a -x ./$HALD_UNAME_S/$PROGRAM-$HALD_UNAME_S ]; then
43 exec ./$HALD_UNAME_S/$PROGRAM-$HALD_UNAME_S $@
44 else
45 echo "org.freedesktop.Hal.Device.UnknownError" >&2
46 echo "No back-end for your operating system" >&2
47 exit 1