summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorworldofpeace <worldofpeace@protonmail.ch>2020-07-30 14:56:06 -0400
committerGitHub <noreply@github.com>2020-07-30 14:56:06 -0400
commitb21c16fc5e53fa7f7298ea734b4d8baffd1d1720 (patch)
tree3ef6c9050ccfd9fb813714a73e75ba51b29a2fbf
parent08bc533dc66179c70c80cc941fc257741282ae84 (diff)
parent948de104de09cc27184d97aed2fe3b758133cc8e (diff)
Merge pull request #83911 from mkg20001/boot-persistence
stage-1-init: add boot.persistence option
-rw-r--r--nixos/modules/system/boot/stage-1-init.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/nixos/modules/system/boot/stage-1-init.sh b/nixos/modules/system/boot/stage-1-init.sh
index 607aec87f01e..54e3a691b2f8 100644
--- a/nixos/modules/system/boot/stage-1-init.sh
+++ b/nixos/modules/system/boot/stage-1-init.sh
@@ -144,6 +144,14 @@ for o in $(cat /proc/cmdline); do
set -- $(IFS==; echo $o)
stage2Init=$2
;;
+ boot.persistence=*)
+ set -- $(IFS==; echo $o)
+ persistence=$2
+ ;;
+ boot.persistence.opt=*)
+ set -- $(IFS==; echo $o)
+ persistence_opt=$2
+ ;;
boot.trace|debugtrace)
# Show each command.
set -x
@@ -534,6 +542,14 @@ while read -u 3 mountPoint; do
continue
fi
+ if [ "$mountPoint" = / ] && [ "$device" = tmpfs ] && [ ! -z "$persistence" ]; then
+ echo persistence...
+ waitDevice "$persistence"
+ echo enabling persistence...
+ mountFS "$persistence" "$mountPoint" "$persistence_opt" "auto"
+ continue
+ fi
+
mountFS "$device" "$mountPoint" "$options" "$fsType"
done