summaryrefslogtreecommitdiff
path: root/modules/system
diff options
context:
space:
mode:
authorDaiderd Jordan <daiderd@gmail.com>2020-12-19 11:37:54 +0100
committerDaiderd Jordan <djordan@openmotics.com>2020-12-19 11:56:51 +0100
commit3cf11923ebd3648ec8cd51414eb302827d9c4ce8 (patch)
treecf7ea56dffeda323911f5d611b019cf349bce9b2 /modules/system
parent7e4b13455413ae24715dac31c28272d81ee163e3 (diff)
use --dry-run check to re-apply system patches
Diffstat (limited to 'modules/system')
-rw-r--r--modules/system/patches.nix16
1 files changed, 10 insertions, 6 deletions
diff --git a/modules/system/patches.nix b/modules/system/patches.nix
index 855d23f..0ef3e73 100644
--- a/modules/system/patches.nix
+++ b/modules/system/patches.nix
@@ -29,6 +29,10 @@ in
description = ''
Set of patches to apply to <filename>/</filename>.
+ <warning>
+ <para>This can modify everything so use with caution.</para>
+ </warning>
+
Useful for safely changing system files. Unlike the etc module this
won't remove or modify files with unexpected content.
'';
@@ -56,12 +60,12 @@ in
fi
done
- ${concatMapStringsSep "\n" (f: ''
- f="$(basename ${f})"
- if ! diff "${cfg.build.patches}/patches/$f" "/run/current-system/patches/$f" &> /dev/null; then
- patch --forward --backup -d / -p1 < '${f}' || true
- fi
- '') cfg.patches}
+ ${concatMapStringsSep "\n" (f: ''
+ f="$(basename ${f})"
+ if ! patch --reverse --dry-run -d / -p1 < '${f}' &> /dev/null; then
+ patch --forward --backup -d / -p1 < '${f}' || true
+ fi
+ '') cfg.patches}
'';
};