about summary refs log tree commit diff stats
path: root/tools/conf/srv/gitolite/deploy-web.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tools/conf/srv/gitolite/deploy-web.sh')
-rw-r--r--tools/conf/srv/gitolite/deploy-web.sh14
1 files changed, 8 insertions, 6 deletions
diff --git a/tools/conf/srv/gitolite/deploy-web.sh b/tools/conf/srv/gitolite/deploy-web.sh
index 86d2026..fcefa97 100644
--- a/tools/conf/srv/gitolite/deploy-web.sh
+++ b/tools/conf/srv/gitolite/deploy-web.sh
@@ -1,9 +1,9 @@
-#!/bin/bash
+#!/bin/sh
 
 pkg_path=$1
 
-www_root="/srv/www"
-www_user="www"
+www_root="/srv/www/htdocs"
+www_user="daemon"
 www_group="www"
 
 pkg_file="${pkg_path}/project"
@@ -31,11 +31,12 @@ fi
 # first backup all data
 if [[ ! $(ls ${pkg_www} | grep -v "backup_deploy") = "" ]]; then
     if [ ! -d ${pkg_back} ]; then
-        sudo -u ${www_user} mkdir -p ${pkg_back}
+    	mkdir -p ${pkg_back}
     fi
     backup_file="${pkg_back}/${pkg_name}-$(date '+%Y-%j-%H-%M-%S').tar.gz"
     echo "Deploy web: making backup ${backup_file}"
-    sudo -u ${www_user} tar --exclude ${pkg_back} --xattrs -zcpf ${backup_file} ${pkg_www}
+    tar --exclude ${pkg_back} --xattrs -zcpf ${backup_file} ${pkg_www}
+    chown -R ${www_user}:${www_group} ${pkg_back}
 fi
 
 # remove files and directories that have been deleted
@@ -65,7 +66,8 @@ fi
 # copy new files to destination
 if [ -d ${pkg_files} ]; then
     echo "Deploy web: cp from ${pkg_files} to ${pkg_www}"
-    sudo -u ${www_user} cp -r ${pkg_files}/* ${pkg_www}
+    cp -r ${pkg_files}/* ${pkg_www}
+    chown -R ${www_user}:${www_group} ${pkg_www} 
 fi
 
 echo ${pkg_new} > ${pkg_last}