#!/bin/sh DIR=/mnt/mmc my_umount() { echo "*****my_umount" if grep -qs "^/dev/$1 " /proc/mounts ; then umount -f "${DIR}/$1"; fi [ -d "${DIR}/$1" ] && rmdir "${DIR}/$1" } my_mount() { echo "*****my_mount" mkdir -p "${DIR}/$1" || exit 1 if ! mount -t auto -o sync "/dev/$1" "${DIR}/$1"; then # failed to mount, clean up mountpoint rmdir "${DIR}/$1" exit 1 fi if grep -qs vfat /proc/mounts ; then umount "${DIR}/$1"; mount -t vfat -o sync,iocharset=iso8859-1,shortname=mixed,utf8 "/dev/$1" "${DIR}/$1"; fi } case "${ACTION}" in add|"") my_umount ${MDEV} my_mount ${MDEV} dbus-send --system --dest=com.rexroth.akku.SysService /SysObj com.rexroth.akku.SysInterface.fcfgfilechanged string:mmcmount ;; remove) dbus-send --system --dest=com.rexroth.akku.SysService /SysObj com.rexroth.akku.SysInterface.fcfgfilechanged string:mmcmount sleep 2 my_umount ${MDEV} ;; esac