Only chown files that have incorrect user/group

Not all files will need to change user/group and doing for every file can take a
very long time for large libraries. This commit will use find to find files/dir
that have incorrect user/group and change them.

Hopefully this should be quicker than going through and changing every single
file.
This commit is contained in:
Graham Booker 2021-03-15 15:21:50 -05:00
parent 13e780cda5
commit 716ed27eca

View File

@ -67,10 +67,10 @@ fi
if [ "${CHANGE_CONFIG_DIR_OWNERSHIP,,}" = "true" ]; then
if [ -f "${prefFile}" ]; then
if [ ! "$(stat -c %u "${prefFile}")" = "$(id -u plex)" ]; then
chown -R plex:plex /config
find /config \! \( -uid $(id -u plex) -gid $(id -g plex) \) -print0 | xargs -0 chown plex:plex
fi
else
chown -R plex:plex /config
find /config \! \( -uid $(id -u plex) -gid $(id -g plex) \) -print0 | xargs -0 chown plex:plex
fi
chown -R plex:plex /transcode
fi