Thread: Run SVN post-commit hook as root.
i've been waiting while topic - thought best re-write question.
have website hosted in: /var/www/domain.com/
have svn repository: /var/svn/domain.com/
have svn post-commit hook: /var/svn/hooks.d/post-commit
symbolic link has been set-up direct each svn repository ../hooks.d/ directory.
/var/svn/hooks.d/post-commit*
code:#!/bin/bash su -c /var/bin/svn_co -h $1 >> /var/log/subversion.log
/var/bin/svn_co*
code:#!/bin/bash # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # checkout repository development environment # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- usage() { cat << eof usage: checkout virtual host svn repository development environment, removing traces of .svn cache directories afterwards. ./svn_co -h <domain_name> options: -h <domain_name> the virtual host domain name. eof } # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- sh_dir_dev="/var/www/" sh_dir_svn="/var/svn/" # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- if [ "$1" == "--help" ]; usage exit else while getopts ":h:" opt; case ${opt} in h) domain_name=`echo ${optarg} | cut -d '.' -f 2-` ;; *) echo "invalid option: -${opt} ${optarg}" echo "use: --help more information." exit 1 ;; esac done fi if [ -z "${domain_name}" ]; usage exit fi if [ ! -e "${sh_dir_dev}${domain_name}" ]; echo "domain name ${domain_name} not exist, aborting." exit fi echo "checking out repository..." svn export --force file://${sh_dir_svn}${domain_name} ${sh_dir_dev}${domain_name}/dev echo "updating ownership , mode..." chown -r www-data:www-data ${sh_dir_dev}${domain_name}/dev echo "clearing cache directories..." rm -fr `find ${sh_dir_dev}${domain_name}/dev -type d -name .svn`
/var/log/subversion.log
code:usage: su [options] [login]
wondering if me?
Forum The Ubuntu Forum Community Ubuntu Specialised Support Ubuntu Servers, Cloud and Juju Server Platforms [ubuntu] Run SVN post-commit hook as root.
Ubuntu
Comments
Post a Comment