Bug#218530: Summary of options for improving conditional rune for initscript calls
Summarizing, then: the choices are:
1. Stay with "if [ -x /usr/sbin/invoke-rc.d ] ; then"
2. Change to "#!/bin/bash ... if type invoke-rc.d ; then"
3. Change to "if type invoke-rc.d ; then" and change policy to
require that /bin/sh point to a shell that supports "type".
4. Change to "if invoke-rc.d --help > /dev/null 2>&1 ; then"
Other ideas which were shot down, with bullets:
5. Change to "if type -p invoke-rc.d > /dev/null 2>&1 ; then"
* type's "-p" option is not available on dash
* Also, there is no reason to rule out aliases/functions/builtins
6. Change to "if type invoke-rc.d > /dev/null 2>&1 ; then"
* "type" is not available in posh
7. Change to "if command -v invoke-rc.d > /dev/null 2>&1 ; then"
* "command -v" is not available in posh
* "command -v" is an optional functionality according to
http://www.opengroup.org/onlinepubs/009695399/utilities/
8. Change to "if which invoke-rc.d > /dev/null 2>&1 ; then"
* which is in /usr/bin
* woody's which is buggy
--
Thomas Hood
Reply to: