Category Archives: SVN

Subversion post-commit hook


#!/bin/sh

# Simple SHELL script untuk update web direktory di webserver setelah SVN Client Commit
# -------------------------------------------------------------------------
# Copyright (c) 2011 mustafa@intelix.co.id project <http://www.intelix.co.id/>
# -------------------------------------------------------------------------


PATH_REPOSITORY_PARENT="/development/csvn/data/repositories/" # default direktory on CollabNet Subversion
PATH_SCRIPT_AUTO_UPDATE="/development/csvn/autoupdate/"           #

if [ $# -ne 1 ];then
        echo "     Masukkan naame project sesuai dengan nama project di repository CollabNet Subversion"
        echo "     Nama project tidak boleh ada spasi "
        echo "     Format : svn_hooks [name_project]"
        echo "     Contoh : svn_hooks client_name"
        exit 1
fi

PROJECT_NAME="$1"
if [ ! -d "$PATH_REPOSITORY_PARENT${PROJECT_NAME}" ]; then
        echo "Repistory project ${PROJECT_NAME} tidak ditemukan di http://192.168.0.7:3343/csvn/"
        exit 1
fi

if [ ! -d "/var/www/html/$PROJECT_NAME" ]; then
        /bin/mkdir -p /var/www/html/${PROJECT_NAME}
        cd /var/www/html
        svn co http://192.168.0.7:18080/svn/${PROJECT_NAME} ${PROJECT_NAME}
        /bin/chown -R gmosking.apache /var/www/html/${PROJECT_NAME}

fi

/bin/sed "s/project_name/${PROJECT_NAME}/g" ${PATH_SCRIPT_AUTO_UPDATE}template_svn_update.tpl > ${PATH_SCRIPT_AUTO_UPDATE}post-commit-${PROJECT_NAME}.c

/usr/bin/gcc ${PATH_SCRIPT_AUTO_UPDATE}post-commit-${PROJECT_NAME}.c -o ${PATH_SCRIPT_AUTO_UPDATE}post-commit-${PROJECT_NAME}
/bin/chown gmosking.apache ${PATH_SCRIPT_AUTO_UPDATE}post-commit-${PROJECT_NAME}.c
/bin/chown gmosking.apache ${PATH_SCRIPT_AUTO_UPDATE}post-commit-${PROJECT_NAME}

echo "#!/bin/bash" > ${PATH_REPOSITORY_PARENT}${PROJECT_NAME}/hooks/post-commit
echo ${PATH_SCRIPT_AUTO_UPDATE}post-commit-${PROJECT_NAME} >> ${PATH_REPOSITORY_PARENT}${PROJECT_NAME}/hooks/post-commit

echo "${PATH_REPOSITORY_PARENT}${PROJECT_NAME}/hooks/post-commit"
/bin/chmod o+x ${PATH_REPOSITORY_PARENT}${PROJECT_NAME}/hooks/post-commit
/bin/chmod 755 ${PATH_REPOSITORY_PARENT}${PROJECT_NAME}/hooks/post-commit
/bin/chown gmosking.gmosking ${PATH_REPOSITORY_PARENT}${PROJECT_NAME}/hooks/post-commit

/etc/init.d/httpd reload

====================================================================================================================================

template_svn_update.tpl

#include <stddef.h>
#include <stdlib.h>
#include <unistd.h>
int main(void)
{
     execl("/usr/bin/svn", "svn", "update", "--username",
     "gmosking", "--password", "gmosking1234",
     "/var/www/html/project_name/",  (const char *) NULL);
     return(EXIT_FAILURE);
}

====================================================================================================================================
Advertisements

SUBVERSION COLLABNET SVN ON CENTOS 5.5


Testing On Centos 5.5

Install python dan pastikan versinya >=2.4

[root@pilot-project ~]# rpm -aq | grep python-*
libselinux-python-1.33.4-5.5.el5
gnome-python2-gnomevfs-2.16.0-1.fc6
python-dateutil-1.2-1.el5.centos
python-tgfastdata-0.9a6-6.el5ipa
python-sqlobject-0.9.2-1.el5ipa
python-elementtree-1.2.6-5
python-numeric-23.7-2.2.2
dbus-python-0.70-9.el5_4
gnome-python2-canvas-2.16.0-1.fc6
gnome-python2-applet-2.16.0-3.el5
python-paste-deploy-1.1-1.el5ipa
python-cherrypy-2.2.1-9.el5ipa
python-cheetah-2.0-1.el5.centos
python-turbocheetah-0.9.5-7.el5ipa
audit-libs-python-1.7.17-3.el5
python-ldap-2.2.0-2.1
python-sqlite-1.1.7-1.2.1
notify-python-0.1.0-3.fc6
gnome-python2-gconf-2.16.0-1.fc6
gnome-python2-extras-2.14.2-6.el5
gnome-python2-gnomeprint-2.16.0-3.el5
MySQL-python-1.2.2-3.el5s2
python-paste-1.4.2-1.el5ipa
python-turbokid-1.0.4-1.el5ipa
python-configobj-4.4.0-1.el5ipa
python-tgexpandingformwidget-0.1.3-5.el5ipa
python-pyasn1-0.0.7a-4.el5ipa
python-protocols-1.0-0.6.a0dev_r2302.el5ipa
python-paste-script-1.3.6-1.el5ipa
python-ruledispatch-0.5a0-0.5.svnr2306.el5ipa
gamin-python-0.1.7-8.el5
libxslt-python-1.1.17-2.el5_2.2
python-urlgrabber-3.1.0-5.el5
gnome-python2-libegg-2.14.2-6.el5
gnome-python2-gtksourceview-2.16.0-3.el5
python-setuptools-0.6c7-1.el5ipa
python-kid-0.9.6-1.1.el5ipa
python-decoratortools-1.6-1.el5ipa
python-json-3.4-3.el5ipa
python-TestGears-0.2-4.el5ipa
python-psycopg2-2.0.6-1.el5ipa
python-simplejson-1.7.3-1.el5ipa
python-kerberos-1.0-5.el5ipa
libxml2-python-2.6.26-2.1.2.8
python-devel-2.4.3-27.el5
mod_python-3.2.8-3.1
gnome-python2-2.16.0-1.fc6
gnome-python2-gtkhtml2-2.14.2-6.el5
gnome-python2-bonobo-2.16.0-1.fc6
python-formencode-0.7.1-1.el5ipa
python-sqlalchemy-0.3.11-1.el5ipa
python-sqlite2-2.3.3-1.el5ipa
python-cheetah-debuginfo-2.0-1.el5.centos
python-2.4.3-27.el5
python-iniparse-0.2.3-4.el5
rpm-python-4.4.2.3-18.el5
gnome-python2-desktop-2.16.0-3.el5
python-nose-0.10.0-2.el5ipa
python-turbojson-1.1.2-1.el5ipa
python-krbV-1.0.13-4.el5ipa
python-psycopg2-doc-2.0.6-1.el5ipa

[root@pilot-project ~]# java -version
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) Client VM (build 17.1-b03, mixed mode, sharing)

[root@pilot-project ~]# useradd ecentrix
[root@pilot-project ~]# visudo
ecentrix        ALL=(ALL)       NOPASSWD: ALL
[root@pilot-project ~]# su - ecentrix
[root@pilot-project ~]# mkdir /development
[root@pilot-project ~]# chown -R ecentrix.ecentrix /development
[root@pilot-project ~]# chmod -R 775 /development
[ecentrix@pilot-project ~]$ tar -zxvf CollabNetSubversionEdge-2.0.0_linux-x86.tar.gz
[ecentrix@pilot-project ~]$ cd csvn/
[ecentrix@pilot-project ~]$ sudo -E bin/csvn install
[ecentrix@pilot-project ~]$ bin/csvn start
[ecentrix@pilot-project ~]$ bin/csvn console
vim /development/csvn/data/conf/csvn.conf
RUN_AS_USER=ecentrix
JAVA_REQUIRED=true
JAVA_REQUIRED_VERSION=1.6
JAVA_HOME=/usr/java/default
WAIT_FOR_WEBSERVER_URL="http://localhost:3343/csvn"

[root@pilot-project ~]# vim /etc/bashrc
export JAVA_HOME=/usr/java/default
[root@pilot-project ~]# export JAVA_HOME=/usr/java/default
http://192.168.0.7:3343/csvn
username :admin
password :admin
GMOSKING
shisdew

Listens until think alike

moses.spaceku@yahoo.com / voip ipbx

Hosted PBX, IP-PBX SOHO/ CALL CENTER, VOICE GATEWAY, VOICE CARD, COST EFECTIVE SOLUTIONS (LCR), GSM/CDMA GATEWAY

%d bloggers like this: