core-agent-linux/qubes-rpc/qubes.Backup
Marek Marczykowski-Górecki ce63d31a2e
Make all scripts in qubes-rpc executable
Don't rely on legacy feature of interpreting non-executable files as
scripts there.
2017-06-09 23:09:58 +02:00

25 lines
601 B
Bash
Executable File

#!/bin/sh
echo Starting Backupcopy
read args
echo Arguments: $args
if [ -d "$args" ] ; then
echo "Performing backup to directory $args"
TARGET="$args/qubes-backup-`date +'%Y-%m-%dT%H%M%S'`"
echo "Copying STDIN data to $TARGET"
cat > $TARGET
else
echo "Checking if arguments is matching a command"
COMMAND=`echo $args | cut -d ' ' -f 1`
if type "$COMMAND"; then
echo "Redirecting STDIN to $args"
# Parsing args to handle quotes correctly
# Dangerous method if args are uncontrolled
eval "set -- $args"
$@
else
echo "Invalid command $COMMAND"
exit 1
fi
fi