[PATCH 4/9] init-d-script: fix force-reload if do_reload is an alias

Trek trek00 at inbox.ru
Fri Aug 28 07:21:22 BST 2020


Aliases comes in place only after they are defined, that is after
sourcing the script, even inside functions. Moreover the call
function can't handle aliases.
---
 debian/init-d-script | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/debian/init-d-script b/debian/init-d-script
index 4c038aee..bc398752 100755
--- a/debian/init-d-script
+++ b/debian/init-d-script
@@ -125,14 +125,6 @@ do_restart() {
 	return $retval
 }
 
-do_force_reload() {
-	if is_call_implemented do_reload ; then
-		call do_reload
-	else
-		call do_restart
-	fi
-}
-
 # Enable this using
 # alias do_reload=do_reload_sigusr1
 do_reload_sigusr1() {
@@ -221,7 +213,13 @@ case "$1" in
 	fi
 	;;
   force-reload)
-	call do_force_reload
+	if is_call_implemented do_force_reload ; then
+		call do_force_reload
+	elif is_call_implemented do_reload ; then
+		do_reload
+	else
+		call do_restart
+	fi
 	;;
   restart)
 	call do_restart
-- 
2.20.1




More information about the Debian-init-diversity mailing list