aboutsummarylogtreecommitdiffstats
path: root/reposilite.wrapper
blob: 7609e3f16210b934a52f3f50f46776d58a8935ac (plain)
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
#!/bin/bash

_ENV=${REPOSILITE_ENV:-/etc/reposilite/default.env}

if [ -e $_ENV ] ; then
  . $_ENV
fi

_RUN_USER=${REPOSILITE_USER:-reposilite}
_RUN_UID=`id -u $_RUN_USER`

if [ "$EUID" -eq "$_RUN_UID" ] ; then
   exec ${JAVA:-/usr/bin/java} -Xmx${REPOSILITE_MEM:-64m} \
     -jar /usr/share/java/reposilite/reposilite.jar \
     -wd ${REPOSILITE_WORKING_DIR:-/var/lib/reposilite} \
     -lc ${REPOSILITE_LOCAL_CONF:-/etc/reposilite/reposilite.cdn}
elif [ "$EUID" -ne 0 ]; then
  echo "Please run as root"
  exit 1
else
    exec runuser -u $_RUN_USER -- \
       ${JAVA:-/usr/bin/java} -Xmx${REPOSILITE_MEM:-64m} \
         -jar /usr/share/java/reposilite/reposilite.jar \
         -wd ${REPOSILITE_WORKING_DIR:-/var/lib/reposilite} \
         -lc ${REPOSILITE_LOCAL_CONF:-/etc/reposilite/reposilite.cdn}
fi