secrets: fix setup-secrets in case of no secrets
Previously, the glob (*) returned '*' when no files existed in the secrets dir, leading to error `chown: cannot access '*'`. Now `unprocessedFiles` is empty when there are no secrets. Also remove the unneeded sorting of `unprocessedFiles` and remove redundant leading zero in the default mode.
This commit is contained in:
parent
e61c743644
commit
4d5bc810eb
@ -58,7 +58,7 @@ let
|
||||
};
|
||||
permissions = mkOption {
|
||||
type = str;
|
||||
default = "0440";
|
||||
default = "440";
|
||||
};
|
||||
};
|
||||
}
|
||||
@ -205,7 +205,9 @@ in {
|
||||
}
|
||||
|
||||
# Make all other files accessible to root only
|
||||
unprocessedFiles=$(comm -23 <(printf '%s\n' *) <(printf '%s\n' "''${processedFiles[@]}" | sort))
|
||||
unprocessedFiles=$(
|
||||
comm -23 <(shopt -s nullglob; printf '%s\n' *) <(printf '%s\n' "''${processedFiles[@]}")
|
||||
)
|
||||
if [[ $unprocessedFiles ]]; then
|
||||
IFS=$'\n'
|
||||
chown root: $unprocessedFiles
|
||||
|
Loading…
Reference in New Issue
Block a user