mirror of
https://gh.con.sh/https://github.com/plexinc/pms-docker
synced 2025-04-25 21:45:08 +00:00
Changed script to avoid slow usermod
when possible.
This commit is contained in:
parent
3ae89855b4
commit
d1ea49cc79
@ -37,7 +37,23 @@ prefFile="${pmsApplicationSupportDir}/Plex Media Server/Preferences.xml"
|
||||
# Setup user/group ids
|
||||
if [ ! -z "${PLEX_UID}" ]; then
|
||||
if [ ! "$(id -u plex)" -eq "${PLEX_UID}" ]; then
|
||||
|
||||
# usermod likes to chown the home directory, so create a new one and use that
|
||||
# However, if the new UID is 0, we can't set the home dir back because the
|
||||
# UID of 0 is already in use (executing this script).
|
||||
if [ ! "${PLEX_UID}" -eq 0 ]; then
|
||||
mkdir /tmp/temphome
|
||||
usermod -d /tmp/temphome plex
|
||||
fi
|
||||
|
||||
# Change the UID
|
||||
usermod -o -u "${PLEX_UID}" plex
|
||||
|
||||
# Cleanup the temp home dir
|
||||
if [ ! "${PLEX_UID}" -eq 0 ]; then
|
||||
usermod -d /config plex
|
||||
rm -Rf /tmp/temphome
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user