From: Daan De Meyer Date: Sun, 7 May 2023 13:02:35 +0000 (+0200) Subject: Fall back to regular copying if doing a btrfs snapshot fails X-Git-Tag: v15~177^2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ab1a600fa250b4c3ef63726fe57a07dad6df8d23;p=thirdparty%2Fmkosi.git Fall back to regular copying if doing a btrfs snapshot fails --- diff --git a/mkosi/btrfs.py b/mkosi/btrfs.py index b34b44752..5a87c9a9b 100644 --- a/mkosi/btrfs.py +++ b/mkosi/btrfs.py @@ -12,7 +12,8 @@ def btrfs_maybe_make_subvolume(config: MkosiConfig, path: Path, mode: int) -> No die("Subvolumes requested but the btrfs command was not found") if config.use_subvolumes != ConfigFeature.disabled: - result = run(["btrfs", "subvolume", "create", path], check=config.use_subvolumes == ConfigFeature.enabled).returncode + result = run(["btrfs", "subvolume", "create", path], + check=config.use_subvolumes == ConfigFeature.enabled).returncode else: result = 1 @@ -37,5 +38,8 @@ def btrfs_maybe_snapshot_subvolume(config: MkosiConfig, src: Path, dst: Path) -> if dst.exists(): dst.rmdir() - run(["btrfs", "subvolume", "snapshot", src, dst], - check=config.use_subvolumes == ConfigFeature.enabled) + result = run(["btrfs", "subvolume", "snapshot", src, dst], + check=config.use_subvolumes == ConfigFeature.enabled).returncode + + if result != 0: + copy_path(src, dst)