diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/pm-action.in | 44 |
1 files changed, 8 insertions, 36 deletions
diff --git a/src/pm-action.in b/src/pm-action.in index f76f9ae..82aa295 100644 --- a/src/pm-action.in +++ b/src/pm-action.in @@ -26,25 +26,17 @@ # The rule here? Simplicity. +export PM_FUNCTIONS="@PM-UTILS-LIBDIR@/functions" +. "${PM_FUNCTIONS}" + +# save the command line parameters for the hooks. +export PM_CMDLINE="$*" help() { echo "${0##*/} [options]" echo - echo "Options can change how the supend or hibernate is done." - echo - echo "Possible actions are:" - echo - echo " --quirk-dpms-on" - echo " --quirk-dpms-suspend" - echo " --quirk-radeon-off" - echo " --quirk-reset-brightness" - echo " --quirk-s3-bios" - echo " --quirk-s3-mode" - echo " --quirk-vbe-post" - echo " --quirk-vbemode-restore" - echo " --quirk-vbestate-restore" - echo " --quirk-vga-mode3" - echo " --quirk-none" + echo "Options can change how suspend or hibernate is done." + run_hooks sleep help exit 0 } @@ -53,31 +45,13 @@ if [ -n "$EUID" -a "$EUID" != "0" ]; then exit 1 fi -# Get the command line options +# Save the command line options for the hooks while [ $# -gt 0 ] do - [ "${1##--}" = "$1" ] && break #if this matches, it is not an option! [ "$1" = "--help" ] && help - case "${1##--quirk-}" in # just quirks, please - dpms-on) export QUIRK_DPMS_ON="true" ;; - dpms-suspend) export QUIRK_DPMS_SUSPEND="true" ;; - radeon-off) export QUIRK_RADEON_OFF="true" ;; - reset-brightness) export QUIRK_RESET_BRIGHTNESS="true" ;; - s3-bios) export QUIRK_S3_BIOS="true" ;; - s3-mode) export QUIRK_S3_MODE="true" ;; - vbe-post) export QUIRK_VBE_POST="true" ;; - vbemode-restore) export QUIRK_VBEMODE_RESTORE="true" ;; - vbestate-restore) export QUIRK_VBESTATE_RESTORE="true" ;; - vga-mode3) export QUIRK_VGA_MODE_3="true" ;; - none) export QUIRK_NONE="true" ;; - *) continue ;; - esac shift done -export PM_FUNCTIONS="@PM-UTILS-LIBDIR@/functions" -. "${PM_FUNCTIONS}" - ACTION="$(echo ${0##*pm-} |tr - _)" case "$ACTION" in @@ -88,8 +62,6 @@ case "$ACTION" in exit 1 ;; esac -export PM_CMDLINE="$@" - "check_$ACTION" || { echo "System does not support $ACTION sleep."; exit 1; } take_suspend_lock || exit 1 |