code simplification

This commit is contained in:
Patrick Schleizer 2019-12-20 02:20:54 -05:00
parent 72812da63f
commit a89befd902
No known key found for this signature in database
GPG Key ID: CB8D50BB77BB3C48

View File

@ -79,15 +79,17 @@ set_file_perms() {
continue
fi
if ! getent passwd | grep -q "^${owner}:" && ! [ "${mode}" = "nosuid" ]; then
if [ ! "${mode}" = "nosuid" ]; then
if ! getent passwd | grep -q "^${owner}:"; then
echo "ERROR: User '${owner}' does not exist!" >&2
continue
fi
if ! getent group | grep -q "^${group}:" && ! [ "${mode}" = "nosuid" ]; then
if ! getent group | grep -q "^${group}:"; then
echo "ERROR: Group '${group}' does not exist!" >&2
continue
fi
fi
## The permissions should not be reset during upgrades.
if dpkg-statoverride --list | grep -q "${fso%/}"; then