Trying to write a subversion post-commit script to export php tu to a shared folder

I am trying to deploy a PHP application using subversion and post-commit script. I was looking for how to write a post-commit script, but I can't get it to work.

Configuration: I have svn folder installed on my server (OVH) in homeX.XX/svn/test/

My post-commit script should export to homeX.XX/dev/

I do not know how to write the correct path when using

#!/bin/bash
mkdir dev
chmod 777 dev
svn export svn+ssh://XXXXX@www.xxxx.com/homeX.XX/XXX/svn/test dev

in my POST-COMMIT script. I searched for the answers but could not find ...

0
source share
1 answer

From the SVN documentation ( here ):

The Subversion repository executes hook programs with an empty environment, that is, no environment variables are set at all, even $ PATH.

. , SVN, , - , , .

, script :

#!/bin/bash

# SVN-related variables
svnuser=XXXXX
svnhost=www.xxxx.com
svnpath=/homeX.XX/XXX/svn/test

# Local paths
exportpath=/homeX.XX/dev

# Make export dir if it does not exist
if [ ! -e "$exportpath" ]
then
    mkdir $exportpath
fi

# These permissions are very lenient! Are you sure you want this?
chmod 777 $exportpath

# Do the SVN export
export svn+ssh://$svnuser@$svnhost$svnpath $exportpath
+1

Source: https://habr.com/ru/post/1695751/


All Articles