From 8bf173e2aafdf59d313748d42cad018af0a74c34 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Fri, 18 Dec 2015 08:10:02 +0100 Subject: [PATCH 1/2] use which instead of type to check for the existense of ucr --- debian/bareos-director.postinst.in | 2 +- debian/bareos-filedaemon.postinst.in | 2 +- debian/bareos-storage.postinst.in | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/debian/bareos-director.postinst.in b/debian/bareos-director.postinst.in index 7339617a0dc..36e5eba818d 100644 --- a/debian/bareos-director.postinst.in +++ b/debian/bareos-director.postinst.in @@ -45,7 +45,7 @@ case "$1" in fi permissions # on Univention distributions the ucr command allows to open the firewall - if [ -x "/etc/init.d/univention-firewall" ] && type ucr >/dev/null 2>&1; then + if [ -x "/etc/init.d/univention-firewall" ] && which ucr >/dev/null 2>&1; then ucr set \ security/packetfilter/package/bareos-director/tcp/@dir_port@/all="ACCEPT" \ security/packetfilter/package/bareos-director/tcp/@dir_port@/all/en="bareos-dir" diff --git a/debian/bareos-filedaemon.postinst.in b/debian/bareos-filedaemon.postinst.in index 5dbdde2b0d2..5c01d088cfa 100644 --- a/debian/bareos-filedaemon.postinst.in +++ b/debian/bareos-filedaemon.postinst.in @@ -47,7 +47,7 @@ case "$1" in fi permissions # on Univention distributions the ucr command allows to open the firewall - if [ -x "/etc/init.d/univention-firewall" ] && type ucr >/dev/null 2>&1; then + if [ -x "/etc/init.d/univention-firewall" ] && which ucr >/dev/null 2>&1; then ucr set \ security/packetfilter/package/bareos-filedaemon/tcp/@fd_port@/all="ACCEPT" \ security/packetfilter/package/bareos-filedaemon/tcp/@fd_port@/all/en="bareos-fd" diff --git a/debian/bareos-storage.postinst.in b/debian/bareos-storage.postinst.in index 4b9cad3a4ff..5cc38b6e153 100644 --- a/debian/bareos-storage.postinst.in +++ b/debian/bareos-storage.postinst.in @@ -50,7 +50,7 @@ case "$1" in permissions /usr/lib/bareos/scripts/bareos-config setup_sd_user # on Univention distributions the ucr command allows to open the firewall - if [ -x "/etc/init.d/univention-firewall" ] && type ucr >/dev/null 2>&1; then + if [ -x "/etc/init.d/univention-firewall" ] && which ucr >/dev/null 2>&1; then ucr set \ security/packetfilter/package/bareos-storage/tcp/@sd_port@/all="ACCEPT" \ security/packetfilter/package/bareos-storage/tcp/@sd_port@/all/en="bareos-sd" From 22eb22e4efdf402c4d39637b9e2c0e74d601cea1 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Fri, 18 Dec 2015 08:28:09 +0100 Subject: [PATCH 2/2] use command -v instead of type to check for shell functions command -v is optional in IEEE Std 1003.1, 2004 Edition [1] and required in IEEE Std 1003.1, 2013 Edition [2] [1] http://pubs.opengroup.org/onlinepubs/009695399/utilities/command.html [2] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/command.html --- debian/bareos-director.bareos-dir.init.in | 2 +- debian/bareos-filedaemon.bareos-fd.init.in | 2 +- debian/bareos-storage.bareos-sd.init.in | 2 +- scripts/bareos-config-lib.sh.in | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/debian/bareos-director.bareos-dir.init.in b/debian/bareos-director.bareos-dir.init.in index 996626f7a6c..aaed75bf48f 100755 --- a/debian/bareos-director.bareos-dir.init.in +++ b/debian/bareos-director.bareos-dir.init.in @@ -45,7 +45,7 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin . /lib/lsb/init-functions # workaround, if status_of_proc is not defined (Ubuntu 8.04) -if ! type status_of_proc >/dev/null; then +if ! command -v status_of_proc >/dev/null; then status_of_proc () { local pidfile daemon name status OPTIND diff --git a/debian/bareos-filedaemon.bareos-fd.init.in b/debian/bareos-filedaemon.bareos-fd.init.in index 1fbf582886d..2d97b4cf52b 100755 --- a/debian/bareos-filedaemon.bareos-fd.init.in +++ b/debian/bareos-filedaemon.bareos-fd.init.in @@ -46,7 +46,7 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin . /lib/lsb/init-functions # workaround, if status_of_proc is not defined (Ubuntu 8.04) -if ! type status_of_proc >/dev/null; then +if ! command -v status_of_proc >/dev/null; then status_of_proc () { local pidfile daemon name status OPTIND diff --git a/debian/bareos-storage.bareos-sd.init.in b/debian/bareos-storage.bareos-sd.init.in index bc5108bd855..e2564ed6742 100755 --- a/debian/bareos-storage.bareos-sd.init.in +++ b/debian/bareos-storage.bareos-sd.init.in @@ -43,7 +43,7 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin . /lib/lsb/init-functions # workaround, if status_of_proc is not defined (Ubuntu 8.04) -if ! type status_of_proc >/dev/null; then +if ! command -v status_of_proc >/dev/null; then status_of_proc () { local pidfile daemon name status OPTIND diff --git a/scripts/bareos-config-lib.sh.in b/scripts/bareos-config-lib.sh.in index 3ed51c07e34..084cbbe0d99 100644 --- a/scripts/bareos-config-lib.sh.in +++ b/scripts/bareos-config-lib.sh.in @@ -37,7 +37,7 @@ os_type=`uname -s` is_function() { func=${1-} - test "$func" && type "$func" > /dev/null 2>&1 + test "$func" && command -v "$func" > /dev/null 2>&1 return $? }