--- lbus_event_handler.sh.original 2006-04-08 15:35:05.000000000 -0600 +++ lbus_event_handler.sh 2006-04-11 09:55:21.000000000 -0600 @@ -40,6 +40,12 @@ DRIVEDIR=${DRIVE_DIR:-Drives} ICON=${FOLDER_ICON:-gnome-fs-directory.svg} +BASEDIR=/mnt/localdev/$USER +#BASEDIR=${HOME}/${DRIVEDIR} + +LINKDIR=${HOME}/${DRIVEDIR} # for use with BASEDIR=/mnt/localdev/$USER +#LINK= # for use with BASEDIR=${HOME}/${DRIVEDIR} + function create_icon { SHARENAME=$2 cat <<-EOF >${HOME}/Desktop/${SHARENAME}.desktop @@ -62,8 +68,8 @@ if [ -n "${HOME}" ]; then - if [ -d ${HOME}/${DRIVEDIR} ]; then - for drive in ${HOME}/${DRIVEDIR}/*; do + if [ -d $BASEDIR ]; then + for drive in $BASEDIR/*; do if [ -d ${drive} ]; then rmdir ${drive} fi @@ -72,7 +78,7 @@ if [ -d ${HOME}/Desktop ]; then for desktop in ${HOME}/Desktop/*.desktop; do - if [ -f ${desktop} ]; then + if [ -f ${desktop} ]; then # FIXME: this doesn't handle spaces well if grep -q lbus_event_handler ${desktop}; then rm -f ${desktop} fi @@ -85,8 +91,16 @@ WS=${DISPLAY/:*/} -if [ ! -d ${HOME}/${DRIVEDIR} ]; then - mkdir ${HOME}/${DRIVEDIR} +if [ ! -d $BASEDIR ]; then + mkdir -p $BASEDIR +fi + +if [ "$LINKDIR" != "" ]; then + if [ ! -d "$LINKDIR" ]; then + mkdir -p "$LINKDIR" + rm -f "$LINKDIR" + ln -s "$BASEDIR" "$LINKDIR" + fi fi case "${ACTION}" in @@ -96,12 +110,13 @@ SIZE=$4 DESC=$5 case "${DEVTYPE}" in - block) mkdir "${HOME}/${DRIVEDIR}/${SHARENAME}" + block) + mkdir "${BASEDIR}/${SHARENAME}" /usr/sbin/ltspfs ${WS}:/tmp/drives/${SHARENAME} \ - "${HOME}/${DRIVEDIR}/${SHARENAME}" + "${BASEDIR}/${SHARENAME}" if [ -d ${HOME}/Desktop ]; then create_icon "${DESC}" "${SHARENAME}" \ - "${HOME}/${DRIVEDIR}/${SHARENAME}" + "${BASEDIR}/${SHARENAME}" fi ;; esac @@ -113,8 +128,8 @@ SIZE=$4 DESC=$5 case "${DEVTYPE}" in - block) fusermount -u -z "${HOME}/${DRIVEDIR}/${SHARENAME}" - rmdir "${HOME}/${DRIVEDIR}/${SHARENAME}" + block) fusermount -u -z "${BASEDIR}/${SHARENAME}" + rmdir "${BASEDIR}/${SHARENAME}" if [ -d ${HOME}/Desktop ]; then rm -f "${HOME}/Desktop/${SHARENAME}.desktop" fi