entrypoint.sh 464 Bytes
Newer Older
1
2
3
#!/bin/sh
set -e

Chocobozzz's avatar
Chocobozzz committed
4

5
find /config ! -user peertube -exec chown peertube:peertube {} \; || true
6

7
8
9
# first arg is `-f` or `--some-option`
# or first arg is `something.conf`
if [ "${1#-}" != "$1" ] || [ "${1%.conf}" != "$1" ]; then
Chocobozzz's avatar
Chocobozzz committed
10
    set -- node "$@"
11
12
13
fi

# allow the container to be started with `--user`
Chocobozzz's avatar
Chocobozzz committed
14
if [ "$1" = 'node' -a "$(id -u)" = '0' ]; then
15
    find /data ! -user peertube -exec  chown peertube:peertube {} \;
Chocobozzz's avatar
Chocobozzz committed
16
    exec gosu peertube "$0" "$@"
17
18
19
fi

exec "$@"