]> glassweightruler.freedombox.rocks Git - Ventoy.git/commitdiff
experimental persistent support for Fedora (#791)
authorlongpanda <admin@ventoy.net>
Tue, 6 Apr 2021 06:28:34 +0000 (14:28 +0800)
committerlongpanda <admin@ventoy.net>
Tue, 6 Apr 2021 06:28:34 +0000 (14:28 +0800)
IMG/cpio/ventoy/hook/rhel7/ventoy-hook.sh
IMG/cpio/ventoy/hook/rhel7/ventoy-overlay.sh [new file with mode: 0644]

index cff0f1078a09499003ea12ed34d7331821b00756..d3d7ab8175b6c3784b85dc38b1a502c17d48b8a1 100644 (file)
@@ -40,7 +40,25 @@ else
     done
 fi
 
     done
 fi
 
-echo "VTKS=$VTKS" >> $VTLOG
+if [ -f $VTOY_PATH/ventoy_persistent_map ]; then
+    VTOVERLAY="rd.live.overlay=/dev/dm-1:/vtoyoverlayfs/overlayfs"
+    
+    if [ -e /sbin/dmsquash-live-root ]; then
+        echo "patch /sbin/dmsquash-live-root for persistent ..." >> $VTLOG
+        $SED "/mount.*devspec.*\/run\/initramfs\/overlayfs/a . /ventoy/hook/rhel7/ventoy-overlay.sh" -i /sbin/dmsquash-live-root
+    fi
+    
+    #close selinux
+    $BUSYBOX_PATH/mkdir -p $VTOY_PATH/selinuxfs
+    if $BUSYBOX_PATH/mount -t selinuxfs selinuxfs $VTOY_PATH/selinuxfs; then
+        echo 1 > $VTOY_PATH/selinuxfs/disable
+        $BUSYBOX_PATH/umount $VTOY_PATH/selinuxfs
+    fi    
+    $BUSYBOX_PATH/rm -rf $VTOY_PATH/selinuxfs
+fi
+
+
+echo "VTKS=$VTKS  VTOVERLAY=$VTOVERLAY" >> $VTLOG
 
 if ls $VTOY_PATH | $GREP -q 'ventoy_dud[0-9]'; then
     for vtDud in $(ls $VTOY_PATH/ventoy_dud*); do
 
 if ls $VTOY_PATH | $GREP -q 'ventoy_dud[0-9]'; then
     for vtDud in $(ls $VTOY_PATH/ventoy_dud*); do
@@ -50,9 +68,9 @@ fi
 echo "vtInstDD=$vtInstDD" >> $VTLOG
 
 if $GREP -q 'root=live' /proc/cmdline; then
 echo "vtInstDD=$vtInstDD" >> $VTLOG
 
 if $GREP -q 'root=live' /proc/cmdline; then
-    $SED "s#printf\(.*\)\$CMDLINE#printf\1\$CMDLINE root=live:/dev/dm-0 $VTKS $vtInstDD#" -i /lib/dracut-lib.sh
+    $SED "s#printf\(.*\)\$CMDLINE#printf\1\$CMDLINE root=live:/dev/dm-0 $VTKS $VTOVERLAY $vtInstDD#" -i /lib/dracut-lib.sh
 else
 else
-    $SED "s#printf\(.*\)\$CMDLINE#printf\1\$CMDLINE inst.stage2=hd:/dev/dm-0 $VTKS $vtInstDD#" -i /lib/dracut-lib.sh
+    $SED "s#printf\(.*\)\$CMDLINE#printf\1\$CMDLINE inst.stage2=hd:/dev/dm-0 $VTKS $VTOVERLAY $vtInstDD#" -i /lib/dracut-lib.sh
 fi
 
 ventoy_set_inotify_script  rhel7/ventoy-inotifyd-hook.sh
 fi
 
 ventoy_set_inotify_script  rhel7/ventoy-inotifyd-hook.sh
diff --git a/IMG/cpio/ventoy/hook/rhel7/ventoy-overlay.sh b/IMG/cpio/ventoy/hook/rhel7/ventoy-overlay.sh
new file mode 100644 (file)
index 0000000..d8fe079
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+[ -d /run/initramfs/overlayfs$pathspec ] || mkdir -p /run/initramfs/overlayfs$pathspec
+[ -d /run/initramfs/overlayfs$pathspec/../ovlwork ] || mkdir -p /run/initramfs/overlayfs$pathspec/../ovlwork