This commit is contained in:
Juan 2018-08-29 15:56:12 +02:00
parent 4e554cbce7
commit b9cf0cd1b4
4 changed files with 25 additions and 3 deletions

3
config Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
gitUrl=https://git.verdnatura.es

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
vn-repo (2.0.37) stable; urgency=low
vn-repo (2.0.38) stable; urgency=low
* Initial Release.

1
debian/install vendored
View File

@ -1,4 +1,5 @@
vn-repo.conf etc/apache2/conf-available
config etc/vn-repo
git-hooks usr/share/vn-repo
web usr/share/vn-repo
vn-branch usr/bin

View File

@ -6,6 +6,17 @@ if [ "$#" -eq "0" ]; then
fi
projectName=$1
gitBranch=$2
. /etc/vn-repo/config
if [ -z "$gitUrl" ]; then
gitUrl=http://localhost
fi
if [ -z "$gitBranch" ]; then
gitBranch=master
fi
repoDir="/var/lib/git/$projectName"
srcDir="/tmp/vn-repo/$projectName/src"
logDir="/usr/share/vn-repo/web/logs"
@ -21,10 +32,17 @@ echo " * Directory: $srcDir" >> "$logFile"
echo " * Host: $(hostname)" >> "$logFile"
mkdir -p "$srcDir"
git --work-tree="$srcDir" --git-dir="$repoDir" checkout -f
cd "$srcDir"
if [ ! -d "$srcDir/.git" ]; then
git init
fi
git config remote.origin.url "$gitUrl/$projectName"
git pull origin "$gitBranch"
if [ -f "$srcDir/deploy" ]; then
(cd "$srcDir" && "$srcDir/deploy" >> "$logFile" 2>&1)
"$srcDir/deploy" >> "$logFile" 2>&1
fi
echo -e "\n# Deploying ended\n" >> "$logFile"