Adding command line parameter to remove persistence.
authorTom Jampen <tom@cryptography.ch>
Mon, 15 Dec 2014 14:17:04 +0000 (15:17 +0100)
committerDaniel Baumann <mail@daniel-baumann.ch>
Sun, 4 Jan 2015 20:51:16 +0000 (21:51 +0100)
components/2010-remove-persistence [new file with mode: 0755]
components/9990-overlay.sh

diff --git a/components/2010-remove-persistence b/components/2010-remove-persistence
new file mode 100755 (executable)
index 0000000..5dcf0c0
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+#set -e
+
+Remove_persistence ()
+{
+       for _PARAMETER in ${LIVE_BOOT_CMDLINE}
+       do
+               case "${_PARAMETER}" in
+                       live-boot.persistence-remove=*|persistence-remove=*)
+                               LIVE_PERSISTENCE_REMOVE="${_PARAMETER#*persistence-remove=}"
+                               ;;
+
+                       live-boot.persistence-remove|persistence-remove)
+                               LIVE_PERSISTENCE_REMOVE="true"
+                               ;;
+               esac
+       done
+
+       case "${LIVE_PERSISTENCE_REMOVE}" in
+               true)
+                       ;;
+
+               *)
+                       return 0
+                       ;;
+       esac
+
+       # Remove persistence
+       cd /live/overlay && find . -not -name 'persistence.conf' | xargs rm -rf
+}
index 54b75e5..92d0355 100755 (executable)
@@ -299,6 +299,9 @@ setup_unionfs ()
                fi || panic "mount ${UNIONTYPE} on ${unionmountpoint} failed with option ${unionmountopts}"
        done
 
+       # Remove persistence depending on boot parameter
+       Remove_persistence
+
        # Correct the permissions of /:
        chmod 0755 "${rootmnt}"