2 #************************************************************************************
3 # Copyright (c) 2020, longpanda <admin@ventoy.net>
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.
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.
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/>.
18 #************************************************************************************
20 .
$VTOY_PATH/hook
/ventoy
-os-lib.sh
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
29 if $GREP -q 'rdinit=/vtoy/vtoy' /proc
/cmdline
; then
30 echo "remove rdinit param" >> $VTLOG
31 echo "ptoptions=+rdinit" >> /linuxrc.config
35 if $BUSYBOX_PATH/ls $VTOY_PATH | $GREP -q 'ventoy_dud[0-9]'; then
36 if [ -f /linuxrc.config
]; then
37 vtKerVer
=$($BUSYBOX_PATH/uname -r)
38 ventoy_check_insmod
/modules
/loop.ko
39 ventoy_check_insmod
/modules
/squashfs.ko
41 ventoy_check_mount
/parts
/00_lib
/modules
42 ventoy_check_insmod
/modules
/lib
/modules
/$vtKerVer/initrd
/isofs.ko
43 $BUSYBOX_PATH/umount
/modules
45 for vtDud
in $($BUSYBOX_PATH/ls $VTOY_PATH/ventoy_dud*); do
46 $BUSYBOX_PATH/mkdir -p ${vtDud%.*}_mnt
47 if $BUSYBOX_PATH/mount
$vtDud ${vtDud%.*}_mnt
> /dev
/null
2>&1; then
48 $BUSYBOX_PATH/cp -a ${vtDud%.*}_mnt
${vtDud%.*}_data
49 $BUSYBOX_PATH/umount
${vtDud%.*}_mnt
50 echo "dud: file://${vtDud%.*}_data" >> /linuxrc.config
52 echo "mount $vtDud failed" >> $VTLOG
56 $BUSYBOX_PATH/rmmod isofs
>> $VTLOG 2>&1
57 $BUSYBOX_PATH/rmmod squashfs
>> $VTLOG 2>&1
58 $BUSYBOX_PATH/rmmod loop
>> $VTLOG 2>&1
62 #echo "Exec: /bin/sh $VTOY_PATH/hook/suse/cdrom-hook.sh" >> /info-ventoy
63 #echo "install: hd:/?device=/dev/mapper/ventoy" >> /info-ventoy
64 #$SED "1 iinfo: file:/info-ventoy" -i /linuxrc.config
66 if [ -e /etc
/initrd.functions
] && $GREP -q 'HPIP' /etc
/initrd.functions
; then
68 $BUSYBOX_PATH/mkdir /dev
69 $BUSYBOX_PATH/mknod
-m 660 /dev
/console c
5 1
70 $SED "/CD_DEVICES=/a $BUSYBOX_PATH/sh $VTOY_PATH/hook/suse/disk_hook.sh" -i /etc
/initrd.functions
71 $SED "/CD_DEVICES=/a CD_DEVICES=\"/dev/ventoy \$CD_DEVICES\"" -i /etc
/initrd.functions
72 elif [ -f /scripts
/udev_setup
]; then
73 echo "udev_setup" >> $VTLOG
74 echo "/ventoy/busybox/sh /ventoy/hook/suse/udev_setup_hook.sh" >> /scripts
/udev_setup
77 ventoy_systemd_udevd_work_around
78 ventoy_add_udev_rule
"$VTOY_PATH/hook/suse/udev_disk_hook.sh %k"