summaryrefslogtreecommitdiff
path: root/debian
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2015-12-06 14:03:35 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2015-12-06 14:03:35 +0100
commite75e5879c0e8d232a2e8f045685beeb8c965aba4 (patch)
tree116954225b04f01e5d566d96900870f2bee4d0a8 /debian
parent2f17261da947e143d79d9c843a26eeb4b44ec385 (diff)
replace "which" with "command -v" for portability
which is a debian specific tool packaged in debianutils (essential) while command is a shell builtin defined by POSIX. Closes: 807144 Thanks: Mingye Wang for the suggestion.
Diffstat (limited to 'debian')
-rw-r--r--debian/apt.cron.daily10
-rwxr-xr-xdebian/rules2
2 files changed, 6 insertions, 6 deletions
diff --git a/debian/apt.cron.daily b/debian/apt.cron.daily
index 765dd4ae4..978f06ab6 100644
--- a/debian/apt.cron.daily
+++ b/debian/apt.cron.daily
@@ -324,7 +324,7 @@ check_power(){
# 1 (false) System is not on main power
# 255 (false) Power status could not be determined
# Desktop systems always return 255 it seems
- if which on_ac_power >/dev/null; then
+ if command -v on_ac_power >/dev/null 2>&1; then
on_ac_power
POWER=$?
if [ $POWER -eq 1 ]; then
@@ -352,7 +352,7 @@ if test -r /var/lib/apt/extended_states; then
fi
# check apt-config existence
-if ! which apt-config >/dev/null ; then
+if ! command -v apt-config >/dev/null 2>&1; then
exit 0
fi
@@ -388,7 +388,7 @@ fi
check_power || exit 0
# check if we can lock the cache and if the cache is clean
-if which apt-get >/dev/null && ! eval apt-get check $XAPTOPT $XSTDERR ; then
+if command -v apt-get >/dev/null 2>&1 && ! eval apt-get check $XAPTOPT $XSTDERR ; then
debug_echo "error encountered in cron job with \"apt-get check\"."
exit 0
fi
@@ -451,7 +451,7 @@ UPDATE_STAMP=/var/lib/apt/periodic/update-stamp
if check_stamp $UPDATE_STAMP $UpdateInterval; then
if eval apt-get $XAPTOPT -y update $XSTDERR; then
debug_echo "download updated metadata (success)."
- if which dbus-send >/dev/null && pidof dbus-daemon >/dev/null; then
+ if command -v dbus-send >/dev/null 2>&1 && pidof dbus-daemon >/dev/null; then
if dbus-send --system / app.apt.dbus.updated boolean:true ; then
debug_echo "send dbus signal (success)"
else
@@ -487,7 +487,7 @@ fi
# auto upgrade all upgradeable packages
UPGRADE_STAMP=/var/lib/apt/periodic/upgrade-stamp
-if which unattended-upgrade >/dev/null && check_stamp $UPGRADE_STAMP $UnattendedUpgradeInterval; then
+if command -v unattended-upgrade >/dev/null 2>&1 && check_stamp $UPGRADE_STAMP $UnattendedUpgradeInterval; then
if unattended-upgrade $XUUPOPT; then
update_stamp $UPGRADE_STAMP
debug_echo "unattended-upgrade (success)"
diff --git a/debian/rules b/debian/rules
index c8e7cb285..db59d2898 100755
--- a/debian/rules
+++ b/debian/rules
@@ -24,7 +24,7 @@ confflags += --with-procs=$(PARALLEL)
# See below
-include build/environment.mak
-ifneq (,$(shell which dpkg-buildflags))
+ifneq (,$(shell command -v dpkg-buildflags))
# make does not export to $(shell) so we need to workaround
# (http://savannah.gnu.org/bugs/?10593)
dpkg_buildflags = DEB_BUILD_MAINT_OPTIONS=hardening=+all dpkg-buildflags