forked from dzikoysk/reposilite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
42 lines (36 loc) · 1.11 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
set -e
REPOSILITE_ARGS="$REPOSILITE_OPTS"
case "$REPOSILITE_OPTS" in
*"--working-directory"*) ;;
*"-wd"* ) ;;
* ) REPOSILITE_ARGS="--working-directory=/app/data $REPOSILITE_ARGS";;
esac
if [ "$UID" -ne "0" ]; then
exec java \
-Dtinylog.writerFile.file="/var/log/reposilite/log_{date}.txt" \
-Dtinylog.writerFile.latest=/var/log/reposilite/latest.log \
$JAVA_OPTS \
-jar reposilite.jar \
$REPOSILITE_ARGS
else
GROUP_ID="${PGID:-999}"
if ! grep -q "^reposilite" /etc/group;
then
addgroup --gid "$GROUP_ID" reposilite;
fi
USER_ID="${PUID:-999}"
if ! grep "^reposilite" /etc/passwd;
then
adduser --system -uid "$USER_ID" --ingroup reposilite --shell /bin/sh reposilite;
fi
chown -R reposilite:reposilite /app
chown -R reposilite:reposilite /var/log/reposilite
exec runuser -u reposilite -- \
java \
-Dtinylog.writerFile.file="/var/log/reposilite/log_{date}.txt" \
-Dtinylog.writerFile.latest=/var/log/reposilite/latest.log \
$JAVA_OPTS \
-jar reposilite.jar \
$REPOSILITE_ARGS
fi