backup: Use 'type' instead of 'which' to prevent unnecessary dependency

This fixes using minimal-template based VMs to store/retrieve backup.
This commit is contained in:
Marek Marczykowski-Górecki 2015-11-27 12:31:33 +01:00
parent c99dca37ce
commit 5157d9822e
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
2 changed files with 2 additions and 2 deletions

View File

@ -9,7 +9,7 @@ if [ -d "$args" ] ; then
else else
echo "Checking if arguments is matching a command" echo "Checking if arguments is matching a command"
COMMAND=`echo $args | cut -d ' ' -f 1` COMMAND=`echo $args | cut -d ' ' -f 1`
if which "$COMMAND"; then if type "$COMMAND"; then
echo "Redirecting STDIN to $args" echo "Redirecting STDIN to $args"
# Parsing args to handle quotes correctly # Parsing args to handle quotes correctly
# Dangerous method if args are uncontrolled # Dangerous method if args are uncontrolled

View File

@ -11,7 +11,7 @@ if [ -f "$args" ] ; then
else else
echo "Checking if arguments is matching a command" >&2 echo "Checking if arguments is matching a command" >&2
COMMAND=`echo $args | cut -d ' ' -f 1` COMMAND=`echo $args | cut -d ' ' -f 1`
if which "$COMMAND" >/dev/null; then if type "$COMMAND" >/dev/null; then
tmpdir=`mktemp -d` tmpdir=`mktemp -d`
mkfifo $tmpdir/backup-data mkfifo $tmpdir/backup-data
echo "Redirecting $args to STDOUT" >&2 echo "Redirecting $args to STDOUT" >&2