#!/bin/sh # ======================================================================= # DEDIBOX - DEBIAN # SVN for TRAC & Apache Set up # According to the process described at http://www.howtoforge.com/subversion-trac-virtual-hosts-on-ubuntu-server # by Philippe Beaucart 22/05/2010 , updated on 27/07/2010 (following a server crash..) # shell file to be chmoded 0700 # shell file to run as root user # settings shall be adapted to your configuration - Pls see the next section just below # Note: Apache2 is a must for this install (not Apache 1.3) # Note: trac could be considered as a prerequisite for further shells but it's not required and can be removed from the REQUIRED_PACKAGES w/o errors if not wanted # ======================================================================= # ======================================================================= # TODO # Correct bad "sed" usage bugs in authz file building (Step10) # Replace std commands like "find" by their full path (ex FIND=$(whereis find | head -n 1) # Get automatically Apache client (www-data or whatever) from "envvars" # Use a ".ini" file for the codeveloppers and projet name and path # Add the option to just add a new repository and not recreate everything # ======================================================================= # ======================================================================= # changelog: # 08/09/2010. corrected part of sed bugs for authz building # 08/09/2010. Shell adapted to Dedibox Debian (Apache not compiled) # 19/08/2010. Shell rewrite by Hornetbzz after server crash # ======================================================================= # ######################################## # ADAPT VALUES TO YOUR OWN SETTINGS HERE # ######################################## # PRELIMINARY NOTES # STEPS 16 & 17 paths are to be adapted manually to your own configuration # virtual host is defined in STEP for http. Pls adapt httpd-vhosts.conf after execution if you like to use https # MODE DEBUG=1 # DATAS REQUIRED_PACKAGES="^libapache2-svn$|^libapache2-mod-fastcgi$|^subversion$|^subversion-tools$|^python-subversion$" REQUIRED_PACKAGES=$REQUIRED_PACKAGES"|^python-svn$|^python-svn-dbg$|^python-genshi-doc$" NB_PACKAGES=$(echo $REQUIRED_PACKAGES | sed -e 's/|/\n/g' | wc -l) # option 1= run a new site in sites-available or option 2=add svn to existing Vhost file (adding a new vhost for svn) # option1 is for Apache as Debian's package, option2 is for a compiled version of Apache VHOST_OPTION=1 # Robots prevented to access (yes =1, no=2) ROBOT_OPT=1 # Apache APACHE_CONF=/etc/apache2 # you shall adapt this path to your apache configuration file (httpd.conf for compiled Apache) APACHE_EXEC=`find / -name "apache*ctl" | egrep -v src | head -n 1` # Notice: find 1st occurence so risk to fail if 2 apache versions APACHE_REQUIRED_MODULES="dav dav_fs dav_svn authz_default auth_digest python" # See STEP 14 (+ add /usr/lib/apache2/modules/mod_python.so) APACHE_LOADED_MODULES=/tmp/apache_loaded_modules [[ ! -z $APACHE_EXEC ]] && eval $APACHE_EXEC" -M" > $APACHE_LOADED_MODULES APACHE_MISSING_MODULES=/tmp/apache_missing_modules # DIRECTORIES & FILES REP_SOURCE_DIR=/home/www/test # source files directory for repo creation: adapt to your config TARGET_=/var/lib/svn # adapt to your config REPOSITORY=/test.net # repo name : to adapt to your wish PROJECT="/dev" # repo subname: to adapt to your wish HOST=$TARGET_$REPOSITORY # no change here ACCESS="2770" # do not change here TMP_=/tmp # do not change here HTPASSWD=".passwd" # do not change except if the filename created by SVN is different from "passwd" (it could be named "htpasswd" but take care to apache config) PERMISSIONS="authz" # do not change except if the filename created by SVN is different from "authz" LOG_DIR=/var/log/apache2 # do not change here # USERS # Warning: you can change values here but keep your Apache client "www-data" or "nobody" or whoever within the $UID0 variable GROUP="developpers" # put what you want here for the group and users except UID0 UID0="www-data" # Apache client (could be nobody or www-data depending on your configuration, pls check your httpd.conf file in the USER/GROUP directives) UID1="admin" # Main developper UID2="codev1" # co developper 1 UID3="codev2" # co developper 2 (same rights on same directories than codev1, can be tuned later) UID4="codev3" # co developper 3 (same rights on same directories than codev1, can be tuned later) USERS=$UID0" "$UID1" "$UID2" "$UID3" "$UID4 # do not change here USERS_REG=`echo $USERS | sed -e 's/ /|/g'` # coding alternative for bash: $(echo $USERS | sed -e 's/ /|/g') # SVN PERMISSIONS # BECAREFUL HERE: Shall look for details about permissions at http://svnbook.red-bean.com/nightly/en/svn.serverconfig.pathbasedauthz.html NEW_GRP=$GROUP"=" for user in $USERS do new_user=$(echo $user | sed -e "s/ //g") [[ ! -z $new_user ]] && NEW_GRP=$NEW_GRP$new_user"," done # remove trailing comma NEW_GRP=$(echo $NEW_GRP | sed -e 's/,$//') # warning1: this leads to read access for All !! you MUST changed this value to your svn settings. # warning2: no space here due to shell sed function usage NEW_RIGHTS="[/]\n*=r\n" # Other required datas for the shell metacar="^ . [ ] $ ( ) * + ? | { } \ " DELIMITER="\n# ####################################################################\n" # ######################################## # DO NOT CHANGE ANY VALUES FROM THIS POINT # ######################################## # STEP 0) INITIAL SET UP : wrap up all existing Apache vhosts into a single file for later checking (See STEP ...) clear echo "STEP 0 : In case of Apache as Debian package (Vs. compiled), wrap up all vhost into a single file" AVAILABLE_SITES_DIR=$(find $APACHE_CONF -type d -name "sites-available" | head -n 1) APACHE_DEB=$(dpkg -l | awk '{print $2}' | grep -E "^apache2$" | wc -l) if [ $APACHE_DEB -eq 1 ] && [ $VHOST_OPTION -ne 1 ];then echo -e "... Warning !!!!!!!!\noption for vhosts in httpd.conf has been choosen but you've Apache as a Debian package" echo "... This is high probability to be a mistaken choice, pls check again your choice" echo "... (for a compiled Apache => choose VHOST_OPTION = 2, for Apache as a Debian's package, choose VHOST_OPTION = 1)" exit fi if [ $APACHE_DEB -eq 1 ];then echo "... Apache Install has been found as a DEBIAN standard Package" # Wrap all vhosts into a single file [[ ! -d $APACHE_CONF/extra ]] && mkdir $APACHE_CONF/extra [[ -f $APACHE_CONF/extra/all_vhosts ]] && echo "" > $APACHE_CONF/extra/all_vhosts for available_site in $(ls $AVAILABLE_SITES_DIR) do site_path=$(find $AVAILABLE_SITES_DIR -name "$available_site") vhost=$(grep -i -e "> $APACHE_CONF/extra/all_vhosts && cat $site_path >> $APACHE_CONF/extra/all_vhosts done fi # STEP 1) INITIAL SET UP : check if missing librairies compared to required packages echo "STEP 1 : Set up for SVN" echo "... checking pre-requisites (Apache version shall match V2.x and check for installed librairies)" # Check apache Version # eval $APACHE_EXEC" -v" > /tmp/apache_version APACHE_VERSION=`$APACHE_EXEC -v | cut -d":" -f 2 | head -n 1 | cut -d"/" -f 2` echo "...... checking Apache version: "$APACHE_VERSION APACHE_VERSION=${APACHE_VERSION:0:1} [[ $APACHE_VERSION -ne 2 ]] && echo "Apache version do not match with a SVN installation, you shall install Apache 2.x.x" && exit # Check installed Vs required librairies IC=`dpkg -l | awk '{print $2}' | grep -E $REQUIRED_PACKAGES | wc -l` if [ $IC -lt $NB_PACKAGES ] then # browse the required package and check if it's installed; if not, install it PACKAGE_LIST=`echo $REQUIRED_PACKAGES | sed -e 's/[\^\$\|]/ /g'` FLAG=0 # DEBUG #echo "prerequisite: installed packages: NOK" #echo "already installed : $IC , required to be installed : $NB_PACKAGES" #echo "INSTALLED" #echo `dpkg -l | awk '{print $2}' | grep -E $REQUIRED_PACKAGES` #echo "REQUIRED" #echo $REQUIRED_PACKAGES for required in $PACKAGE_LIST do # echo -e "\n\nChecking for package: $required" found_list=`dpkg -l | awk '{print $2}' | grep -E $required` # echo "found packages: "$found_list found_exact_package=`echo $found_list | sed "s/\(.*\)\($required\)\([^a-zA-Z].*\)/\2/g"` # DEBUG: echo "found_exact_package: "$found_exact_package # DEBUG: [[ $found_exact_package = $required ]] && echo "MATCHING !" [[ $found_exact_package != $required ]] && FLAG=1 && echo -e "NOT MATCHING : debian librairie is too be installed manually by running:\n aptitude install $required" done else echo "...... prerequisite: installed librairies: Ok" fi [[ $FLAG -eq 1 ]] && echo "pls proceed now to the required librairies installation" && exit # Check for Apache Modules enabled: # See also STEP 14 => check that Apache modules dav, dav_fs, dav_svn, authz are are enabled (all required for svn) echo "...... checking for Apache loaded modules" # DEBUG #echo "debug: apache modules" #cat $APACHE_LOADED_MODULES #exit [[ -f $APACHE_MISSING_MODULES ]] && rm $APACHE_MISSING_MODULES [[ $APACHE_DEB -eq 1 ]] && AVAILABLE_MODULES=$(ls $APACHE_CONF/mods-available) for module in $APACHE_REQUIRED_MODULES do # CASE 1: apache as a Debian's package if [ $APACHE_DEB -eq 1 ];then # in the loop as it changes recursively (several mods can be enabled) ENABLED_MODULES=$(ls $APACHE_CONF/mods-enabled) found=$(echo $ENABLED_MODULES | grep $module | wc -l) # If module is not enabled, we check if it's available and enable it found_available=$(echo $AVAILABLE_MODULES | grep $module | wc -l) [[ $found_available -ge 1 ]] && a2enmod $module 2>/dev/null && found=1 # CASE 2: other apache version (for example, compiled) elif [ $APACHE_DEB -ne 1 ];then cat $APACHE_LOADED_MODULES > /tmp/apache_check_modules found=$(grep $module"_module" /tmp/apache_check_modules | wc -l) fi echo "......... checking module $module : $found" [[ $found -eq 0 ]] && echo $module >> $APACHE_MISSING_MODULES done HELP="\nHints: 2 ways to achieve this\n1)APT\n- aptitude install libapache2-mod-python,\n- restart Apache using /etc/init.d/apache2 restart" HELP=$HELP"\n\nor\n\n2)Recompile :\n- recompile Apache with this module\n- add a LoadModule directive in httpd.conf (DSO)" HELP=$HELP"\n- restart Apache using $APACHE_EXEC" HELP=$HELP"\nnota: Apache must have been compiled with --enabled share librairies\n" [[ -f $APACHE_MISSING_MODULES ]] && [[ -s $APACHE_MISSING_MODULES ]] && echo -e "Missing Apache Modules:\n" && cat $APACHE_MISSING_MODULES && echo -e $HELP && exit echo "...... checked for Apache loaded modules: Ok" # STEP2) Create host directory echo "STEP2 : CREATE HOST" cd / echo "... creating host directory: "$HOST mkdir -p $HOST # STEP 3) && STEP4) Create SVN development group & users echo "STEP3 & STEP 4 : NEW DEVELOPEMENT GROUP & USERS ADDED" addgroup $GROUP for USER in $USERS do HELP="Hints: 2 ways to achieve this\n1)aptitude install libapache2-mod-python,\nadd a LoadModule directive in httpd.conf\nrestart Apache using $APACHE_EXEC\nor\n2)Recompile Apache with this module\nnota: for the 1st solution, apache must have been compiled with --enabled share librairies" [[ $DEBUG -eq 1 ]] && echo "... adding $USER to $GROUP" adduser $USER --system --no-create-home --ingroup $GROUP 2>/dev/null done [[ $DEBUG -eq 1 ]] && echo "DEBUG: looking for $GROUP in /etc/group and $USERS_REG in /etc/passwd" [[ $DEBUG -eq 1 ]] && echo "/etc/group" && cat /etc/group | grep -i $GROUP [[ $DEBUG -eq 1 ]] && echo "/etc/passwd" && cat /etc/passwd | grep -E $USERS_REG IC1=`cat /etc/group | grep -i $GROUP | wc -l` IC2=`cat /etc/passwd | grep -E $USERS_REG | wc -l` HOW_MANY_USERS=$(echo $USERS | sed -e "s/ /\n/g" | wc -l) [[ $IC1 -eq 0 || $IC2 -lt $HOW_MANY_USERS ]] && echo "==> Group or user have not been all created (Grp:"$IC1", Users:"$IC2 / $HOW_MANY_USERS")" && exit # STEP 5) Set up the right permissions (could be done before..) echo "STEP 5 : chmod "$ACCESS" "$HOST chmod $ACCESS $HOST # STEP 6) Create SVN repository # Remove previous tmp datas, generate tmp tree for SVN and create repository echo "STEP 6: Set up repository" echo "... creating tmp svn tree" [[ -e /tmp$REPOSITORY ]] && rm -rf /tmp$REPOSITORY mkdir -p $TMP_$REPOSITORY/{trunk,tags,branches} echo "... copying from source "$REP_SOURCE_DIR" to tmp svn tree at "$TMP_$REPOSITORY"/trunk" cp -r $REP_SOURCE_DIR $TMP_$REPOSITORY/trunk echo "... safe removing of the previous repository" if [[ ! -z $HOST ]] && [[ -e $HOST ]] && [[ -n $HOST ]] && [[ $HOST != "/" ]] && [[ $HOST != "." ]] && [[ $HOST != "./" ]] then rm -rf $HOST else echo "==> ERR: "$HOST" non defined" && exit fi echo "... creating SVN Host : "$HOST svnadmin create $HOST echo "... import tmp datas "$TMP_$REPOSITORY" to SVN host "$HOST$PROJECT" (pls wait)" svn import $TMP_$REPOSITORY file:///$HOST$PROJECT -m "Release 0 : Initial Import" >/dev/null [[ $? -eq 1 ]] && echo "==> ERR: import data issue - pls check if import has been effective" && exit # STEP 7) Clear existing htpasswd echo "STEP 7: Clear htpasswd from repository " echo "... searching for htpasswd path (file : "$HTPASSWD")" FPATH=`find $HOST -type f -name $HTPASSWD -exec dirname {} \; | cat | sort | uniq` if [[ -z $FPATH ]];then echo "htpasswd file NOT found or not existing yet" else echo "... found htpasswd file : "$FPATH"/"$HTPASSWD echo "... remove existing htpasswd file: $HTPASSWD" [[ ! -z $HTPASSWD ]] && [[ -f $FPATH"/"$HTPASSWD ]] && rm -i $FPATH"/"$HTPASSWD fi # STEP 8) Allow Group to write into repository echo "STEP 8: Allow Group to write into repository" echo "... setting repository access rights -R g+w to "$HOST chmod -R g+w $HOST # STEP 9) Set files ownership echo "STEP 9: set files ($HOST) ownership to ($UID0) from group ($GROUP)" echo "... setting ownership ($UID0:$GROUP) to files ($HOST)" chown -R $UID0:$GROUP $HOST # STEP 10) Set Repo access permissions "authz" (done in 2 steps, could be reduced into one shot...) echo "STEP 10: set repository access permissions - altering existing files " echo "... searching for file "$PERMISSIONS FPATH=`find $HOST -type f -name $PERMISSIONS -exec dirname {} \; | cat | sort | uniq` [[ -z $FPATH ]] && echo "==> ERR: permission file NOT found - please check file name and location" && exit PERM_FILE=$FPATH"/"$PERMISSIONS echo "... found permission file : "$PERM_FILE echo "... copying the original file to "$PERM_FILE"_history before modifying it" cat $PERM_FILE >> $PERM_FILE"_history" # comment: this file is removed by previous commands echo "... uncomment the [groups] session in $PERM_FILE" sed -i -e "s/^#*\[groups\]/\[groups\]/g" $PERM_FILE echo "... adding the new group to the permission access file: "$NEW_GRP # Note: assume there is already a group session [groups] uncommented in the file GRP_PATTERN="/^\[groups\]/a\\"$NEW_GRP"\n" [[ $DEBUG -eq 1 ]] && echo "DEBUG: sed -i -e $GRP_PATTERN $PERM_FILE" sed -i -e $GRP_PATTERN $PERM_FILE # [[ $? -eq 1 ]] && echo "==> ERR: group pattern not found in the permission file" && exit # add space before and after "=" when lowcase (ie for users) (now but not at the $NEW_GRP creation) # sed -i -e sed -e "s/\([a-z]\)=\([a-z]\)/\1 = \2/g" $PERM_FILE echo "... adding the following access rules to the permission file: "$NEW_RIGHTS # opening bracket metacharacter to be escaped : add backslash before the first found opening bracket (backslash HEX code: 5C) [[ $DEBUG -eq 1 ]] && echo "DEBUG: SED_RIGHTS=$(echo $NEW_RIGHTS | sed -e "s/^\[/\x5C\[/")" SED_RIGHTS=$(echo $NEW_RIGHTS | sed -e "s/^\[/\x5C\[/") # closing bracket metacharacter to be escaped: add backslash before the first found closing bracket (backslash HEX code: 5C) [[ $DEBUG -eq 1 ]] && echo "DEBUG: SED_RIGHTS=$(echo $SED_RIGHTS | sed -e "s/\]/\x5C\]/") " SED_RIGHTS=$(echo $SED_RIGHTS | sed -e "s/\]/\x5C\]/") # forward slash to be escaped: add backslash before directory slash (backslash HEX code: 5C) & tip: change delimiter # SED_RIGHTS=$(echo $SED_RIGHTS | sed -e "s:\/:\x5C\/:") # = sign to be escaped: add backslash before directory slash (backslash HEX code: 5C) # SED_RIGHTS=$(echo $SED_RIGHTS | sed -e "s:\=:\x5C\=:") # Pattern: we will add the access rights just after the previously added lines RIGHTS_PATTERN="/$new_user$/a\\"$SED_RIGHTS sed -i -e $RIGHTS_PATTERN $PERM_FILE # Formatting PERM_FILE: adding space (code hex=20) before and after "=" sign on the previously added ligns # [group] session GRP_SPACE_PATTERN='s:\('$GROUP'.*\)=\(.*\):\1\x20=\x20\2:' sed -i -e $GRP_SPACE_PATTERN $PERM_FILE # user rights session # Last character before "=" (ie the last char of the user name or group of users) last_car=`echo $rights | grep "=" | cut -d= -f 1 | sed 's:\(.*\)\(*\)$:\2:g'` # Check whether this car is a metachar or not. If yes, escape it by adding a backslash (hex code 5C) for car in $metacar do [[ $last_car = $car ]] && last_car="\x5C"$last_car && break done # Insert one space before and after the "=" sign in the found line where there have been inserted the user rights SPACE_PATTERN='s/\(.*'$last_car'\)=\(.*\)/\1\x20=\x20\2/g' sed -i -e $SPACE_PATTERN $PERM_FILE # DEBUG check point #cat $PERM_FILE #exit # STEP 11 & STEP 12) Add logs to logrotate echo "STEP 11 and STEP 12: add svn to logs" # step 11 [[ ! -e $LOG_DIR ]] && mkdir $LOG_DIR && echo "... creating svn log directory "$LOG_DIR [[ -e $LOG_DIR ]] && echo "... svn log directory already exists : "$LOG_DIR # Step 12: # pls note that "apache2" is already in the log rotate file list in case of Apache as a Debian package, otherwise: # vi /etc/logrotate.d/apache2 # vi /etc/logrotate.conf # STEP 13: set up apache virtual host (to be disabled if already created in httpd.conf) echo "STEP 13: set up Apache with a new virtual host (do not forget to disable sites a2dissite xxx if you created it before)" echo "... create Apache Vhost file" # cut the first character (which is a slash) of the repository declared name in this shell headers SVNSERVER=${REPOSITORY:1} # nota: this way is "bash but not sh" compliant notation (if error: sh => use backward quotes - altgr 7: ) VHOST="\n\n# ###########################################################\n" VHOST=$VHOST"# Shell created SVN VIRTUAL HOST (no SSL in this version)\n" VHOST=$VHOST"# ###########################################################\n\n" VHOST=$VHOST" \n DocumentRoot "$HOST"\n ServerName www."$SVNSERVER"\n \n DAV svn \n AuthType Basic\n AuthName \""$SVNSERVER"\"\n AuthUserFile "$FPATH"/"$HTPASSWD"\n AuthzSVNAccessFile "$PERM_FILE"\n SVNPath "$HOST"\n # Nota: previous line: SVNPath could be replaced by SVNParentPath if access problem \n Require valid-user\n \n CustomLog "$LOG_DIR"/svn_access.log combined\n ErrorLog "$LOG_DIR"/svn_error.log\n #SSLEngine on\n #SSLCertificateFile /etc/apache2/ssl/apache.pem\n # Add this once there is a real (non self-signed) certificate.\n # SSLCertificateKeyFile /etc/apache2/ssl/server.key\n " # Option 1: ADD as a new website (case of Apache as a Debian package) : [[ $VHOST_OPTION -eq 1 ]] && [[ ! -f $APACHE_CONF/sites-available$REPOSITORY ]] && echo -e $VHOST > $APACHE_CONF/sites-available$REPOSITORY [[ $VHOST_OPTION -eq 1 ]] && [[ -f $APACHE_CONF/sites-available$REPOSITORY ]] && echo "... vhost not created (already existing)" # Option 2: check first than vhost is not already included in httpd-vhost.conf and add it to httpd-host.conf # Search for the ServerName line and check if it's not commented [[ $VHOST_OPTION -eq 2 ]] && EXISTING_LINES=`cat $APACHE_CONF/extra/httpd-vhosts.conf | grep "ServerName $SVNSERVER" | wc -l` [[ $VHOST_OPTION -eq 2 ]] && echo "DEBUG existing lines : "$EXISTING_LINES [[ $VHOST_OPTION -eq 2 ]] && COMMENTED_LINES=`cat $APACHE_CONF/extra/httpd-vhosts.conf | grep "ServerName $SVNSERVER" | grep "#" | wc -l` [[ $VHOST_OPTION -eq 2 ]] && echo "DEBUG commented existing lines : "$COMMENTED_LINES # If ServerName has been already declared and at least one of these lines is not commented then exit [[ $VHOST_OPTION -eq 2 ]] && [[ $COMMENTED_LINES -lt $EXISTING_LINES ]] && echo "... ServerName already declared in "$APACHE_CONF"/extra/httpd-vhosts.conf" && exit # Add it to httd-vhosts.conf [[ $VHOST_OPTION -eq 2 ]] && echo -e $VHOST >> $APACHE_CONF/extra/httpd-vhosts.conf && echo "... MAKE SURE to include this file in httpd.conf" # Try to check httpd.conf setup for vhost cat $APACHE_CONF/httpd.conf | grep -E "^Include etc/apache2/extra/httpd-vhosts.conf" [[ $? -eq 1 ]] && [[ $VHOST_OPTION -eq 2 ]] && echo "... Warning: pls check to Include etc/apache2/extra/httpd-vhosts.conf in your configuration file httpd.conf" # STEP 14: Enable Apache SVN Vhost echo "STEP 14: Enable Apache SVN Vhost" # echo "... enabling modules" # a2enmod dav_svn # [[ $? -eq 1 ]] && echo -e "==> ERR: dav_svn module is not enabled\n2 solutions:\n-recompile Apache with these modules\nor\ninstall these modiules and insert Apache directive LoadModule in httpd.conf" && exit # Set up vhost or new site depending on the choosen option [[ $VHOST_OPTION -eq 1 ]] && a2ensite $SVNSERVER [[ $VHOST_OPTION -eq 2 ]] && a2dissite $SVNSERVER # STEP 15: create user/passwd combination for svn echo "STEP 15: create htpasswd for svn users " # HTPASSWD [[ $HTPASSWD = ".htpasswd" ]] && echo "Warning: make sure that Apache config does not prevent access to $HTPASSWD files or rename the file for svn" # Rename the file if already existing [[ -f $FPATH"/"$HTPASSWD ]] && HTPASSWD=$HTPASSWD"_new" FLAG=0 for user in $USERS do echo "... htpasswd for "$user" in "$FPATH"/"$HTPASSWD if [ $FLAG -eq 0 ]; then # create the htpasswd file for the 1st user htpasswd -c $FPATH"/"$HTPASSWD $user else # update the htpasswd file for the next users htpasswd $FPATH"/"$HTPASSWD $user fi FLAG=1 done # STEP 16: restart Apache web server echo "STEP 16: restart Apache web server" eval $APACHE_EXEC" -k stop 2>/dev/null" eval $APACHE_EXEC" -t -k start 2>/dev/null" # STEP 17: establish symlink echo "STEP 17: establish symlink" [[ ! -L /usr/bin/svnwrap ]] && echo "... creating symlink to svn" && ln -s /usr/bin/svnwrap /usr/local/bin/svn [[ -L /usr/bin/svnwrap ]] && echo "... symlink to svn already existing" # STEP 18: for local testing, pls check your /etc/hosts echo "STEP 18: for local access and testing purposes, pls check that your /etc/hosts contains your repo hostname" cat /etc/hosts | grep $REPOSITORY # STEP 19: prevent robot from acceeding the svn repository echo "STEP 19: Prevent Robot from acceding the svn repository" HT_ACCESS_CONTENT="User-agent: *\nDisallow: /" HT_ACCESS_FILE=$HOST"/robots.txt" [[ "$ROBOT_OPT" -eq "1" ]] && echo -e $HT_ACCESS_CONTENT > $HT_ACCESS_FILE || echo "... option not required" # STEP 20: User msg echo -e "\n\n*********************************************************" echo -e "* INSTALLATION SUCCESS" echo -e "* PLS DO NOT FORGET TO :" echo -e "* 1- adapt your virtual host in httpd-vhosts.conf if you like to use https i/o http" echo -e "* 2- check your passwd file (Nota: ASCII format can sometimes solve problems)" echo -e "* 3- reset or tune the user and group access rights in "$PERM_FILE echo -e "* 4- restart Apache " echo -e "*********************************************************"