1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-22 15:58:50 -05:00

Rely on the return value of type instead of its output

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dave Reisner 2011-03-24 10:10:05 -04:00 committed by Dan McGee
parent a9fb4d9d5b
commit c02556e290
4 changed files with 6 additions and 6 deletions

View File

@ -61,7 +61,7 @@ spacman() {
if [ $EUID -eq 0 ]; then if [ $EUID -eq 0 ]; then
pacman "$@" pacman "$@"
else else
if [ ! "$(type -p sudo)" ]; then if ! type -p sudo; then
error "Cannot find the sudo binary! Is sudo installed?" error "Cannot find the sudo binary! Is sudo installed?"
error "Otherwise try to run the program as root" error "Otherwise try to run the program as root"
exit 1 exit 1

View File

@ -392,7 +392,7 @@ run_pacman() {
local cmd local cmd
printf -v cmd "%q " "$PACMAN" $PACMAN_OPTS "$@" printf -v cmd "%q " "$PACMAN" $PACMAN_OPTS "$@"
if (( ! ASROOT )) && [[ ! $1 =~ ^-(T|Qq)$ ]]; then if (( ! ASROOT )) && [[ ! $1 =~ ^-(T|Qq)$ ]]; then
if [ "$(type -p sudo)" ]; then if type -p sudo >/dev/null; then
cmd="sudo $cmd" cmd="sudo $cmd"
else else
cmd="su -c '$cmd'" cmd="su -c '$cmd'"
@ -1112,7 +1112,7 @@ create_signature() {
local ret=0 local ret=0
local filename="$1" local filename="$1"
msg "$(gettext "Signing package...")" msg "$(gettext "Signing package...")"
if [ ! $(type -p "gpg") ]; then if ! type -p gpg >/dev/null; then
error "$(gettext "Cannot find the gpg binary! Is gnupg installed?")" error "$(gettext "Cannot find the gpg binary! Is gnupg installed?")"
exit 1 # $E_MISSING_PROGRAM exit 1 # $E_MISSING_PROGRAM
fi fi

View File

@ -193,7 +193,7 @@ create_signature() {
local dbfile="$1" local dbfile="$1"
local ret=0 local ret=0
msg "$(gettext "Signing database...")" msg "$(gettext "Signing database...")"
if [ ! $(type -p "gpg") ]; then if ! type -p gpg; then
error "$(gettext "Cannot find the gpg binary! Is gnupg installed?")" error "$(gettext "Cannot find the gpg binary! Is gnupg installed?")"
exit 1 # $E_MISSING_PROGRAM exit 1 # $E_MISSING_PROGRAM
fi fi
@ -211,7 +211,7 @@ verify_signature() {
local dbfile="$1" local dbfile="$1"
local ret=0 local ret=0
msg "$(gettext "Verifying database signature...")" msg "$(gettext "Verifying database signature...")"
if [ ! $(type -p "gpg") ]; then if ! type -p gpg; then
error "$(gettext "Cannot find the gpg binary! Is gnupg installed?")" error "$(gettext "Cannot find the gpg binary! Is gnupg installed?")"
exit 1 # $E_MISSING_PROGRAM exit 1 # $E_MISSING_PROGRAM
fi fi

View File

@ -62,7 +62,7 @@ runtest() {
# use first arg as our binary if specified # use first arg as our binary if specified
[ -n "$1" ] && bin="$1" [ -n "$1" ] && bin="$1"
if [ ! $(type -p "$bin") ]; then if ! type -p "$bin"; then
echo "vercmp binary ($bin) could not be located" echo "vercmp binary ($bin) could not be located"
exit 1 exit 1
fi fi