@@ -21,30 +21,32 @@ cat << "EOF"
2121
2222EOF
2323
24- # Create group if it doesn't exist
25- if ! getent group " $PGID " > /dev/null 2>&1 ; then
26- echo " Creating group with GID $PGID "
27- groupadd -g " $PGID " appgroup
24+ if [ " $SEED_USER " = " true" ]; then
25+ # Create group if it doesn't exist
26+ if ! getent group " $PGID " > /dev/null 2>&1 ; then
27+ echo " Creating group with GID $PGID "
28+ groupadd -g " $PGID " appgroup
29+ fi
30+
31+ # Create user if it doesn't exist
32+ if ! getent passwd " $PUID " > /dev/null 2>&1 ; then
33+ echo " Creating user with UID $PUID "
34+ useradd -u " $PUID " -g " $PGID " -s /bin/bash -M appuser
35+ fi
36+
37+ # Change ownership of app directory if not running as root
38+ if [ " $PUID " != " 0" ] || [ " $PGID " != " 0" ]; then
39+ mkdir -p /config || true
40+ chown -R " $PUID :$PGID " /app
41+ chown -R " $PUID :$PGID " /config
42+ fi
2843fi
2944
30- # Create user if it doesn't exist
31- if ! getent passwd " $PUID " > /dev/null 2>&1 ; then
32- echo " Creating user with UID $PUID "
33- useradd -u " $PUID " -g " $PGID " -s /bin/bash -M appuser
34- fi
35-
36- # Change ownership of app directory if not running as root
37- if [ " $PUID " != " 0" ] || [ " $PGID " != " 0" ]; then
38- mkdir -p /config || true
39- chown -R " $PUID :$PGID " /app
40- chown -R " $PUID :$PGID " /config
41- fi
42-
43- # Execute the main command as the specified user
45+ # Execute the main command
4446if [ " $PUID " = " 0" ] && [ " $PGID " = " 0" ]; then
4547 # Running as root, no need for gosu
4648 exec /app/Cleanuparr " $@ "
4749else
4850 # Use gosu to drop privileges
4951 exec gosu " $PUID :$PGID " /app/Cleanuparr " $@ "
50- fi
52+ fi
0 commit comments