fix checking existing entries to avoid needless calls to dpkg-statoverride

This commit is contained in:
Patrick Schleizer 2019-12-20 10:45:59 -05:00
parent 370f3c5e54
commit b3458cc6ee
No known key found for this signature in database
GPG Key ID: CB8D50BB77BB3C48

View File

@ -198,10 +198,17 @@ set_file_perms() {
continue continue
fi fi
mode_for_grep="$mode_from_config"
first_character_of_mode_from_config="${mode_from_config::1}"
if [ "$first_character_of_mode_from_config" = "0" ]; then
## Remove leading '0'.
mode_for_grep="${mode_from_config:1}"
fi
## Check there is an entry for the fso. ## Check there is an entry for the fso.
if dpkg-statoverride --list | grep -q "$fso_without_trailing_slash"; then if dpkg-statoverride --list | grep -q "$fso_without_trailing_slash"; then
## There is an fso entry. Check if owner/group/mode match. ## There is an fso entry. Check if owner/group/mode match.
if dpkg-statoverride --list | grep -q "$owner $group $mode_from_config $fso_without_trailing_slash"; then if dpkg-statoverride --list | grep -q "$owner $group $mode_for_grep $fso_without_trailing_slash"; then
## The owner/group/mode matches. No further action required. ## The owner/group/mode matches. No further action required.
true OK true OK
else else