Subject: acpi-support: Fix LSB init output

From: Guillem Jover <[email-masked]>
Date: Sat, 30 Apr 2016 16:49:12 +0200

Source: acpi-support
Source-Version: 0.142-8
Severity: wishlist
Tags: patch

Hi!

The attached patch fixes the LSB init script to have more consistent
output.

Thanks,
Guillem
From 1f5b352a259a8bdb4d66fbe7cce5106e55f8c97c Mon Sep 17 00:00:00 2001
From: Guillem Jover <[email-masked]>
Date: Sat, 30 Apr 2016 15:17:27 +0200
Subject: [PATCH] acpi-support: Fix LSB init output

---
 debian/acpi-fakekey.init | 36 ++++++++++++------------------------
 1 file changed, 12 insertions(+), 24 deletions(-)

diff --git a/debian/acpi-fakekey.init b/debian/acpi-fakekey.init
index ce6196b..f85bdde 100644
--- a/debian/acpi-fakekey.init
+++ b/debian/acpi-fakekey.init
@@ -16,45 +16,33 @@ test -f /lib/lsb/init-functions || exit 1
 
 case "$1" in
   start)
-    log_action_begin_msg "Starting acpi_fakekey daemon"
+    log_daemon_msg "Starting ACPI services" "acpi_fakekey"
     if [ ! -d /sys/devices/virtual/misc/uinput ]; then
 	 if ! modprobe -q uinput; then
 		if ! find /lib/modules/`uname -r` -name "uinput\.*" 2>/dev/null|grep -q uinput; then
-			log_action_end_msg 1 "No suitable uinput module for running kernel found"
+			log_failure_msg 1 "No suitable uinput module for running kernel found"
 		else
-			log_action_end_msg 1 "Modprobe uinput failed. Please use 'dmesg' to find out why"
+			log_failure_msg 1 "Modprobe uinput failed. Please use 'dmesg' to find out why"
 		fi
+		exit 1
 	fi
     fi
-
-    if start-stop-daemon --start --quiet --oknodo --exec /usr/sbin/acpi_fakekeyd
-    then
-	log_action_end_msg 0
-    else
-	log_action_end_msg 1 "Could not start /usr/sbin/acpi_fakekeyd"
-    fi
+    start-stop-daemon --start --quiet --oknodo --exec /usr/sbin/acpi_fakekeyd
+    log_end_msg $?
     ;;
   stop)
-    log_action_begin_msg "Stopping acpi_fakekey daemon"
-    if start-stop-daemon --stop --quiet --exec /usr/sbin/acpi_fakekeyd
-    then
-	log_action_end_msg 0
-    else
-	log_action_end_msg 1 "Could not stop /usr/sbin/acpi_fakekeyd"
-    fi
+    log_daemon_msg "Stopping ACPI services" "acpi_fakekey"
+    start-stop-daemon --stop --quiet --exec /usr/sbin/acpi_fakekeyd
+    log_end_msg $?
     ;;
   status)
     status_of_proc /usr/sbin/acpi_fakekeyd "acpi_fakekey daemon" && exit 0 || exit $?
     ;;
   restart|force-reload)
-    log_action_begin_msg "Restarting acpi_fakekey daemon"
+    log_daemon_msg "Restarting ACPI services" "acpi_fakekey"
     start-stop-daemon --stop --quiet --exec /usr/sbin/acpi_fakekeyd
-    if start-stop-daemon --start --quiet --exec /usr/sbin/acpi_fakekeyd
-    then
-	log_action_end_msg 0
-    else
-	log_action_end_msg 1 "Could not restart /usr/sbin/acpi_fakekeyd"
-    fi
+    start-stop-daemon --start --quiet --exec /usr/sbin/acpi_fakekeyd
+    log_action_end_msg $?
     ;;
   *)
   ;;
-- 
2.8.1