Kaynağa Gözat

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

This fixes using minimal-template based VMs to store/retrieve backup.
Marek Marczykowski-Górecki 8 yıl önce
ebeveyn
işleme
5157d9822e
2 değiştirilmiş dosya ile 2 ekleme ve 2 silme
  1. 1 1
      qubes-rpc/qubes.Backup
  2. 1 1
      qubes-rpc/qubes.Restore

+ 1 - 1
qubes-rpc/qubes.Backup

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

+ 1 - 1
qubes-rpc/qubes.Restore

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