Archived
1
0
Fork 0
This repository has been archived on 2021-10-08. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
ACU/commands/project/send_dir_to_moulette.sh
2013-10-18 08:50:30 +02:00

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