#!/bin/bash # Create symlink in DocumentRoot/content to autmounted usb drive # # based on a similar script in the xs-rsync package # by Martin Langhoff # # and the adaptation for xs-activity-server by Douglas Bagnall # # # by Tim Moody tim@timmoody.com source /etc/iiab/iiab.env case $IIAB_USB_LIB_SHOW_ALL in 'True'|'true'|'TRUE') logger -p user.notice -t "70-usb-library" -- "Displaying root directory on $UM_MOUNTPOINT." ;; *) logger -p user.notice -t "70-usb-library" -- "Looking for /share, /Share, /Piratebox/Share, /USB, or /usb on $UM_MOUNTPOINT." ;; esac VERBOSE=yes SHARE_DIR="" # Only show content if in these directories if [ -d $UM_MOUNTPOINT/share ]; then SHARE_DIR="$UM_MOUNTPOINT/share" fi if [ -d $UM_MOUNTPOINT/Share ]; then SHARE_DIR="$UM_MOUNTPOINT/Share" fi if [ -d $UM_MOUNTPOINT/Piratebox/Share ]; then SHARE_DIR="$UM_MOUNTPOINT/Piratebox/Share" fi if [ -d $UM_MOUNTPOINT/USB ]; then SHARE_DIR="$UM_MOUNTPOINT/USB" fi if [ -d $UM_MOUNTPOINT/usb ]; then SHARE_DIR="$UM_MOUNTPOINT/usb" fi if [ -d $UM_MOUNTPOINT ]; then SHARE_DIR="$UM_MOUNTPOINT" fi if [ ! -z "$SHARE_DIR" ]; then logger -p user.notice -t "70-usb-library" -- "Found Share Directory $SHARE_DIR." else logger -p user.notice -t "70-usb-library" -- "did not find /share, /Share, /Piratebox/Share, /USB, or /usb on USB" fi if [ "$SHARE_DIR" != "" ];then CONTENT_LINK_USB=`basename $UM_MOUNTPOINT | awk '{print toupper($0)}'` CONTENT_LINK="{{ doc_root }}/local_content/$CONTENT_LINK_USB" logger -p user.notice -t "70-usb-library" -- "Creating link to $CONTENT_LINK." ln -s $SHARE_DIR $CONTENT_LINK fi