hal: Branch 'master'
Danny Kukawka
dkukawka at kemper.freedesktop.org
Mon Apr 21 03:11:50 PDT 2008
tools/linux/hal-luks-remove-linux | 9 +++++++++
tools/linux/hal-system-killswitch-get-power-linux | 5 +++++
tools/linux/hal-system-killswitch-set-power-linux | 8 +++++++-
tools/linux/hal-system-lcd-get-brightness-linux | 4 +++-
tools/linux/hal-system-lcd-set-brightness-linux | 2 ++
5 files changed, 26 insertions(+), 2 deletions(-)
New commits:
commit e2f48bd476523622a05338285aa118f97f92ceb5
Author: Danny Kukawka <danny.kukawka at web.de>
Date: Mon Apr 21 12:11:40 2008 +0200
fixed error handling in linux scripts
Fixed the error handling in the linux scripts. Always return
an error and a error description, call 'exit 1' after the error.
diff --git a/tools/linux/hal-luks-remove-linux b/tools/linux/hal-luks-remove-linux
index 1393dfc..fc398e6 100755
--- a/tools/linux/hal-luks-remove-linux
+++ b/tools/linux/hal-luks-remove-linux
@@ -8,6 +8,12 @@
CRYPTSETUP=/sbin/cryptsetup
+if [ ! -f $CRYPTSETUP ]; then
+ echo org.freedesktop.Hal.Device.Volume.Crypto.CryptSetupMissing >&2
+ echo Error remove $HAL_PROP_BLOCK_DEVICE - $CRYPTSETUP not found >&2
+ exit 1
+fi
+
echo LUKS cryptotext device $HAL_PROP_INFO_UDI is going away
# make sure that the cleartext volume is unmounted
@@ -26,16 +32,19 @@ fi
echo Tearing down LUKS cryptotext volume
if [ ! -f $CRYPTSETUP ]; then
+ echo org.freedesktop.Hal.Device.Volume.Crypto.RemoveError >&2
echo Error removing $HAL_PROP_BLOCK_DEVICE - $CRYPTSETUP not found >&2
exit 1
fi
if [ -z $HAL_PROP_VOLUME_UUID ]; then
+ echo org.freedesktop.Hal.Device.Volume.Crypto.RemoveError >&2
echo Error determining UUID of $HAL_PROP_BLOCK_DEVICE >&2
exit 1
fi
if ! $CRYPTSETUP luksClose luks_crypto_$HAL_PROP_VOLUME_UUID 2> /dev/null; then
+ echo org.freedesktop.Hal.Device.Volume.Crypto.RemoveError >&2
echo Error removing luks_crypto_$HAL_PROP_VOLUME_UUID >&2
exit 1
fi
diff --git a/tools/linux/hal-system-killswitch-get-power-linux b/tools/linux/hal-system-killswitch-get-power-linux
index 8ed817e..e90ae7b 100755
--- a/tools/linux/hal-system-killswitch-get-power-linux
+++ b/tools/linux/hal-system-killswitch-get-power-linux
@@ -33,6 +33,7 @@ if [ "$HAL_PROP_KILLSWITCH_TYPE" = "bluetooth" ]; then
else
echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
echo "dellWirelessCtl returned $value" >&2
+ exit 1
fi
elif [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = thinkpad -a -r "$HAL_PROP_LINUX_SYSFS_PATH" ]; then
read value < $HAL_PROP_LINUX_SYSFS_PATH 2> /dev/null
@@ -41,6 +42,7 @@ if [ "$HAL_PROP_KILLSWITCH_TYPE" = "bluetooth" ]; then
else
echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
echo "cannot read $HAL_PROP_LINUX_SYSFS_PATH" >&2
+ exit 1
fi
else
echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
@@ -59,6 +61,7 @@ elif [ "$HAL_PROP_KILLSWITCH_TYPE" = "wlan" ]; then
else
echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
echo "dellWirelessCtl returned $value" >&2
+ exit 1
fi
elif [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "ipw" ]; then
hal-ipw-killswitch-linux getrfkill
@@ -70,6 +73,7 @@ elif [ "$HAL_PROP_KILLSWITCH_TYPE" = "wlan" ]; then
else
echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
echo "hal-ipw-killswitch-linux returned $value" >&2
+ exit 1
fi
else
echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
@@ -88,6 +92,7 @@ elif [ "$HAL_PROP_KILLSWITCH_TYPE" = "wwan" ]; then
else
echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
echo "dellWirelessCtl returned $value" >&2
+ exit 1
fi
else
echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
diff --git a/tools/linux/hal-system-killswitch-set-power-linux b/tools/linux/hal-system-killswitch-set-power-linux
index 2f805d8..65a5f85 100755
--- a/tools/linux/hal-system-killswitch-set-power-linux
+++ b/tools/linux/hal-system-killswitch-set-power-linux
@@ -16,8 +16,10 @@ fi
if [ "$HAL_PROP_KILLSWITCH_TYPE" = "bluetooth" ]; then
if [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "sonypic" ]; then
hal-system-sonypic setbluetooth $value
- if [ $? -ne 0 ]; then
+ ret=$?
+ if [ "$ret" != "0" ]; then
echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
+ echo "hal-system-sonypic returned $ret" >&2
exit 1
fi
exit 0
@@ -36,6 +38,7 @@ if [ "$HAL_PROP_KILLSWITCH_TYPE" = "bluetooth" ]; then
if [ "$ret" != "0" ]; then
echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
echo "dellWirelessCtl returned $ret" >&2
+ exit 1
fi
elif [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = thinkpad -a -w "$HAL_PROP_LINUX_SYSFS_PATH" ]; then
if [ "$value" = "true" ]; then
@@ -71,6 +74,7 @@ elif [ "$HAL_PROP_KILLSWITCH_TYPE" = "wlan" ]; then
if [ "$ret" != "0" ]; then
echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
echo "dellWirelessCtl returned $ret" >&2
+ exit 1
fi
elif [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "ipw" ]; then
if [ "$value" = "true" ]; then
@@ -83,6 +87,7 @@ elif [ "$HAL_PROP_KILLSWITCH_TYPE" = "wlan" ]; then
if [ "$ret" != "0" ]; then
echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
echo "hal-ipw-killswitch-linux returned $value" >&2
+ exit 1
fi
else
echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
@@ -105,6 +110,7 @@ elif [ "$HAL_PROP_KILLSWITCH_TYPE" = "wwan" ]; then
if [ "$ret" != "0" ]; then
echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
echo "dellWirelessCtl returned $ret" >&2
+ exit 1
fi
else
echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
diff --git a/tools/linux/hal-system-lcd-get-brightness-linux b/tools/linux/hal-system-lcd-get-brightness-linux
index 5128c4b..5810785 100755
--- a/tools/linux/hal-system-lcd-get-brightness-linux
+++ b/tools/linux/hal-system-lcd-get-brightness-linux
@@ -17,6 +17,7 @@ if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "pmu" ]; then
value="`hal-system-power-pmu getlcd`"
if [ $? -ne 0 ]; then
echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2
+ echo "hal-system-power-pmu getlcd returned != 0" >&2
exit 1
fi
exit ${value}
@@ -24,6 +25,7 @@ elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "sonypi" ]; then
value="`hal-system-sonypic getlcd`"
if [ $? -ne 0 ]; then
echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2
+ echo "hal-system-sonypic getlcd returned != 0" >&2
exit 1
fi
exit ${value}
@@ -32,7 +34,7 @@ fi
# Check for file existance and that it's readable
if [ ! -r $HAL_PROP_LINUX_ACPI_PATH ]; then
echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2
- echo "$1 not readable!" >&2
+ echo "$HAL_PROP_LINUX_ACPI_PATH not readable!" >&2
exit 1
fi
diff --git a/tools/linux/hal-system-lcd-set-brightness-linux b/tools/linux/hal-system-lcd-set-brightness-linux
index a456744..4b4c2f1 100755
--- a/tools/linux/hal-system-lcd-set-brightness-linux
+++ b/tools/linux/hal-system-lcd-set-brightness-linux
@@ -17,6 +17,7 @@ if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "pmu" ]; then
hal-system-power-pmu setlcd $value
if [ $? -ne 0 ]; then
echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2
+ echo "hal-system-power-pmu setlcd returned != 0" >&2
exit 1
fi
exit 0
@@ -24,6 +25,7 @@ elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "sonypi" ]; then
hal-system-sonypic setlcd $value
if [ $? -ne 0 ]; then
echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2
+ echo "hal-system-sonypic setlcd returned != 0" >&2
exit 1
fi
exit 0
More information about the hal-commit
mailing list