Bug 32577 - condrestart is missing in init-script
Summary: condrestart is missing in init-script
Status: CLOSED FIXED
Alias: None
Product: Sisyphus
Classification: Development
Component: laptop-mode-tools (show other bugs)
Version: unstable
Hardware: all Linux
: P3 normal
Assignee: Andrey Cherepanov
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on: 32578
Blocks:
  Show dependency tree
 
Reported: 2016-10-05 19:31 MSK by Ivan Zakharyaschev
Modified: 2016-10-06 13:17 MSK (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Zakharyaschev 2016-10-05 19:31:44 MSK
laptop-mode-tools-1.70-alt1

ALT's /usr/sbin/post_service invokes the init-script's condrestart command:

                service "$1" condrestart

but the Debian-style /etc/init.d/laptop-mode doesn't have it (similarly to all other Debian-style init-scripts).

I've patched some other Debian-style init-scripts for this ("condrestart") in a simple way:

http://git.altlinux.org/gears/o/owamp.git?p=owamp.git;a=commitdiff;h=ae7ac80b0eb4dd255d8918791a5b06099d69305e

diff --git a/debian/owamp-server.init b/debian/owamp-server.init
index 1a7998b..24951c3 100755
--- a/debian/owamp-server.init
+++ b/debian/owamp-server.init
@@ -122,8 +122,18 @@ case "$1" in
 		;;
 	esac
 	;;
+  condrestart|condreload)
+        if "$0" status >/dev/null; then
+            exec "$0" restart
+        fi
+        ;;
+  condstop)
+        if "$0" status >/dev/null; then
+            exec "$0" stop
+        fi
+        ;;
   *)
-	echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
+	echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload|condrestart|condreload|condstop}" >&2
 	exit 3
 	;;
 esac

A very similar patch:

http://git.altlinux.org/gears/t/thermald.git?p=thermald.git;a=commitdiff;h=5e6857d421e2bd21323bb831ec500308cb049130

Perhaps, this trick can be moved into package service (instead of patching each individual package). (I'm going to submit such a FR.)
Comment 1 Repository Robot 2016-10-06 13:17:54 MSK
laptop-mode-tools-1.70-alt2 -> sisyphus:

* Thu Oct 06 2016 Andrey Cherepanov <cas@altlinux> 1.70-alt2
- Fix project homepage (ALT #32576)
- Support condrestart and condstop in initscript (ALT #32577)