Skip to content

Commit

Permalink
Docker: fix fresh install (#219)
Browse files Browse the repository at this point in the history
  • Loading branch information
phnzb committed Apr 5, 2024
1 parent 36dad2f commit a95269e
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,22 @@ if [ -f /downloads/nzbget.lock ]; then
rm /downloads/nzbget.lock
fi

# change userid and groupid
PUID=${PUID:-1000}
PGID=${PGID:-1000}
groupmod -o -g "$PGID" users >/dev/null
usermod -o -u "$PUID" user >/dev/null

# create default config if not exist
if [ ! -f /config/nzbget.conf ]; then
cp /app/nzbget/share/nzbget/nzbget.conf /config/nzbget.conf
chown user:users /config/nzbget.conf
fi

# create scripts dir
if [ ! -d /downloads/scripts ]; then
mkdir -p /downloads/scripts
chown user:users /downloads/scripts
fi

# parse env vars to options
Expand All @@ -25,15 +38,6 @@ if [ ! -z "${NZBGET_PASS}" ]; then
OPTIONS="${OPTIONS}-o ControlPassword=${NZBGET_PASS} "
fi

# create scripts dir
mkdir -p /downloads/scripts

# change userid and groupid
PUID=${PUID:-1000}
PGID=${PGID:-1000}
groupmod -o -g "$PGID" users >/dev/null
usermod -o -u "$PUID" user >/dev/null

chown user:users /config || CONFIG_CHOWN_STATUS=$?
if [ ! -z $CONFIG_CHOWN_STATUS ]; then
echo "*** Could not set permissions on /config ; this container may not work as expected ***"
Expand Down

0 comments on commit a95269e

Please sign in to comment.