Switchtool: Difference between revisions

From Rsewiki
(New page: An easy way to make the smrs use the development branch of mobotware. Login as root on the smr and run: root@smr3:~# switchtool devel This changes to the development branch. This links ...)
 
No edit summary
Line 1: Line 1:
An easy way to make the smrs use the development branch of mobotware.
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.


Login as root on the smr and run:
To shift branch: Login as root on the smr and run:
  root@smr3:~# switchtool devel
  root@smr3:~# switchtool <name>
 
For example if your would like to use the versions in /opt/smr.2011 run:
root@smr3:~# switchtool 2011


This changes to the development branch. This links the /opt/smr.development folder to /usr/local/smr on the robot.
Remember that the original setup is restored on reboot. This means /opt/smr is linked to /usr/local/smr.
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.
The switchtool is listed below and is residing in the /usr/sbin folder.
  #!/bin/bash
  #!/bin/bash
dir_name="/misc/opt/smr.${1}"
   
   
  if [ ! -d /usr/local/smr.net/bin ]; then
  if [ ! -d /usr/local/smr.net/bin ]; then
Line 15: Line 20:
  fi
  fi
   
   
/etc/rc.smr/rc.smr_shutdown
  if [ ! -z ${1} ]; then
  if [ "${1}" == "devel" ]; then
  if [ ! -d $dir_name/bin ]; then
  echo "Switching to development mode"
echo "Switching impossible. Path: ${dir_name} not found."
  rm -f /usr/local/smr
exit 2
  ln -sf /misc/opt/smr.development /usr/local/smr
  fi
fi
if [ ! -x /etc/rc.smr/rc.smr_shutdown ]; then
  echo "Warning: Smr startup scripts not found. Is this a robot ?"
  else
  else
/etc/rc.smr/rc.smr_shutdown
fi
if [ -z ${1} ]; then
  echo "Switching to production mode"
  echo "Switching to production mode"
  rm -f /usr/local/smr
  rm -f /usr/local/smr
  ln -sf /usr/local/smr.net /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
  fi
   
   
  /etc/rc.smr/rc.smr
  if [ -x /etc/rc.smr/rc.smr ]; then
/etc/rc.smr/rc.smr
fi
   
   
  sleep 2
  sleep 2

Revision as of 19:29, 6 March 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.

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