Switchtool: Difference between revisions

From Rsewiki
No edit summary
No edit summary
Line 1: Line 1:
An easy way to make the smrs use another branch of mobotware is to run 'switchtool'.
An easy way to make the smrs use another branch of mobotware is to run 'switchtool'.
Current braches are found in the /opt/smr.* folders.
Current braches are found in the /opt/smr.* folders on nyquist and jensen.


To shift branch: Login as root on the smr and run:
To shift branch: Login as root on the smr and run:

Revision as of 12:27, 5 April 2011

An easy way to make the smrs use another branch of mobotware is to run 'switchtool'. Current braches are found in the /opt/smr.* folders on nyquist and jensen.

To shift branch: Login as root on the smr and run:

root@smr3:~# switchtool <name>

For example if your would like to use the versions in /opt/smr.2011 run:

root@smr3:~# switchtool 2011

Remember that the original setup is restored on reboot. This means /opt/smr is linked to /usr/local/smr.

The switchtool is listed below and is residing in the /usr/sbin folder.

#!/bin/bash

dir_name="/misc/opt/smr.${1}"

if [ ! -d /usr/local/smr.net/bin ]; then
	echo "Switching impossible. Kalman /opt not found."
	exit 1
fi

if [ ! -z ${1} ]; then
	if [ ! -d $dir_name/bin ]; then
		echo "Switching impossible. Path: ${dir_name} not found."
		exit 2
	fi
fi

if [ ! -x /etc/rc.smr/rc.smr_shutdown ]; then
	echo "Warning: Smr startup scripts not found. Is this a robot ?"
else
	/etc/rc.smr/rc.smr_shutdown
fi

if [ -z ${1} ]; then
	echo "Switching to production mode"
	rm -f /usr/local/smr
	ln -sf /usr/local/smr.net /usr/local/smr
else
	echo "Switching to ${1} mode"
	rm -f /usr/local/smr
	ln -sf $dir_name /usr/local/smr
fi

if [ -x /etc/rc.smr/rc.smr ]; then
	/etc/rc.smr/rc.smr
fi

sleep 2
echo "done"

exit 0