Archive for February, 2007

usb unmount script for sun rays

Monday, February 26th, 2007

as promised here comes part two of the usb scripts for sun ray ultrathin-clients. this is yet simpler but fancier than the mount script because it uses zenity to display the result of the unmounting operation.

CODE:
  1. #!/bin/bash
  2. ###################################################################################
  3. # Sun Ray USB UnMount Script - /opt/SUNWut/bin/utusbumount.sh                     #
  4. # Copyright 2007 Christian Stottmeister - http://www.stottmeister.com             #
  5. #                                                                                 #
  6. # This program is free software; you can redistribute it and/or modify            #
  7. # it under the terms of the GNU General Public License as published by            #
  8. # the Free Software Foundation; either version 2 of the License, or               #
  9. # (at your option) any later version.                                             #
  10. #                                                                                 #
  11. # This program is distributed in the hope that it will be useful,                 #
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of                  #
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                   #
  14. # GNU General Public License for more details.                                    #
  15. #                                                                                 #
  16. # You should have received a copy of the GNU General Public License               #
  17. # along with this program; if not, write to the Free Software                     #
  18. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA  #
  19. #                                                                                 #
  20. # See http://www.fsf.org/licensing/licenses/gpl.txs for the full license text.    #
  21. #                                                                                 #
  22. ###################################################################################
  23.  
  24. # RECOGNIZE CONNECTED USB DEVICES OF THE CURRENT USER
  25. usbdevices=`/opt/SUNWut/bin/utdiskadm -l`
  26.  
  27. # COUNT CONNECTED USB DEVICES OF THE CURRENT USER
  28. # count the lines of `utdiskadm -l` output
  29. usbdevicescount=`echo "$usbdevices" | wc -l`
  30. # substract 2 lines because they are only headings
  31. usbdevicescount=$(($usbdevicescount-2))
  32.  
  33. # RECOGNIZE DISK AND MOUNT PATH OF THE USB DEVICE
  34. usbdisk=`echo "$usbdevices" | grep "disk"`
  35. usbdisk=`echo "$usbdisk" | cut -f1 -s -d' '`
  36.  
  37. # LINK THE USB DEVICE AND OPEN FILE BROWSER
  38. # link to usb device will be placed into userdir, named usbdisk*
  39. linklocation=~/usb$usbdisk
  40. # try to eject the device
  41. /opt/SUNWut/bin/utdiskadm -r $usbdisk
  42. # check exit code of utdiskadm
  43. if [ "$?" -eq "0" ]; then
  44. # check if ~/usbdisk* exists
  45. if [ -e $linklocation ]; then
  46. # remove the link to /tmp/SUNWut/mnt/ *
  47. rm $linklocation
  48. fi
  49. if [ -e /usr/bin/zenity ]; then
  50. /usr/bin/zenity --info --title="USB UnMounting succeeded" --text="You can physically unmount the USB device now."
  51. fi
  52. exit 0
  53. else
  54. if [ -e /usr/bin/zenity ]; then
  55. /usr/bin/zenity --error --title="USB UnMounting failed" --text="Something went wrong while unmounting $usbdisk."
  56. else
  57. echo ERROR. USB UnMounting of $usbdisk failed!
  58. fi
  59. exit 1
  60. fi

so this is what you should get after executing the script:

Sun Ray USB Umount Dialog

of course there is an appropriate dialog if something fails.

by the way i have recognized that the scripts do work only if executed in a terminal. to make sure that it is run in a terminal use the checkbox in the starters' preferences dialog. to be true i don't know why this is necessary.

please let me know if you find some errors while using this script. i'ld love to know if it helps you in your sun ray environment. leaving a comment would be nice. thanks!

microsoft office opendocument plugin available

Monday, February 19th, 2007

by the way, the odf plugin for ms office i referred to a few days ago is available for download. quoting the mentioned site:

The StarOffice 8 Conversion Technology Preview, a plug-in for Microsoft Word 2003 that allows users of Microsoft Word 2003 to read, edit and save import to the OpenDocument Format (ODF) is now available.

[..]
This initial plug-in application will support the conversion of text documents (.doc/.odt) only and full support of spreadsheet and presentation documents will be available in the final version, expected in April. The converter is easy to setup and use, the conversion happens transparently and the additional memory footprint is minimal. Microsoft Word users now can have seamless two-way conversion of Microsoft Word's documents to and from ODF.

download the plugin for free and smash the office monopoly! (hey, that rhimes) ;)

usb mount script for sun rays

Monday, February 12th, 2007

as you all know the sun ray ultrathin-clients support several types of devices connected to them, including serial and parallel devices, usb mass storage, pdas and so on. for a full list see the sun ray admin guide, chapter four. now when a usb mass storage device gets plugged in, the sun ray services mount it to /tmp/SUNWut/mnt/[username]/disk[integer]/. the user then needs to traverse the file system to get into the named directory which is applicable but quite a strange behavior for people who got used to windows (plug in usb-stick and it gets mounted as a lokal partition, then the user gets notified of it). because of this i have thought of a possibility to decrease user concerns and increase their positive experiences. yesterday i did a quick hack to check for mounted usb devices, link them to the users home directory and open a file browser to display the linked directory.

CODE:
  1. #!/bin/bash
  2. ###################################################################################
  3. # Sun Ray USB Mount Script - /opt/SUNWut/bin/utusbmount.sh                        #
  4. # Copyright 2007 Christian Stottmeister - http://www.stottmeister.com             #
  5. #                                                                                 #
  6. # This program is free software; you can redistribute it and/or modify            #
  7. # it under the terms of the GNU General Public License as published by            #
  8. # the Free Software Foundation; either version 2 of the License, or               #
  9. # (at your option) any later version.                                             #
  10. #                                                                                 #
  11. # This program is distributed in the hope that it will be useful,                 #
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of                  #
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                   #
  14. # GNU General Public License for more details.                                    #
  15. #                                                                                 #
  16. # You should have received a copy of the GNU General Public License               #
  17. # along with this program; if not, write to the Free Software                     #
  18. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA  #
  19. #                                                                                 #
  20. # See http://www.fsf.org/licensing/licenses/gpl.txs for the full license text.    #
  21. #                                                                                 #
  22. ###################################################################################
  23.  
  24. # RECOGNIZE CONNECTED USB DEVICES OF THE CURRENT USER
  25. usbdevices=`/opt/SUNWut/bin/utdiskadm -l`
  26.  
  27. # COUNT CONNECTED USB DEVICES OF THE CURRENT USER
  28. # count the lines of `utdiskadm -l` output
  29. usbdevicescount=`echo "$usbdevices" | wc -l`
  30. # substract 2 lines because they are only headings
  31. usbdevicescount=$(($usbdevicescount-2))
  32.  
  33. # RECOGNIZE DISK AND MOUNT PATH OF THE USB DEVICE
  34. usbdisk=`echo "$usbdevices" | grep "disk"`
  35. usbdisk=`echo "$usbdisk" | cut -f1 -s -d' '`
  36. usbmountpath=/tmp/SUNWut/mnt/`/usr/xpg4/bin/id -u -n`/
  37.  
  38. # LINK THE USB DEVICE AND OPEN FILE BROWSER
  39. # check if $usbmountpath exists and is a directory
  40. if [ -e $usbmountpath -a -d $usbmountpath ]; then
  41. # $usbmountpath is a directory and therefore exists
  42. # link to usb device will be placed into userdir, named usbdisk*
  43. linklocation=~/usb$usbdisk
  44. # check if ~/usbdisk* exists
  45. if [ ! -e $linklocation ]; then
  46. ln -s $usbmountpath $linklocation
  47. fi
  48. nautilus $linklocation
  49. fi

the script has a pitfall yet, because it supports only one usb device per user. so if the user connects two or more usb mass storage devices (should happen rarely) the scripts fails. i plan to code an option the select the desired device. perhaps some of my fellow readers want to supply this so i don't have to code it? :)

btw. using this script you have to unmount devices after usage of course. i will come up with the according script later.

the machine is us/ing us - web 2.0 in 4,5 minutes

Sunday, February 11th, 2007

how do we define the web and ourselves using it? professor michael wesch of kansas state university tries to visualize the ideas and concepts of web 2.0 in a very well done video. while the message itself does not suprise me that much it is the video transcription that impresses me.

the blog of ksu's digital ethnography provides more information and collects responses to the video. and there a lot responses as we all live web 2.0. :)

odf plugin for microsoft office along the way

Wednesday, February 7th, 2007

hah, how great is that?! according to a press release sun just announced the release of an opendocument (odf) plugin for microsoft word based on staroffice or openoffice respectively in a few days. odf-plugins for all other microsoft office programs are expected to be released in april 2007.

thanks to erwin for pointing this out.


Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.0 License.