]> glassweightruler.freedombox.rocks Git - Ventoy.git/blobdiff - IMG/cpio/ventoy/hook/rhel7/ventoy-inotifyd-hook.sh
1.1.07 release
[Ventoy.git] / IMG / cpio / ventoy / hook / rhel7 / ventoy-inotifyd-hook.sh
index d79bb2df30a3b0730c402a284f5ec836e81e715d..0ab59475e090145c504b750936f3459c1597efbe 100644 (file)
@@ -23,29 +23,66 @@ if is_ventoy_hook_finished; then
     exit 0
 fi
 
-vtlog "##### INOTIFYD: $2/$3 is created ..."
-
 VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
 
 if is_inotify_ventoy_part $3; then
+
+    vtlog "##### INOTIFYD: $2/$3 is created (YES) ..."
+
+    
+
     vtlog "find ventoy partition ..."
-    $BUSYBOX_PATH/sh $VTOY_PATH/hook/default/udev_disk_hook.sh $3 noreplace
     
-    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})
+    vtReplaceOpt=noreplace
+    if [ -f /lib/dracut/hooks/pre-pivot/99-ventoy-repo.sh ]; then
+        vtReplaceOpt=""
+    fi
+    
+    $BUSYBOX_PATH/sh $VTOY_PATH/hook/default/udev_disk_hook.sh $3 $vtReplaceOpt
+    
+    blkdev_num_mknod=$($VTOY_PATH/tool/dmsetup ls | $GREP ventoy | sed 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1 \2/')
+    $BUSYBOX_PATH/mknod -m 660 /dev/ventoy  b  $blkdev_num_mknod
+    $BUSYBOX_PATH/modprobe isofs >/dev/null 2>&1
+    vtlog "mknod /dev/ventoy $blkdev_num_mknod"
 
-    if [ "$vtDM" = "dm-0" ]; then
-        vtlog "This is dm-0, OK ..."
+    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"
+        
+        if [ -f $VTOY_PATH/distmagic/SCRE ]; then
+            /sbin/dmsquash-live-root /dev/ventoy
+        elif [ -f $VTOY_PATH/distmagic/DELL_PER ]; then
+            sed 's/liverw=[^ ]*/liverw=ro/g' -i /sbin/dmsquash-live-root
+            sed 's/writable_fsimg=[^ ]*/writable_fsimg=""/g' -i /sbin/dmsquash-live-root
+            /sbin/dmsquash-live-root /dev/ventoy
+        else
+            $vtScript
+        fi
     else
-        vtlog "####### This is $vtDM ####### this is abnormal ..."
-        ventoy_swap_device /dev/dm-0 /dev/$vtDM
+        vtlog "$vtGenRulFile not exist..."
+    fi
+    
+    if [ -f $VTOY_PATH/ventoy_ks_rootpath ]; then
+        vt_ks_rootpath=$(cat $VTOY_PATH/ventoy_ks_rootpath)
+        vtlog "ks rootpath <$vt_ks_rootpath>"
+        if [ -e /sbin/fetch-kickstart-disk ]; then
+            vtlog "fetch-kickstart-disk ..."        
+            /sbin/fetch-kickstart-disk /dev/ventoy "$vt_ks_rootpath"
+        fi
     fi
     
-    vtlog "set anaconda-diskroot ..."
-    /sbin/anaconda-diskroot /dev/dm-0    
-    #/sbin/initqueue --settled --onetime --name anaconda-diskroot anaconda-diskroot  /dev/dm-0
+    if [ -e /sbin/anaconda-diskroot ]; then
+        vtlog "set anaconda-diskroot ..."        
+
+        #busybox cp doesn't support -t option (issue 1900)
+        /bin/cp -a /bin/cp $BUSYBOX_PATH/cp
+        /sbin/anaconda-diskroot /dev/ventoy
+    fi
     
     set_ventoy_hook_finish
+else
+    vtlog "##### INOTIFYD: $2/$3 is created (NO) ..."
 fi
 
 PATH=$VTPATH_OLD