-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.sh
executable file
·35 lines (27 loc) · 1.2 KB
/
start.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
#!/bin/bash -x
# vim: expandtab:tabstop=4:shiftwidth=4
set -e
if [ -e /root/first_boot_complete ] ; then
# Because the QNAP containers get stoped then restarted (instead of starting
# cleanly each time), here we have been "restarted". No need to set up the
# account again. Just start back up.
insync-headless start
else
if [ ! -v INSYNC_AUTH ] ; then
echo "Set INSYNC_AUTH environment before launching"
echo "Go to https://goo.gl/jv797S to get a code"
exit 10
fi
if [ ! -v GDRIVE_PATH ] ; then
echo "Set GDRIVE_PATH to where you mounted the Google Drive contents into this container"
exit 11
fi
insync-headless start && sleep 2 && insync-headless pause_syncing && sleep 2
# recent insync doesn't allow unattended add_account actions :/
# insync-headless add_account -p /$GDRIVE_PATH -a $INSYNC_AUTH && sleep 2
expect -c "spawn insync-headless add_account -p /$GDRIVE_PATH -a $INSYNC_AUTH ; set timeout -1 ; expect -re \".*yes/no\]\r\" ; send -- \"yes\r\" ; expect eof"
insync-headless resume_syncing
touch /root/first_boot_complete
fi
echo "Looping forever so the container doesn't exit"
while true ; do sleep 3600 ; done