mirror of
				https://github.com/ventoy/Ventoy.git
				synced 2025-10-30 00:05:09 -04:00 
			
		
		
		
	Fix a bug when booting latest Alpine linux.
This commit is contained in:
		
							parent
							
								
									7b70a5278a
								
							
						
					
					
						commit
						2cd22da8fb
					
				
							
								
								
									
										4
									
								
								IMG/cpio/ventoy/hook/alpine/insert.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								IMG/cpio/ventoy/hook/alpine/insert.sh
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,4 @@ | |||||||
|  | for i in 1 2; do  | ||||||
|  | if [ $i -eq 2 ]; then | ||||||
|  |     /ventoy/busybox/sh /ventoy/hook/alpine/udev_disk_hook.sh | ||||||
|  | fi | ||||||
| @ -19,22 +19,17 @@ | |||||||
| 
 | 
 | ||||||
| . /ventoy/hook/ventoy-hook-lib.sh | . /ventoy/hook/ventoy-hook-lib.sh | ||||||
| 
 | 
 | ||||||
| if [ "$SUBSYSTEM" != "block" ] || [ "$DEVTYPE" != "partition" ]; then     |  | ||||||
|     exit 0 |  | ||||||
| fi |  | ||||||
| 
 |  | ||||||
| if [ -b /dev/${MDEV:0:-1} ]; then |  | ||||||
|     vtlog "/dev/${MDEV:0:-1} exist" |  | ||||||
| else |  | ||||||
|     $SLEEP 2 |  | ||||||
| fi |  | ||||||
| 
 |  | ||||||
| if is_ventoy_hook_finished || not_ventoy_disk "${MDEV:0:-1}"; then |  | ||||||
|     exit 0 |  | ||||||
| fi |  | ||||||
| 
 |  | ||||||
| PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH | PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH | ||||||
| 
 | 
 | ||||||
|  | wait_for_usb_disk_ready | ||||||
|  | 
 | ||||||
|  | vtdiskname=$(get_ventoy_disk_name) | ||||||
|  | if [ "$vtdiskname" = "unknown" ]; then | ||||||
|  |     vtlog "ventoy disk not found" | ||||||
|  |     PATH=$VTPATH_OLD | ||||||
|  |     exit 0 | ||||||
|  | fi | ||||||
|  | 
 | ||||||
| # | # | ||||||
| # longpanda: | # longpanda: | ||||||
| # Alpine initramfs doesn't contain dm-mod or fuse module,  | # Alpine initramfs doesn't contain dm-mod or fuse module,  | ||||||
| @ -47,13 +42,17 @@ PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH | |||||||
| #   3. unmount and delete the squashfs file | #   3. unmount and delete the squashfs file | ||||||
| # | # | ||||||
| 
 | 
 | ||||||
|  | MDEV="${vtdiskname#/dev/}2" | ||||||
|  | 
 | ||||||
| vtoydm -i -f $VTOY_PATH/ventoy_image_map -d /dev/${MDEV:0:-1} > $VTOY_PATH/iso_file_list | vtoydm -i -f $VTOY_PATH/ventoy_image_map -d /dev/${MDEV:0:-1} > $VTOY_PATH/iso_file_list | ||||||
| 
 | 
 | ||||||
| vtLine=$(grep '[-][-] modloop-lts ' $VTOY_PATH/iso_file_list) | vtLine=$(grep '[-][-] modloop-lts ' $VTOY_PATH/iso_file_list) | ||||||
| sector=$(echo $vtLine | awk '{print $(NF-1)}') | sector=$(echo $vtLine | awk '{print $(NF-1)}') | ||||||
| length=$(echo $vtLine | awk '{print $NF}') | length=$(echo $vtLine | awk '{print $NF}') | ||||||
| 
 | 
 | ||||||
|  | echo -n "Mounting boot media, please wait ......" | ||||||
| vtoydm -e -f $VTOY_PATH/ventoy_image_map -d /dev/${MDEV:0:-1} -s $sector -l $length -o /vt_modloop | vtoydm -e -f $VTOY_PATH/ventoy_image_map -d /dev/${MDEV:0:-1} -s $sector -l $length -o /vt_modloop | ||||||
|  | echo "done" | ||||||
| 
 | 
 | ||||||
| mkdir -p $VTOY_PATH/mnt | mkdir -p $VTOY_PATH/mnt | ||||||
| mount /vt_modloop $VTOY_PATH/mnt | mount /vt_modloop $VTOY_PATH/mnt | ||||||
|  | |||||||
| @ -19,6 +19,17 @@ | |||||||
| 
 | 
 | ||||||
| . $VTOY_PATH/hook/ventoy-os-lib.sh | . $VTOY_PATH/hook/ventoy-os-lib.sh | ||||||
| 
 | 
 | ||||||
| echo "-[-a-z0-9]*2 root:root 0666 @$BUSYBOX_PATH/sh $VTOY_PATH/hook/alpine/udev_disk_hook.sh" >> /mdev.conf | PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH | ||||||
| $CAT /etc/mdev.conf >> /mdev.conf | 
 | ||||||
| $BUSYBOX_PATH/mv /mdev.conf /etc/mdev.conf | LineBegin=$(grep -n "ebegin.*Mounting boot media" /init | awk -F: '{print $1}') | ||||||
|  | 
 | ||||||
|  | grep -n "^eend" /init > /t.list | ||||||
|  | while read line; do | ||||||
|  |     LineEnd=$(echo $line | awk -F: '{print $1}') | ||||||
|  |     if [ $LineEnd -gt $LineBegin ]; then | ||||||
|  |         sed "${LineEnd}i\done" -i /init | ||||||
|  |         sed "${LineBegin}r /ventoy/hook/alpine/insert.sh" -i /init         | ||||||
|  |         break | ||||||
|  |     fi | ||||||
|  | done < /t.list | ||||||
|  | rm -f /t.list | ||||||
|  | |||||||
| @ -64,6 +64,10 @@ if [ -f $VTOY_PATH/autoinstall ]; then | |||||||
|             $SED "/^mount \/proc/a export file=$VTOY_PATH/autoinstall; export auto='true'; export priority='critical'"  -i /init |             $SED "/^mount \/proc/a export file=$VTOY_PATH/autoinstall; export auto='true'; export priority='critical'"  -i /init | ||||||
|         fi |         fi | ||||||
|     fi |     fi | ||||||
|  |      | ||||||
|  |     # if [ -e /bin/check-missing-firmware ]; then | ||||||
|  |     #     $SED "/^#!/a\exit 0" -i /bin/check-missing-firmware | ||||||
|  |     # fi | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
| #for ARMA aka Omoikane | #for ARMA aka Omoikane | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user