New command to send a directory to moulette
This commit is contained in:
parent
0e35a1a2e9
commit
72800c21cc
1 changed files with 39 additions and 0 deletions
39
commands/project/send_dir_to_moulette.sh
Executable file
39
commands/project/send_dir_to_moulette.sh
Executable file
|
@ -0,0 +1,39 @@
|
||||||
|
#!/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
|
Reference in a new issue