1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
#!/bin/bash
. usage.sh
#USAGE : faustremote <servurl> ==> <targets>
#USAGE : faustremote [<servurl>] <platform> <arch> <srcfile> ==> <binary.zip>
URL="34.76.156.75"
function targetrequest {
curl "$1/targets"
}
function compilation {
curl -F"file=@\"$4\";filename=\"$4\"" "$1/compile/$2/$3/binary.zip" --output binary.zip
}
if [ "$1" == "-h" ]; then
echo "Access the remote complation service to compile DSP programs"
echo "Usage: faustremote [<servurl>] [<platform> <arch> <srcfile>]"
echo "faustremote <servurl> ==> <targets>"
echo "faustremote <servurl> <platform> <arch> <srcfile> ==> <binary.zip>"
echo "When no <servurl> is defined, the default GRAME Faust URL service is used"
elif [ "$#" == "0" ]; then
targetrequest "$URL"
elif [ "$#" == "1" ]; then
targetrequest "$1"
elif [ "$#" == "3" ]; then
if [ -f "$3" ]; then
rm -rf binary.zip
compilation $URL $1 $2 $3
else
echo "ERROR: file $3 doesn't exist"
exit 1
fi
elif [ "$#" == "4" ]; then
if [ -f "$4" ]; then
rm -rf binary.zip
compilation $1 $2 $3 $4
else
echo "ERROR: file $4 doesn't exist"
exit 1
fi
fi
|