]> glassweightruler.freedombox.rocks Git - Ventoy.git/commitdiff
Fix a bug about source media missing when boot openEuler
authorlongpanda <admin@ventoy.net>
Mon, 12 Apr 2021 03:53:25 +0000 (11:53 +0800)
committerlongpanda <admin@ventoy.net>
Mon, 12 Apr 2021 03:53:25 +0000 (11:53 +0800)
IMG/cpio/ventoy/hook/openEuler/ventoy-hook.sh
IMG/cpio/ventoy/hook/openEuler/ventoy-inotifyd-hook.sh
IMG/cpio/ventoy/hook/openEuler/ventoy-overlay.sh [new file with mode: 0644]
IMG/cpio/ventoy/hook/openEuler/ventoy-repo.sh [new file with mode: 0644]

index 442b6f44d381215a62c6746d7a470a24ea01d4d5..63bd491056fed7f578a626e9b7326f920b07c5aa 100644 (file)
@@ -19,9 +19,6 @@
 
 . $VTOY_PATH/hook/ventoy-os-lib.sh
 
 
 . $VTOY_PATH/hook/ventoy-os-lib.sh
 
-#ventoy_systemd_udevd_work_around
-#ventoy_add_udev_rule "$VTOY_PATH/hook/default/udev_disk_hook.sh %k noreplace"
-
 if [ -f $VTOY_PATH/autoinstall ]; then
     VTKS="inst.ks=file:$VTOY_PATH/autoinstall"
 else
 if [ -f $VTOY_PATH/autoinstall ]; then
     VTKS="inst.ks=file:$VTOY_PATH/autoinstall"
 else
@@ -40,7 +37,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/openEuler/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
@@ -49,11 +64,7 @@ if ls $VTOY_PATH | $GREP -q 'ventoy_dud[0-9]'; then
 fi
 echo "vtInstDD=$vtInstDD" >> $VTLOG
 
 fi
 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
-else
-    $SED "s#printf\(.*\)\$CMDLINE#printf\1\$CMDLINE inst.stage2=hd:/dev/dm-0 $VTKS $vtInstDD#" -i /lib/dracut-lib.sh
-fi
+$SED "s#printf\(.*\)\$CMDLINE#printf\1\$CMDLINE inst.stage2=hd:/dev/dm-0 $VTKS $vtInstDD#" -i /lib/dracut-lib.sh
 
 ventoy_set_inotify_script  openEuler/ventoy-inotifyd-hook.sh
 
 
 ventoy_set_inotify_script  openEuler/ventoy-inotifyd-hook.sh
 
@@ -66,14 +77,15 @@ fi
 
 $BUSYBOX_PATH/cp -a $VTOY_PATH/hook/openEuler/ventoy-inotifyd-start.sh /lib/dracut/hooks/pre-udev/${vtPriority}-ventoy-inotifyd-start.sh
 $BUSYBOX_PATH/cp -a $VTOY_PATH/hook/openEuler/ventoy-timeout.sh /lib/dracut/hooks/initqueue/timeout/${vtPriority}-ventoy-timeout.sh
 
 $BUSYBOX_PATH/cp -a $VTOY_PATH/hook/openEuler/ventoy-inotifyd-start.sh /lib/dracut/hooks/pre-udev/${vtPriority}-ventoy-inotifyd-start.sh
 $BUSYBOX_PATH/cp -a $VTOY_PATH/hook/openEuler/ventoy-timeout.sh /lib/dracut/hooks/initqueue/timeout/${vtPriority}-ventoy-timeout.sh
+$BUSYBOX_PATH/cp -a $VTOY_PATH/hook/openEuler/ventoy-repo.sh /lib/dracut/hooks/pre-pivot/99-ventoy-repo.sh
 
 
-if [ -e /sbin/dmsquash-live-root ]; then
+if [ -f /sbin/dmsquash-live-root ]; then
     echo "patch /sbin/dmsquash-live-root ..." >> $VTLOG
     $SED "1 a $BUSYBOX_PATH/sh $VTOY_PATH/hook/openEuler/ventoy-make-link.sh" -i /sbin/dmsquash-live-root
 fi
 
 # suppress write protected mount warning
     echo "patch /sbin/dmsquash-live-root ..." >> $VTLOG
     $SED "1 a $BUSYBOX_PATH/sh $VTOY_PATH/hook/openEuler/ventoy-make-link.sh" -i /sbin/dmsquash-live-root
 fi
 
 # suppress write protected mount warning
-if [ -e /usr/sbin/anaconda-diskroot ]; then
+if [ -f /usr/sbin/anaconda-diskroot ]; then
     $SED  's/^mount $dev $repodir/mount -oro $dev $repodir/' -i /usr/sbin/anaconda-diskroot
 fi
 
     $SED  's/^mount $dev $repodir/mount -oro $dev $repodir/' -i /usr/sbin/anaconda-diskroot
 fi
 
index 57012e73ab122eccd304eb08b0bb5658256261f3..1da3a1975793f1c481a76a078a0eb8d0e8cadf75 100644 (file)
@@ -29,20 +29,11 @@ if is_inotify_ventoy_part $3; then
 
     vtlog "##### INOTIFYD: $2/$3 is created (YES) ..."
 
 
     vtlog "##### INOTIFYD: $2/$3 is created (YES) ..."
 
-    vtGenRulFile='/etc/udev/rules.d/99-live-squash.rules'
-    if [ -e $vtGenRulFile ] && $GREP -q dmsquash $vtGenRulFile; then
-        vtScript=$($GREP -m1 'RUN.=' $vtGenRulFile | $AWK -F'RUN.=' '{print $2}' | $SED 's/"\(.*\)".*/\1/')
-        vtlog "vtScript=$vtScript"
-        $vtScript
-    else
-        vtlog "$vtGenRulFile not exist..."
-    fi
-
     vtlog "find ventoy partition ..."
     
     vtlog "find ventoy partition ..."
     
-    vtReplaceOpt=noreplace
+    #vtReplaceOpt=noreplace
     
     
-    $BUSYBOX_PATH/sh $VTOY_PATH/hook/default/udev_disk_hook.sh $3 $vtReplaceOpt
+    $BUSYBOX_PATH/sh $VTOY_PATH/hook/default/udev_disk_hook.sh $3 
     
     blkdev_num=$($VTOY_PATH/tool/dmsetup ls | grep ventoy | sed 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1:\2/')  
     vtDM=$(ventoy_find_dm_id ${blkdev_num})
     
     blkdev_num=$($VTOY_PATH/tool/dmsetup ls | grep ventoy | sed 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1:\2/')  
     vtDM=$(ventoy_find_dm_id ${blkdev_num})
diff --git a/IMG/cpio/ventoy/hook/openEuler/ventoy-overlay.sh b/IMG/cpio/ventoy/hook/openEuler/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
diff --git a/IMG/cpio/ventoy/hook/openEuler/ventoy-repo.sh b/IMG/cpio/ventoy/hook/openEuler/ventoy-repo.sh
new file mode 100644 (file)
index 0000000..af85beb
--- /dev/null
@@ -0,0 +1,29 @@
+#!/ventoy/busybox/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/>.
+# 
+#************************************************************************************
+
+. /ventoy/hook/ventoy-hook-lib.sh
+
+vtlog "##### $0 $* ..."
+
+VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
+
+repodev=$(ls $VTOY_PATH/dev_backup*)
+echo "inst.repo=hd:/dev/${repodev#*dev_backup_}" >> /sysroot/etc/cmdline
+
+PATH=$VTPATH_OLD