0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-09 12:05:50 +03:00

nixos/home-assistant: fix removing of uninstalled custom components

Before components was not an array and the first loop did never loop
through all entries but through the entire output of find without
splitting by new line.

Tested by copying the preStart script out of the nix store, doing the
change and observing that now the custom-components directory is indeed
being cleaned up after removing a custom component.
This commit is contained in:
Sandro Jäckel 2023-12-20 04:19:05 +01:00
parent 64121103ec
commit d4c622ec5f
No known key found for this signature in database
GPG key ID: 3AF5A43A3EECC2E5

View file

@ -468,8 +468,8 @@ in {
mkdir -p "${cfg.configDir}/custom_components"
# remove components symlinked in from below the /nix/store
components="$(find "${cfg.configDir}/custom_components" -maxdepth 1 -type l)"
for component in "$components"; do
readarray -d "" components < <(find "${cfg.configDir}/custom_components" -maxdepth 1 -type l -print0)
for component in "''${components[@]}"; do
if [[ "$(readlink "$component")" =~ ^${escapeShellArg builtins.storeDir} ]]; then
rm "$component"
fi