2024-03-16 22:46:35 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
declare MOUNTBASEDIR=""
|
|
|
|
declare MOUNTDIR=""
|
|
|
|
|
|
|
|
showHelp() {
|
|
|
|
echo "${0}"
|
|
|
|
echo ""
|
|
|
|
echo "usage :"
|
|
|
|
echo "${0} [options] dirname"
|
|
|
|
echo "options :"
|
|
|
|
echo " -d|--mountbase ~/Remotes"
|
|
|
|
}
|
|
|
|
|
|
|
|
main() {
|
|
|
|
if [ -d "${MOUNTDIR}" ]; then
|
|
|
|
if fusermount -z -u "${MOUNTDIR}"; then
|
|
|
|
rm -r "${MOUNTDIR}"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
MOUNTBASEDIR=$(realpath ~/Remotes)
|
|
|
|
while [ ${#} -gt 0 ]; do
|
|
|
|
case ${1} in
|
|
|
|
--help) showHelp; exit 0;;
|
|
|
|
-d | --mountbase) MOUNTBASEDIR=$(realpath "${2}"); shift; shift;;
|
2024-03-16 22:59:43 +00:00
|
|
|
*) shift;;
|
2024-03-16 22:46:35 +00:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
MOUNTDIR="${MOUNTBASEDIR}/${2}";
|
|
|
|
|
|
|
|
main
|