extra-scripts/mount-nextcloud
2021-11-28 18:29:51 +01:00

29 lines
804 B
Bash
Executable File

#!/bin/bash
user=ExampleUser
server=cloud.example.com
account=$user@$server
uri=davs://$account/remote.php/webdav
uri_esc=$(echo $uri | sed s/\\//\\\\\\//g)
online=$(gio mount -l | sed "/^Mount/! d;/$uri_esc/! d" | wc -l)
echo $online
if [ $online -gt 0 ]; then
exit
fi
case $XDG_SESSION_TYPE in
tty)
gio mount $uri </dev/null && exit
echo not cached
systemd-ask-password Nextcloud password | gio mount $uri;;
x11)
gio mount $uri </dev/null && exit
echo not cached
cat <<-bye | pinentry-gnome3 | sed "/^D/! d;s/^D //" | gio mount $uri
setprompt Nextcloud password
setdesc $account
getpin
bye
;;
esac
ln -s gvfs/dav:host=$server,ssl=true,user=$user,prefix=%2Fremote.php%2Fwebdav /run/user/1000/nextcloud