forked from FreakyBytes/nextcloud-client-docker
-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathtest_exit.sh
executable file
·69 lines (58 loc) · 1.44 KB
/
test_exit.sh
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
command -v dialog >/dev/null 2>&1 || { echo >&2 "I require \"dialog\" but it's not installed. Aborting."; exit 1; }
# delete folder contents
rm -rf sync-folder/
# rebuild gitattributes file
echo "">sync-folder/.gitattributes
password=$(tempfile 2>/dev/null)
username=$(tempfile 2>/dev/null)
nextcloudserver=$(tempfile 2>/dev/null)
dialog --title "Next Cloud Client test" \
--inputbox "Enter your server url " 10 60 2>$nextcloudserver
ret=$?
case $ret in
0)
nextcloudserver=$(<$nextcloudserver);;
1)
echo "Cancel pressed."
exit;;
255)
[ -s $password ] && cat $password || echo "ESC pressed."
exit;;
esac
dialog --title "Next Cloud Client test" \
--inputbox "Enter your username " 10 30 2>$username
ret=$?
case $ret in
0)
username=$(<$username);;
1)
echo "Cancel pressed."
exit;;
255)
[ -s $password ] && cat $password || echo "ESC pressed."
exit;;
esac
# get password with the --insecure option
dialog --title "Password" \
--clear \
--insecure \
--passwordbox "Enter your password" 10 30 2> $password
ret=$?
# make decison
case $ret in
0)
password=$(<$password);;
1)
echo "Cancel pressed.";;
255)
[ -s $password ] && cat $password || echo "ESC pressed."
exit;;
esac
docker run -it --rm \
-v $(pwd)/sync-folder:/media/nextcloud \
-e NC_USER=$username -e NC_PASS=$password \
-e NC_URL=$nextcloudserver\
-e NC_EXIT=true\
-e NC_SILENT=true\
juanitomint/nextcloud-client