fix needlessly re-adding entries

This commit is contained in:
Patrick Schleizer 2019-12-23 01:20:56 -05:00
parent 906b3d32e7
commit a1e78e8515
No known key found for this signature in database
GPG Key ID: CB8D50BB77BB3C48

View File

@ -339,9 +339,15 @@ set_file_perms() {
## root root 755 /home ## root root 755 /home
## ##
## dpkg-statoverride does not show leading '0'. ## dpkg-statoverride does not show leading '0'.
if dpkg-statoverride --list "$fso_without_trailing_slash" >/dev/null ; then local dpkg_statoverride_list_output=""
local dpkg_statoverride_list_exit_code=0
dpkg_statoverride_list_output="$(dpkg-statoverride --list "$fso_without_trailing_slash")" || { dpkg_statoverride_list_exit_code=$? ; true; };
if [ "$dpkg_statoverride_list_exit_code" = "0" ]; then
true "There is an fso entry. Check if owner/group/mode match." true "There is an fso entry. Check if owner/group/mode match."
if dpkg-statoverride --list | grep -q "$owner_from_config $group_from_config $mode_for_grep $fso_without_trailing_slash" ; then local grep_line
grep_line="$owner_from_config $group_from_config $mode_for_grep $fso_without_trailing_slash"
if echo "$dpkg_statoverride_list_output" | grep -q "$grep_line" ; then
true "OK The owner/group/mode matches. No further action required." true "OK The owner/group/mode matches. No further action required."
else else
true "The owner/group/mode do not match, therefore remove and re-add the entry to update it." true "The owner/group/mode do not match, therefore remove and re-add the entry to update it."