2 # This script creates the model name symlink in /var/run/usbmount.
3 # Copyright (C) 2005 Martin Dickopp
5 # This file is free software; the copyright holder gives unlimited
6 # permission to copy and/or distribute it, with or without
7 # modifications, as long as this notice is preserved.
9 # This file is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
16 # Replace spaces with underscores, remove special characters in vendor
18 UM_VENDOR=`echo "$UM_VENDOR" | sed 's/ /_/g; s/[^0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ._-]//g'`
19 UM_MODEL=`echo "$UM_MODEL" | sed 's/ /_/g; s/[^0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ._-]//g'`
21 # Exit if both vendor and model name are empty.
22 test -n "$UM_VENDOR" || test -n "$UM_MODEL" || exit 0
25 if test -n "$UM_VENDOR" && test -n "$UM_MODEL"; then
26 name="${UM_VENDOR}_$UM_MODEL"
28 name="$UM_VENDOR$UM_MODEL"
31 # Append partition number, if any, to the symlink name.
32 partition=`echo "$UM_DEVICE" | sed 's/^.*[^0123456789]\([0123456789]*\)/\1/'`
33 if test -n "$partition"; then
34 name="${name}_$partition"
37 mkdir -p "/var/run/usbmount/$name"
38 osecfs /etc/osecfs/osecfs_usb.cfg /var/run/usbmount/$name ro