mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-03 13:30:36 +00:00
This fixes the import of backups, that would break when they wanted to nuke the existing config, because they had to npermission to delete the default blueprints that were copied without write-permissions from the nix store.
36 lines
1.3 KiB
Diff
36 lines
1.3 KiB
Diff
commit cca718816f66b0155602c974e6743e8ce49e367b
|
|
Author: Martin Weinelt <hexa@darmstadt.ccc.de>
|
|
Date: Thu Jun 12 03:37:27 2025 +0200
|
|
|
|
blueprints: copy default blueprints w/o permissions
|
|
|
|
There is no easy way to achieve this with shutil, because copytree() will
|
|
always call copystat() an ruin directory permissions.
|
|
|
|
diff --git a/homeassistant/components/blueprint/models.py b/homeassistant/components/blueprint/models.py
|
|
index 88052100259..a0b29ed3d01 100644
|
|
--- a/homeassistant/components/blueprint/models.py
|
|
+++ b/homeassistant/components/blueprint/models.py
|
|
@@ -378,9 +378,17 @@ class DomainBlueprints:
|
|
if self.blueprint_folder.exists():
|
|
return
|
|
|
|
- shutil.copytree(
|
|
- integration.file_path / BLUEPRINT_FOLDER,
|
|
- self.blueprint_folder / HOMEASSISTANT_DOMAIN,
|
|
- )
|
|
+ import os
|
|
+ os.makedirs(self.blueprint_folder / HOMEASSISTANT_DOMAIN)
|
|
+
|
|
+ import subprocess
|
|
+ subprocess.check_call([
|
|
+ "cp",
|
|
+ "--no-preserve=mode",
|
|
+ "--no-target-directory",
|
|
+ "--recursive",
|
|
+ str(integration.file_path / BLUEPRINT_FOLDER),
|
|
+ str(self.blueprint_folder / HOMEASSISTANT_DOMAIN),
|
|
+ ])
|
|
|
|
await self.hass.async_add_executor_job(populate)
|