39 lines
839 B
Bash
Executable file
39 lines
839 B
Bash
Executable file
#!/bin/sh
|
|
|
|
if [ "$#" -ne 3 ]
|
|
then
|
|
echo "Usage: $0 project rendu git_repo"
|
|
exit 1
|
|
fi
|
|
|
|
project_id="$1"
|
|
rendu="$2"
|
|
git_repo="$3"
|
|
|
|
if ! whereis gearman > /dev/null 2> /dev/null
|
|
then
|
|
echo "gearman isn't installed on this machine. Please try another one."
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -d "$git_repo" ]; then
|
|
ls "$git_repo"
|
|
echo "$git_repo: file not found"
|
|
exit 2
|
|
fi
|
|
|
|
FILENAME=$(basename "$git_repo")
|
|
FILE="<file name=\"$FILENAME\">$(tar -czf - -C "$git_repo" . | base64 )</file>"
|
|
|
|
cat <<EOF | gearman -h gearmand -p 4730 -f moulette_get
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
<process>
|
|
<param name="type">std</param>
|
|
<param name="id">$project_id</param>
|
|
<param name="year">2016</param>
|
|
<param name="rendu">$rendu</param>
|
|
<param name="login">$FILENAME</param>
|
|
<param name="file">$FILENAME</param>
|
|
$FILE
|
|
</process>
|
|
EOF
|