-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmountacd.sh
90 lines (79 loc) · 1.75 KB
/
mountacd.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/bin/bash
source my.conf
function mountACD(){
local RESULT=0
local DIRECTORY="$acd_mount"/z5RcIiqyW-DPa2MR-1L3z4tC
if [ -d "$DIRECTORY" ]; then
RESULT=1
else
acd_cli clear-cache &>/dev/null
acd_cli sync &>/dev/null
acd_cli mount --modules="subdir,subdir=$amazon_subdirectory" "$acd_mount" &>/dev/null
DIRECTORY2="$acd_mount"/z5RcIiqyW-DPa2MR-1L3z4tC
if [ -d "$DIRECTORY2" ]; then
RESULT=1
fi
fi
echo $RESULT
}
function encACD(){
local RESULT=0
local DIRECTORY="$acd_decrypted"/Movies
if [ -d "$DIRECTORY" ]; then
RESULT=1
else
echo "$encfs_pass" | encfs -S "$acd_mount" "$acd_decrypted" &>/dev/null
DIRECTORY="$acd_decrypted"/Movies
if [ -d "$DIRECTORY" ]; then
RESULT=1
fi
fi
echo $RESULT
}
function encTRANS(){
local RESULT=0
local DIRECTORY="$transfer_decrypted"/Movies
if [ -d "$DIRECTORY" ]; then
RESULT=1
else
echo "$encfs_pass" | encfs -S "$transfer_encrypted" "$transfer_decrypted" &>/dev/null
DIRECTORY="$transfer_decrypted"/Movies
if [ -d "$DIRECTORY" ]; then
RESULT=1
fi
fi
echo $RESULT
}
function repairACD(){
fusermount -uz "$acd_decrypted" &>/dev/null
fusermount -uz "$acd_mount" &>/dev/null
fusermount -uz "$transfer_decrypted" &>/dev/null
rm "$acd_mount"/.encfs6.xml &>/dev/null
rm ~/.cache/acd_cli/nodes.db &>/dev/null
acd_cli clear-cache &>/dev/null
acd_cli sync &>/dev/null
}
echo "Mounting drives"
ACD=$(mountACD)
ENC=''
if [ $ACD -eq 0 ]; then
echo "ACD failed to mount. Repairing now."
repairACD
echo "2nd attempt to mount acd"
ACD=$(mountACD)
fi
if [ $ACD -eq 1 ]; then
ENC=$(encACD)
else
echo "unable to mount ACD"
exit 1
fi
if [ $ENC -eq 0 ]; then
echo "ENC failed to mount"
exit 1
fi
TRANS=$(encTRANS)
if [ $TRANS -eq 0 ]; then
echo "Failed to mount transfer"
fi
exit 0