-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path95_myfdroidserver
58 lines (47 loc) · 1.72 KB
/
95_myfdroidserver
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
#!/usr/bin/with-contenv bash
#init $FDROID_DIR with an empty fdroid repo, if its empty
if [ ! "$(ls -A $FDROID_DIR)" ]
then
echo "[my.fdroid.repo] $FDROID_DIR is empty..."
echo "[my.fdroid.repo] ... execute fdroid init"
fdroid init
echo "[my.fdroid.repo] ... generate gplaycli.conf"
cp /gplaycli/gplaycli.conf $FDROID_DIR
echo "[my.fdroid.repo] ... generate apk_list.txt"
cp /example_apk_list.txt $FDROID_DIR/apk_list.txt
else
echo "[my.fdroid.repo] $FDROID_DIR is not empty. Skip init fdroid repo."
fi
#install Cron
echo "[my.fdroid.repo] Export environment for use in crontab"
declare -p | grep -Ev 'BASHOPTS|BASH_VERSINFO|EUID|PPID|SHELLOPTS|UID' > /container.env
CRON_CMD="fdroid_update"
CRONTAB="$CRON_TIMESPEC $CRON_CMD"
echo "[my.fdroid.repo] Install crontab: $CRONTAB"
echo "SHELL=/bin/bash
BASH_ENV=/container.env
$CRONTAB > /tmp/stdout 2> /tmp/stderr
# This extra line makes it a valid cron
" | crontab -
echo "[my.fdroid.repo] Create custom stdout and stderr named pipes"
if [ ! -p /tmp/stdout ]; then
mkfifo /tmp/stdout
chmod 0666 /tmp/stdout
fi
if [ ! -p /tmp/stderr ]; then
mkfifo /tmp/stderr
chmod 0666 /tmp/stderr
fi
# Have the main Docker process tail the files to produce stdout and stderr
# for the main process that Docker will actually show in docker logs.
tail -f -n 300 /tmp/stdout &
tail -f -n 300 /tmp/stderr >&2 &
#run on startup, if configured
if [ "$RUN_ON_STARTUP" = "yes" ]; then
echo "[my.fdroid.repo] Schedule run on startup in 10s"
sleep 10 && echo "[my.fdroid.repo] Run on startup: $CRON_CMD" && $CRON_CMD &
else
echo "[my.fdroid.repo] Do not run on startup"
fi
#echo "[my.fdroid.repo]] Start cron"
#/usr/sbin/cron -f -L 1 &