# -*-Shell-script-*- # # hal-functions.sh: This file contains functions to be used by most or all # hal shell scripts # hal-system-lcd-get-brightness.sh # # Licensed under the Academic Free License version 2.1 # proc hal_check_priv { if test $HAVE_POLKIT = "1" -a -n $HAL_METHOD_INVOKED_BY_SYSTEMBUS_CONNECTION_NAME { setvar ACTION = "$1" setvar PK_RESULT = $(hal-is-caller-privileged --udi $UDI --action $ACTION \ --caller $HAL_METHOD_INVOKED_BY_SYSTEMBUS_CONNECTION_NAME) setvar RET = "$Status" if test $RET != "0" { echo "org.freedesktop.Hal.Device.Error" >&2 echo "Cannot determine if caller is privileged" >&2 exit 1 } if test $PK_RESULT != "yes" { echo "org.freedesktop.Hal.Device.PermissionDeniedByPolicy" >&2 echo "$ACTION $PK_RESULT <-- (action, result)" >&2 exit 1 } } } proc hal_call_backend { setvar PROGRAM = $(basename $0) if test -n $HALD_UNAME_S -a -x ./$HALD_UNAME_S/$PROGRAM-$HALD_UNAME_S { ./$HALD_UNAME_S/$PROGRAM-$HALD_UNAME_S $ifsjoin(ARGV) } else { echo "org.freedesktop.Hal.Device.UnknownError" >&2 echo "No back-end for your operating system" >&2 exit 1 } } proc hal_exec_backend { setvar PROGRAM = $(basename $0) if test -n $HALD_UNAME_S -a -x ./$HALD_UNAME_S/$PROGRAM-$HALD_UNAME_S { exec ./$HALD_UNAME_S/$PROGRAM-$HALD_UNAME_S $ifsjoin(ARGV) } else { echo "org.freedesktop.Hal.Device.UnknownError" >&2 echo "No back-end for your operating system" >&2 exit 1 } }