Archive

Posts Tagged ‘subversion’

Eclipse SVN plugin

April 7th, 2009 Arthur Gressick No comments

I needed to find the plugin for the Eclipse here is how you add subversion for eclipse.

Help > Software updates > Add Site…

I needed the version from tigris.org which was the latest. Check the version you have first

Linux

http://subclipse.tigris.org/update_1.6.x

Mac OS X

http://subclipse.tigris.org/update_1.4.x

Once you enter the new site select all of the packages, I chose all of the packages.

CentOS 5.2 SVN Server

February 20th, 2009 Arthur Gressick 3 comments

Here is a quick set of instructions for building a SVN server on Linux CentOS 5.2. I used it for a while unit I created one on Ubuntu 8.10

Check to see if SVN/Subversion is install on your box

which svn

If it is not installed then please install the application before continuing. Continue if already installed.

cd /etc/init.d/
/sbin/chkconfig --add svnserve

Now we want to make the configuration for the SVN Serve daemon so it starts when it is rebooted.

nano svnserve

Now that the editor is up paste the information below into the file.

#!/bin/bash
#
#   /etc/rc.d/init.d/subversion
#
# Starts the Subversion Daemon
#
# chkconfig: 2345 90 10
# description: Subversion Daemon
# processname: svnserve
# pidfile: /var/lock/subsys/svnserve
 
source /etc/rc.d/init.d/functions
 
[ -x /usr/bin/svnserve ] || exit 1
 
### Default variables
SYSCONFIG="/etc/sysconfig/subversion" 
 
### Read configuration
[ -r "$SYSCONFIG" ] && source "$SYSCONFIG" 
 
RETVAL=0
prog="svnserve"
arthur=" --listen-host 192.168.0.92 -r /var/repositories"
desc="Subversion Daemon"
pidfile="/var/run/$prog.pid" 
 
start() {
   echo -n $"Starting $desc ($prog): "
   daemon $prog -d $arthur --pid-file $pidfile
   RETVAL=$?
   if [ $RETVAL -eq 0 ]; then
     touch /var/lock/subsys/$prog
   fi
   echo
}
 
obtainpid() {
   pidstr=`pgrep $prog`
   pidcount=`awk -v name="$pidstr" 'BEGIN{split(name,a," "); print length(a)}'`
   if [ ! -r "$pidfile" ] && [ $pidcount -ge 2 ]; then
        pid=`awk -v name="$pidstr" 'BEGIN{split(name,a," "); print a[1]}'`
        echo $prog is already running and it was not started by the init script.
   fi
}
 
stop() {
   echo -n $"Shutting down $desc ($prog): "
   if [ -r "$pidfile" ]; then
        pid=`cat $pidfile`
        kill -s 3 $pid
        RETVAL=$?
   else
           RETVAL=1
   fi
   [ $RETVAL -eq 0 ] && success || failure
   echo
   if [ $RETVAL -eq 0 ]; then
     rm -f /var/lock/subsys/$prog
     rm -f $pidfile
   fi
   return $RETVAL
}
 
restart() {
        stop
     start
}
 
forcestop() {
   echo -n $"Shutting down $desc ($prog): " 
 
   kill -s 3 $pid
   RETVAL=$?
   [ $RETVAL -eq 0 ] && success || failure
   echo
   if [ $RETVAL -eq 0 ]; then
     rm -f /var/lock/subsys/$prog
     rm -f $pidfile
   fi
 
   return $RETVAL
}
 
status() {
   if [ -r "$pidfile" ]; then
        pid=`cat $pidfile`
   fi
   if [ $pid ]; then
           echo "$prog (pid $pid) is running..."
   else
        echo "$prog is stopped"
   fi
}                                                                           
 
obtainpid
 
case "$1" in
  start)
   start
   ;;
  stop)
   stop
   ;;
  restart)
   restart
   RETVAL=$?
   ;;
  condrestart)
   [ -e /var/lock/subsys/$prog ] && restart
   RETVAL=$?
   ;;
  status)
   status
   ;;
  forcestop)
   forcestop
   ;;
  *)
   echo $"Usage: $0 {start|stop|forcestop|restart|condrestart|status}"
   RETVAL=1
esac
 
exit $RETVAL

Now that the code has been copied save the file. Now we need to make it executable by the OS.

chmod +x svnserve

now you should reboot to make sure you all good and the service restarts when the system comes up also you should be able to run this from the command line to start it.

/etc/init.d/svnserve start

Alternatively you can add

/etc/init.d/svnserve sto
/etc/init.d/svnserve restart

Ubuntu SVN Server

February 12th, 2009 Arthur Gressick No comments

I use Subversion/SVN all the time to keep track of the project as we build them. Here are some notes on how to make your own SVN server so that you can do the same.

First you might want to check and see if the SVN software has been installed using the command

which svn

If it comes back with a path then it has been correctly installed if not then run this command to install the latest version

sudo apt-get install subversion

Now that the software has been we need to create the service in the init.d folder

cd /etc/init.d/

Add the subversion SYSTEM user to the machine

useradd --system subversion

Add the repositories folder to the system. Some people say make a folder in the home directory, I like to put it into the /var directory

mkdir /var/repositories

Now we need to create the service file

nano svnserve

Paste the below text into the editor and then save it.

#!/bin/sh -e
#
# svnserve - brings up the svn server so anonymous users
# can access svn
#
 
# Get LSB functions
. /lib/lsb/init-functions
. /etc/default/rcS
 
SVNSERVE=/usr/bin/svnserve
SVN_USER=subversion
SVN_GROUP=subversion
#SVN_REPO_PATH=/home/$SVN_USER/
SVN_REPO_PATH=/var/repositories/
 
# Check that the package is still installed
[ -x $SVNSERVE ] || exit 0;
 
case "$1" in
    start)
        log_begin_msg "Starting svnserve..."
        umask 002
        if start-stop-daemon --start \
        --chuid $SVN_USER:$SVN_GROUP \
        --exec $SVNSERVE \
        -- -d -r $SVN_REPO_PATH; then
            log_end_msg 0
        else
            log_end_msg $?
        fi
    ;;
 
    stop)
        log_begin_msg "Stopping svnserve..."
        if start-stop-daemon --stop --exec $SVNSERVE; then
        log_end_msg 0
        else
        log_end_msg $?
        fi
    ;;
 
    restart|force-reload)
        "$0" stop && "$0" start
    ;;
 
    *)
    e    cho "Usage: /etc/init.d/svnserve {start|stop|restart|force-reload}"
        exit 1
    ;;
esac
 
exit 0

Now set the permissions on the file you just created.

sudo chmod +x svnserve

Now you can try and start the service

sudo /etc/init.d/svnserve start

Make it start when rebooting

update-rc.d svnserve defaults

Categories: Ubuntu 8.x Server Tags: ,