-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmount-b2drop
35 lines (26 loc) · 931 Bytes
/
mount-b2drop
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh
export B2DROP_APP_USER=$(sed -n '1 p' /home/jovyan/work/conf/env)
export B2DROP_APP_PASSWORD=$(sed -n '2 p' /home/jovyan/work/conf/env)
export WEBDAV_URL='https://b2drop.eudat.eu/remote.php/webdav/'
# print ENV variables
echo "User is $B2DROP_APP_USER"
echo "URL is $WEBDAV_URL"
if [ -z "${B2DROP_USER}" ];
then
echo "B2DROP_USER is unset or set to the empty string"
fi
if [ -z "${B2DROP_APP_PASSWORD}" ];
then
echo "B2DROP_APP_PASSWORD is unset or set to the empty string"
fi
if [ ! -z "${B2DROP_APP_USER}" -a ! -z "${B2DROP_APP_PASSWORD}" ];
then
# Create entry in secrets file
echo "$WEBDAV_URL $B2DROP_APP_USER $B2DROP_APP_PASSWORD" | sudo tee -a /etc/davfs2/secrets
# make dir for mount
mkdir -p ~/work/b2drop-private
# mount b2drop to dir
sudo mount.davfs $WEBDAV_URL ~/work/b2drop-private
# Add write access to jovyan
sudo chown -R jovyan ~/work/b2drop-private/
fi