Switchtool
From Rsewiki
(Difference between revisions)
(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 ...) |
|||
Line 1: | Line 1: | ||
− | An easy way to make the smrs use | + | 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 | + | 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. | 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 | ||
− | + | if [ ! -z ${1} ]; then | |
− | if [ | + | if [ ! -d $dir_name/bin ]; then |
− | echo "Switching | + | 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 | 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