home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / boot / i386 / rescue / usr / lib / hal / scripts / hal-system-power-shutdown < prev    next >
Text File  |  2006-11-29  |  815b  |  25 lines

  1. #!/bin/sh
  2.  
  3. PRIVILEGE=hal-power-poweroff
  4. if [ "$HAVE_POLKIT" == "1" ] ; then
  5.     if [ "$HAL_METHOD_INVOKED_BY_UID" != "0" ] ; then
  6.     RESULT=$(polkit-is-privileged --privilege $PRIVILEGE \
  7.         --user $HAL_METHOD_INVOKED_BY_UID \
  8.         --system-bus-unique-name $HAL_METHOD_INVOKED_BY_SYSTEMBUS_CONNECTION_NAME 2>&1)
  9.     IS_PRIVILEGED=$?
  10.     if [ "$IS_PRIVILEGED" != "0" ] ; then
  11.         echo org.freedesktop.Hal.Device.PermissionDeniedByPolicy >&2
  12.         echo $PRIVILEGE refused uid $HAL_METHOD_INVOKED_BY_UID >&2
  13.         exit 1
  14.     fi
  15.     fi
  16. fi
  17.  
  18. if [ -n "$HALD_UNAME_S" -a -x ./$HALD_UNAME_S/hal-system-power-shutdown-$HALD_UNAME_S ]; then
  19.     exec ./$HALD_UNAME_S/hal-system-power-shutdown-$HALD_UNAME_S $@
  20. else
  21.     echo "org.freedesktop.Hal.Device.UnknownError" >&2
  22.     echo "No back-end for your operating system" >&2
  23.     exit 1
  24. fi
  25.