ft@0: #!/bin/sh ft@0: # This script creates the model name symlink in /var/run/usbmount. ft@0: # Copyright (C) 2005 Martin Dickopp ft@0: # ft@0: # This file is free software; the copyright holder gives unlimited ft@0: # permission to copy and/or distribute it, with or without ft@0: # modifications, as long as this notice is preserved. ft@0: # ft@0: # This file is distributed in the hope that it will be useful, ft@0: # but WITHOUT ANY WARRANTY, to the extent permitted by law; without ft@0: # even the implied warranty of MERCHANTABILITY or FITNESS FOR A ft@0: # PARTICULAR PURPOSE. ft@0: # ft@0: set -e ft@0: ft@0: # Replace spaces with underscores, remove special characters in vendor ft@0: # and model name. ft@0: UM_VENDOR=`echo "$UM_VENDOR" | sed 's/ /_/g; s/[^0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ._-]//g'` ft@0: UM_MODEL=`echo "$UM_MODEL" | sed 's/ /_/g; s/[^0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ._-]//g'` ft@0: ft@0: # Exit if both vendor and model name are empty. ft@0: test -n "$UM_VENDOR" || test -n "$UM_MODEL" || exit 0 ft@0: ft@0: # Build symlink name. ft@0: if test -n "$UM_VENDOR" && test -n "$UM_MODEL"; then ft@0: name="${UM_VENDOR}_$UM_MODEL" ft@0: else ft@0: name="$UM_VENDOR$UM_MODEL" ft@0: fi ft@0: ft@0: # Append partition number, if any, to the symlink name. ft@0: partition=`echo "$UM_DEVICE" | sed 's/^.*[^0123456789]\([0123456789]*\)/\1/'` ft@0: if test -n "$partition"; then ft@0: name="${name}_$partition" ft@0: fi ft@0: ft@0: mkdir -p "/var/run/usbmount/$name" ft@0: osecfs /etc/osecfs/osecfs_usb.cfg /var/run/usbmount/$name ro ft@0: ft@0: ft@0: exit 0