Minor fixes about new BLACKLIST option.

This commit is contained in:
Slawomir Wojciech Wojtczak (vermaden) 2013-02-13 21:27:17 +01:00
parent ba210e0749
commit 7ed9202cd4
1 changed files with 14 additions and 12 deletions

View File

@ -194,21 +194,23 @@ __check_already_mounted() { # 1=(-d|-m) 2=(DEV|MNT)
esac esac
} }
if [ "${BLACKLIST}" != "" ]
then
for I in ${BLACKLIST}
do
if [ ${2} = "${I}" ]
then
exit 0
fi
done
fi
DEV=/dev/${1} DEV=/dev/${1}
case ${2} in case ${2} in
(attach) (attach)
__log "${DEV}: attach"
if [ "${BLACKLIST}" != "" ]
then
__log "${DEV}: using BLACKLIST='${BLACKLIST}'"
for I in ${BLACKLIST}
do
if [ ${1} = "${I}" ]
then
__log "${DEV}: device blocked by BLACKLIST"
exit 0
fi
done
fi
ADD=0 ADD=0
MNT="${MNTPREFIX}/${1}" MNT="${MNTPREFIX}/${1}"
__check_already_mounted -d ${DEV} __check_already_mounted -d ${DEV}
@ -358,6 +360,7 @@ case ${2} in
;; ;;
(detach) (detach)
__log "${DEV}: detach"
grep -E "${MNTPREFIX}/${1}$" ${STATE} \ grep -E "${MNTPREFIX}/${1}$" ${STATE} \
| while read DEV PROVIDER MNT | while read DEV PROVIDER MNT
do do
@ -375,7 +378,6 @@ case ${2} in
unset TARGET unset TARGET
__log "${DEV}: umount" __log "${DEV}: umount"
done done
__log "${DEV}: detach"
__remove_dir "${MNTPREFIX}/${1}" __remove_dir "${MNTPREFIX}/${1}"
__log "${DEV}: mount point '${MNTPREFIX}/${1}' removed" __log "${DEV}: mount point '${MNTPREFIX}/${1}' removed"
;; ;;