This repository has been archived on 2020-01-17. You can view files and clone it, but cannot push or open issues or pull requests.
2018-04-19 10:35:41 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
if [ "$#" -eq "0" ]; then
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
projectName=$1
|
|
|
|
repoDir="/var/lib/git/$projectName"
|
|
|
|
srcDir="/tmp/vn-repo/$projectName/src"
|
|
|
|
logFile="/var/cache/reprepro/logs/$projectName.out"
|
|
|
|
|
|
|
|
rm -f "$logFile"
|
|
|
|
|
2018-04-19 12:05:16 +00:00
|
|
|
echo -e "\n# Deploying started\n" >> "$logFile"
|
2018-04-19 12:00:16 +00:00
|
|
|
echo " * Date: $(date)" >> "$logFile"
|
|
|
|
echo " * Project: $projectName" >> "$logFile"
|
|
|
|
echo " * Directory: $srcDir" >> "$logFile"
|
2018-04-19 12:05:16 +00:00
|
|
|
echo " * Host: $(hostname)" >> "$logFile"
|
2018-04-19 12:00:16 +00:00
|
|
|
|
2018-04-19 10:35:41 +00:00
|
|
|
mkdir -p "$srcDir"
|
|
|
|
git --work-tree="$srcDir" --git-dir="$repoDir" checkout -f
|
|
|
|
|
|
|
|
if [ -f "$srcDir/deploy" ]
|
|
|
|
then
|
2018-04-19 10:52:21 +00:00
|
|
|
(cd "$srcDir" && "$srcDir/deploy" >> "$logFile" 2>&1)
|
2018-04-19 10:35:41 +00:00
|
|
|
fi
|
2018-04-19 11:55:22 +00:00
|
|
|
|
2018-04-19 12:05:16 +00:00
|
|
|
echo -e "\n# Deploying ended\n" >> "$logFile"
|