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 ...)
 
 
(5 intermediate revisions by 2 users not shown)
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 on nyquist and jensen.


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>


This changes to the development branch. This links the /opt/smr.development folder to /usr/local/smr on the robot.
For example if your would like to use the versions in /opt/smr.2011c run:
Remember that the original setup is restored on reboot. This means /opt/smr is linked to /usr/local/smr.
root@smr3:~# switchtool 2011c


The switchtool is listed below and is residing in the /usr/sbin folder.
Remember that the original setup is restored on reboot. This means /misc/opt/smr is linked to /usr/local/smr.
 
===To use local files===
 
The switchtoo knows a local option, this moves the /usr/local/smr to the local flash:
 
root@smr3:~# switchtool local
 
The local flash is updated using a script in /root.
To update the local version to a specific configuration run first the switchtool for that configuration, then the update_smr, and then switch to local
 
root@smr3:~# switchtool 2011c
root@smr3:~# ./update_smr
root@smr3:~# switchtool local
 
===The switchtool script===
 
The switchtool uses the /etc/rc.smr/rc.smr script to restart configure and restart (rhd)
 
The switchtool is listed below and is residing in the /usr/sbin folder on the smrs.
  #!/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 37:
  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

Latest revision as of 17:45, 2 November 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.2011c run:

root@smr3:~# switchtool 2011c

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

To use local files

The switchtoo knows a local option, this moves the /usr/local/smr to the local flash:

root@smr3:~# switchtool local

The local flash is updated using a script in /root. To update the local version to a specific configuration run first the switchtool for that configuration, then the update_smr, and then switch to local

root@smr3:~# switchtool 2011c
root@smr3:~# ./update_smr
root@smr3:~# switchtool local

The switchtool script

The switchtool uses the /etc/rc.smr/rc.smr script to restart configure and restart (rhd)

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

#!/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