]> glassweightruler.freedombox.rocks Git - Ventoy.git/blob - IMG/cpio/ventoy/hook/suse/ventoy-hook.sh
Fix Windows 11 error 0x80070001. (#3010 #3029 #3105)
[Ventoy.git] / IMG / cpio / ventoy / hook / suse / ventoy-hook.sh
1 #!/ventoy/busybox/sh
2 #************************************************************************************
3 # Copyright (c) 2020, longpanda <admin@ventoy.net>
4 #
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License as
7 # published by the Free Software Foundation; either version 3 of the
8 # License, or (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, see <http://www.gnu.org/licenses/>.
17 #
18 #************************************************************************************
19
20 . $VTOY_PATH/hook/ventoy-os-lib.sh
21
22 if [ -f $VTOY_PATH/autoinstall ]; then
23 if [ -f /linuxrc.config ]; then
24 echo "AutoYaST: file:///ventoy/autoinstall" >> /info-ventoy
25 $SED "1 iinfo: file:/info-ventoy" -i /linuxrc.config
26 fi
27 fi
28
29 if $BUSYBOX_PATH/ls $VTOY_PATH | $GREP -q 'ventoy_dud[0-9]'; then
30 if [ -f /linuxrc.config ]; then
31 vtKerVer=$($BUSYBOX_PATH/uname -r)
32 ventoy_check_insmod /modules/loop.ko
33 ventoy_check_insmod /modules/squashfs.ko
34
35 ventoy_check_mount /parts/00_lib /modules
36 ventoy_check_insmod /modules/lib/modules/$vtKerVer/initrd/isofs.ko
37 $BUSYBOX_PATH/umount /modules
38
39 for vtDud in $($BUSYBOX_PATH/ls $VTOY_PATH/ventoy_dud*); do
40 $BUSYBOX_PATH/mkdir -p ${vtDud%.*}_mnt
41 if $BUSYBOX_PATH/mount $vtDud ${vtDud%.*}_mnt > /dev/null 2>&1; then
42 $BUSYBOX_PATH/cp -a ${vtDud%.*}_mnt ${vtDud%.*}_data
43 $BUSYBOX_PATH/umount ${vtDud%.*}_mnt
44 echo "dud: file://${vtDud%.*}_data" >> /linuxrc.config
45 else
46 echo "mount $vtDud failed" >> $VTLOG
47 fi
48 done
49
50 $BUSYBOX_PATH/rmmod isofs >> $VTLOG 2>&1
51 $BUSYBOX_PATH/rmmod squashfs >> $VTLOG 2>&1
52 $BUSYBOX_PATH/rmmod loop >> $VTLOG 2>&1
53 fi
54 fi
55
56 #echo "Exec: /bin/sh $VTOY_PATH/hook/suse/cdrom-hook.sh" >> /info-ventoy
57 #echo "install: hd:/?device=/dev/mapper/ventoy" >> /info-ventoy
58 #$SED "1 iinfo: file:/info-ventoy" -i /linuxrc.config
59
60 if [ -e /etc/initrd.functions ] && $GREP -q 'HPIP' /etc/initrd.functions; then
61 echo "HPIP" >> $VTLOG
62 $BUSYBOX_PATH/mkdir /dev
63 $BUSYBOX_PATH/mknod -m 660 /dev/console c 5 1
64 $SED "/CD_DEVICES=/a $BUSYBOX_PATH/sh $VTOY_PATH/hook/suse/disk_hook.sh" -i /etc/initrd.functions
65 $SED "/CD_DEVICES=/a CD_DEVICES=\"/dev/ventoy \$CD_DEVICES\"" -i /etc/initrd.functions
66 elif [ -f /scripts/udev_setup ]; then
67 echo "udev_setup" >> $VTLOG
68 echo "/ventoy/busybox/sh /ventoy/hook/suse/udev_setup_hook.sh" >> /scripts/udev_setup
69 else
70 echo "SUSE" >> $VTLOG
71 ventoy_systemd_udevd_work_around
72 ventoy_add_udev_rule "$VTOY_PATH/hook/suse/udev_disk_hook.sh %k"
73 fi