]> glassweightruler.freedombox.rocks Git - Ventoy.git/blob - IMG/cpio/ventoy/hook/alt/udev_disk_hook.sh
update languages.ini (#829 #834)
[Ventoy.git] / IMG / cpio / ventoy / hook / alt / udev_disk_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 . /ventoy/hook/ventoy-hook-lib.sh
21
22 if is_ventoy_hook_finished || not_ventoy_disk "${1:0:-1}"; then
23 exit 0
24 fi
25
26 ventoy_udev_disk_common_hook $* "noreplace"
27
28 if ! [ -e $VTOY_DM_PATH ]; then
29 blkdev_num=$($VTOY_PATH/tool/dmsetup ls | grep ventoy | sed 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1 \2/')
30 mknod -m 0666 $VTOY_DM_PATH b $blkdev_num
31 fi
32
33 #
34 # We do a trick for ATL series here.
35 # Use /dev/vtCheatLoop and wapper it as a cdrom with bind mount.
36 # Then the installer will accept /dev/vtCheatLoop as the install medium.
37 #
38 vtCheatLoop=loop6
39 ventoy_copy_device_mapper /dev/$vtCheatLoop
40 $BUSYBOX_PATH/mkdir -p /tmp/$vtCheatLoop/device/
41 echo 5 > /tmp/$vtCheatLoop/device/type
42 $BUSYBOX_PATH/mount --bind /tmp/$vtCheatLoop /sys/block/$vtCheatLoop >> $VTLOG 2>&1
43
44
45 # OK finish
46 set_ventoy_hook_finish
47