I found a solution which works for me....

 

This workaround creates mounting scripts which sets the mount point for
usb drives to /usr/media/usbdisk and /usr/media/usbdisk-1 ignoring the
volume label.

 

Step 1: Change the Citrix application to allow volume manger but not to
automount (automount in the /media/ folder with the volume label of the
usb drive) and point local path for Mapping 1 and 2 to
/usr/media/usbdisk and /usr/media/usbdisk-1

 

Step 2: Next drop a sh script and tar file (details below) into
/opt/openthinclient/server/default/data/nfs/root/custom/ (This is the
default folder which might be different on a windows machine)

 

Step 3: reboot client

 

The sh script (I named USBMountScript.sh but it could be anything)  

 

#!!/bin/sh

# Reload udev rules after unpacking of tar file

Udevadm control -reload-rule

/etc/init.d/udev reload

# set execute for the udev scripts which will do the mounting

Chmod 744 /usr/local/sbin/udev-auto*

 

The tar file name UDEV-USB.tar contains

 

rw-r-r                 /etc/udev/rules.d/75-USBDrives.rules

rwx-rx-rx            /usr/local/sbin/udev-auto-unmount.sh

rwx-rw-rx           /usr/local/sbin/udev-automounter-run.sh

rwx-rw-rx           /usr/local/sbin/udev-automounter.sh

rwx-rw-rx           /usr/local/sbin/udev-autounmounter.sh

rx-r-r                 /usr/media/usbdisk/Do_Not_Save_Here.txt

rx-r-r                 /usr/media/usbdisk-1/Do_Not_Save_Here.txt

 

the two files "Do_Not_Save_Here.txt" are place holders for the Citrix
receiver when the receiver starts it can connect to those folders and
display those files but once a USB disk is inserted UDev mounts it and
obscures those files with the file system of the USB pen drive. Below
are the scripts which make that happen.

 

--------------------/etc/udev/rules.d/75-USBDrives.rules

 

# /etc/udev/rules.d/local.rules

# /etc/udev/rules.d/75-USBDrives.rules

# Add Rule for usb

ENV{ID_FS_LABEL_ENC}=="?*",           ACTION=="add",
SUBSYSTEMS=="usb", RUN+="/usr/local/sbin/udev-automounter.sh %k"

ENV{ID_FS_LABEL_ENC}=="?*",           ACTION=="remove",
SUBSYSTEMS=="usb", RUN+="/usr/local/sbin/udev-autounmounter.sh %k"

 

--------------------/usr/local/sbin/udev-automounter.sh

 

#!/bin/sh

sh /usr/local/sbin/udev-automounter-run.sh $1 &

 

--------------------/usr/local/sbin/udev-automounter-run.sh

 

#!/bin/sh

sleep 6

DEVICE=$1

#check is not already mounted

DEVICEMOUNTED=`grep ${DEVICE} /etc/mtab`

if [ -n "$DEVICEMOUNTED" ]

then

            echo "Already Mounted!"

            exit 1

fi

if [ -f /usr/media/usbdisk/Do_Not_Save_Here.txt ]

then

            mount -t vfat -o sync,noatime,uid=1000 /dev/$DEVICE
/usr/media/usbdisk

            exit 0

elif [ -f /usr/media/usbdisk-1/Do_Not_Save_Here.txt ]

then

            mount -t vfat -o sync,noatime,uid=1000 /dev/$DEVICE
/usr/media/usbdisk-1

            exit 0

fi

 

--------------------/usr/local/sbin/udev-autounmounter.sh

 

#!/bin/sh

#

# USAGE: usb-autounmounter.sh DEVICE 

#   DEVICE   is the actual device node at /dev/DEVICE

 

--------------------/usr/local/sbin/udev-auto-unmount.sh ${1} &

 

#!/bin/sh

#

# USAGE: udev-auto-unmount.sh DEVICE

#   DEVICE   is the actual device node at /dev/DEVICE

# 

# This script takes a device name, looks up the partition label and

# type, creates /media/LABEL and mounts the partition.  Mount options

# are hard-coded below.

 

DEVICE=$1

 

# check input

if [ -z "$DEVICE" ]; then

   exit 1

fi

 

#test that the device is already mounted

MOUNTPT=`mount | grep ${DEVICE} | cut -d ' ' -f 3`

if [ -n "$device_is_mounted" ]; then

   echo "error: the device is not already mounted"

   exit 1

fi

 

# test mountpoint - it should exist

if [ -e "${MOUNTPT}" ]; then

 

   # very naive; just run and pray

   umount -l "${MOUNTPT}" && exit 0

 

   echo "error: ${MOUNTPT} failed to unmount."

   exit 1

fi

 

echo "error: ${MOUNTPT} does not exist"

exit 1

 

-Daren Stevens

 

Barrow-in-Furness Sixth Form College

------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
The Open Source Thin Client Solution http://openthinclient.org
[email protected]
https://lists.sourceforge.net/lists/listinfo/openthinclient-user

Reply via email to