refactoring

This commit is contained in:
Patrick Schleizer 2019-12-20 04:06:28 -05:00
parent 4c44871e9d
commit f92b414195
No known key found for this signature in database
GPG Key ID: CB8D50BB77BB3C48

View File

@ -91,12 +91,16 @@ set_file_perms() {
fso_without_trailing_slash="${fso%/}" fso_without_trailing_slash="${fso%/}"
## Use dpkg-statoverride so permissions are not reset during upgrades.
nosuid="" nosuid=""
if [ "$mode_from_config" = "nosuid" ]; then if [ "$mode_from_config" = "nosuid" ]; then
nosuid="true" nosuid="true"
## If mode_from_config is "nosuid" the config does not set owner and ## If mode_from_config is "nosuid" the config does not set owner and
## group. Therefore do not enforce owner/group check. ## group. Therefore do not enforce owner/group check.
add_statoverride_entry
else else
if ! seq -w 000 4777 | grep -qw "$mode_from_config"; then if ! seq -w 000 4777 | grep -qw "$mode_from_config"; then
echo "ERROR: Mode '$mode_from_config' is invalid!" >&2 echo "ERROR: Mode '$mode_from_config' is invalid!" >&2
@ -112,9 +116,6 @@ set_file_perms() {
echo "ERROR: Group '$group' does not exist!" >&2 echo "ERROR: Group '$group' does not exist!" >&2
continue continue
fi fi
fi
## Use dpkg-statoverride so permissions are not reset during upgrades.
## 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
@ -130,6 +131,11 @@ set_file_perms() {
## There is no fso entry. Therefore add one. ## There is no fso entry. Therefore add one.
add_statoverride_entry add_statoverride_entry
fi fi
fi
if [ "$capability" = "" ]; then if [ "$capability" = "" ]; then
continue continue