-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathstartCloudTorrent.sh
More file actions
executable file
·34 lines (25 loc) · 959 Bytes
/
Copy pathstartCloudTorrent.sh
File metadata and controls
executable file
·34 lines (25 loc) · 959 Bytes
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
#!/bin/bash
CLOUD_TORRENT_BINARY="cloud-torrent"
if [ ! -f "${CLOUD_TORRENT_BINARY}" ]; then
echo "Error ${CLOUD_TORRENT_BINARY} is not present in current directory"
exit 1
fi
PORT_OPT=""
AUTHENTICATION_OPT=""
if [ ! -z "$PORT" ]; then
PORT_OPT="--port $PORT"
fi
if [ ! -z "$AUTHENTICATED" ] && [ "$AUTHENTICATED" == "yes" ]; then
echo "Authentication is set. Checking for username and password set in environment...";
if [ -z "$AUTH_USERNAME" ] || [ -z "$AUTH_PASSWORD" ]; then
echo "Either username (or) password is not set in environment. Skipping authentication configuration..."
else
AUTHENTICATION_OPT="--auth \"${AUTH_USERNAME}:${AUTH_PASSWORD}\""
fi
else
echo "Autentication is not set. Skipping authentication configuration..."
fi
mkdir -p /tmp/Downloads
mkdir -p /tmp/torrents
echo -e "Starting cloud torrent...\n"
${CLOUD_TORRENT_BINARY} --req-log --config-path cloud-torrent.yaml ${PORT_OPT} ${AUTHENTICATION_OPT}