Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- service=$1
- userdir=/home/ichbins
- [ -z $service ] && {
- notify-send -u low -i error "Service parameter is missing" "Please, specify a service name"
- exit 1
- }
- isdavmounted=$(mount | grep $service | grep davfs)
- isencmounted=$(mount | grep $service | grep encfs)
- if [ -n "$isencmounted" -o -n "$isdavmounted" ]; then
- #unmount
- [ -n "$isencmounted" ] && {
- fusermount -u "${userdir}/${service}.crypt" && msg="Encfs,"
- }
- [ -n "$isdavmounted" ] && {
- umount "${userdir}/${service}" && msg="${msg}Davfs "
- }
- if [ -n "$msg" ]; then
- notify-send -u low -i info "$service unmounting" "$msg unmouned successfuly!"
- else
- notify-send -u low -i error "$service unmounting" "Failed to unmount $service!"
- fi
- else
- #mount
- mount ${userdir}/${service} && {
- msg="Davfs,"
- encfs --extpass="cat ~/.encfs/$service" ${userdir}/${service}/crypt ${userdir}/${service}.crypt/ && {
- msg="${msg}Encfs "
- }
- }
- if [ -n "$msg" ]; then
- notify-send -u low -i info "$service mounting" "$msg mounted successfuly!"
- else
- notify-send -u low -i error "$service mounting" "Failed to mount $service!"
- fi
- fi
Advertisement
Add Comment
Please, Sign In to add comment