-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathentrypoint.sh
executable file
·24 lines (22 loc) · 1.07 KB
/
entrypoint.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
#!/bin/sh
set -e
umask 002
export PATH=/$UNAME/.cabal/bin:$PATH
if [ "$1" = 'gitit' ]; then
if [ ! -f /data/gitit.conf ]; then
gosu $UNAME gitit --print-default-config > /data/gitit.conf
gosu $UNAME sed -i -e 's|^use-cache:.*$|use-cache: yes|' /data/gitit.conf
gosu $UNAME sed -i -e 's|^cache-dir:.*$|cache-dir: /tmp|' /data/gitit.conf
gosu $UNAME sed -i -e 's|^pdf-export:.*$|pdf-export: yes|' /data/gitit.conf
#gosu $UNAME sed -i -e 's|^debug-mode:.*$|debug-mode: yes|' /data/gitit.conf
#gosu $UNAME sed -i -e 's|^require-authentication:.*$|require-authentication: none|' /data/gitit.conf
# run once, by specifying unbindable port 80, to initialize files in /data
gosu $UNAME gitit -f /data/gitit.conf -p 80 2>/dev/null || true
# copy over missing files
gosu $UNAME bash -l -c "for n in \$(find /usr/share/*/gitit* -type d -path '*data/static'); do cd \$(dirname \$n) && tar cf - static s5 templates markupHelp markup.* | ( tar xf - -C /data ); done"
fi
exec gosu $UNAME "$@"
elif [ "$1" = 'pandoc' ]; then
exec gosu $UNAME "$@"
fi
exec "$@"