forked from limetech/dockerapp-sync
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·72 lines (58 loc) · 1.79 KB
/
install.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
#!/bin/bash
#########################################
## ENVIRONMENTAL CONFIG ##
#########################################
# Configure user nobody to match unRAID's settings
export DEBIAN_FRONTEND="noninteractive"
usermod -u 99 nobody
usermod -g 100 nobody
usermod -d /home nobody
chown -R nobody:users /home
#########################################
## FILES, SERVICES AND CONFIGURATION ##
#########################################
#config
cat <<'EOT' > /etc/my_init.d/config.sh
#!/bin/bash
if [[ $(cat /etc/timezone) != $TZ ]] ; then
echo "$TZ" > /etc/timezone
DEBIAN_FRONTEND="noninteractive" dpkg-reconfigure -f noninteractive tzdata
fi
EOT
# btsync
mkdir -p /etc/service/btsync
cat <<'EOT' > /etc/service/btsync/run
#!/bin/bash
umask 000
[[ ! -f /config/btsync.conf ]] && cp /tmp/btsync.conf /config/
[[ ! -d /config/.sync ]] && mkdir -p /config/.sync
chown -R nobody:users /opt/btsync /config
exec /sbin/setuser nobody /opt/btsync/btsync --nodaemon --config "/config/btsync.conf"
EOT
cat <<'EOT' > /tmp/btsync.conf
{
"device_name": "unRAID",
"listening_port" : 5555,
"storage_path" : "/config/.sync",
"use_upnp" : false,
"download_limit" : 0,
"upload_limit" : 0,
"webui" :
{
"listen" : "0.0.0.0:8888"
}
}
EOT
chmod -R +x /etc/service/ /etc/my_init.d/
#########################################
## INSTALLATION ##
#########################################
# Install BTSync
mkdir -p /opt/btsync
curl -s -k -L "https://raw.githubusercontent.com/iarp/dockerapp-sync/master/btsync_x64-1.3.109.tar.gz" | tar -xzf - -C /opt/btsync
#########################################
## CLEANUP ##
#########################################
# Clean APT install files
apt-get clean -y
rm -rf /var/lib/apt/lists/* /var/cache/* /var/tmp/*