#!/bin/sh
# usbmount mount.d script to create partition label symlink in
# /var/run/usbmount/by-label/<label> pointing to respective mounth path
#
# Copyright (C) 2008 Heikki Hokkanen <hoxu@users.sf.net>
#
# License: BSD-2
#   This package is free software; the copyright holder gives unlimited
#   permission to copy and/or distribute it, with or without
#   modifications, as long as this notice is preserved.
# 
#   This package is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY, to the extent permitted by law; without
#   even the implied warranty of MERCHANTABILITY or FITNESS FOR A
#   PARTICULAR PURPOSE.
#
set -e

linkdir="/var/run/usbmount/by-label"

for i in "$linkdir"/*; do
	link=`readlink "$i"`
	if [ "$link" == "$UM_MOUNTPOINT" ]; then
		rm -f "$i"
		break
	fi
done

