Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
dadigang
Ventoy
Commits
ad9a0310
Commit
ad9a0310
authored
Apr 26, 2020
by
longpanda
Browse files
1.0.08beta1
parent
d5b829f8
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
187 additions
and
71 deletions
+187
-71
IMG/cpio/ventoy/hook/debian/default-hook.sh
IMG/cpio/ventoy/hook/debian/default-hook.sh
+18
-2
IMG/cpio/ventoy/hook/debian/disk_mount_hook.sh
IMG/cpio/ventoy/hook/debian/disk_mount_hook.sh
+1
-10
IMG/cpio/ventoy/hook/debian/udev_disk_hook.sh
IMG/cpio/ventoy/hook/debian/udev_disk_hook.sh
+12
-1
IMG/cpio/ventoy/hook/debian/ventoy-hook.sh
IMG/cpio/ventoy/hook/debian/ventoy-hook.sh
+0
-8
IMG/cpio/ventoy/hook/debian/ventoy-inotifyd-hook.sh
IMG/cpio/ventoy/hook/debian/ventoy-inotifyd-hook.sh
+7
-19
IMG/cpio/ventoy/hook/default/ventoy-inotifyd-start.sh
IMG/cpio/ventoy/hook/default/ventoy-inotifyd-start.sh
+25
-0
IMG/cpio/ventoy/hook/manjaro/ventoy-hook.sh
IMG/cpio/ventoy/hook/manjaro/ventoy-hook.sh
+9
-2
IMG/cpio/ventoy/hook/manjaro/ventoy-inotifyd-hook.sh
IMG/cpio/ventoy/hook/manjaro/ventoy-inotifyd-hook.sh
+46
-0
IMG/cpio/ventoy/hook/rhel7/ventoy-hook.sh
IMG/cpio/ventoy/hook/rhel7/ventoy-hook.sh
+6
-3
IMG/cpio/ventoy/hook/rhel7/ventoy-inotifyd-hook.sh
IMG/cpio/ventoy/hook/rhel7/ventoy-inotifyd-hook.sh
+24
-24
IMG/cpio/ventoy/hook/ventoy-hook-lib.sh
IMG/cpio/ventoy/hook/ventoy-hook-lib.sh
+33
-0
IMG/cpio/ventoy/hook/ventoy-os-lib.sh
IMG/cpio/ventoy/hook/ventoy-os-lib.sh
+4
-0
INSTALL/Ventoy2Disk.exe
INSTALL/Ventoy2Disk.exe
+0
-0
INSTALL/grub/grub.cfg
INSTALL/grub/grub.cfg
+1
-1
INSTALL/ventoy/ventoy.cpio
INSTALL/ventoy/ventoy.cpio
+0
-0
Ventoy2Disk/Ventoy2Disk/Ventoy2Disk.rc
Ventoy2Disk/Ventoy2Disk/Ventoy2Disk.rc
+0
-0
VtoyTool/vtoydump.c
VtoyTool/vtoydump.c
+1
-1
No files found.
IMG/cpio/ventoy/hook/debian/default-hook.sh
View file @
ad9a0310
...
@@ -17,5 +17,21 @@
...
@@ -17,5 +17,21 @@
#
#
#************************************************************************************
#************************************************************************************
ventoy_systemd_udevd_work_around
if
[
-e
/init
]
&&
$GREP
-q
'^mountroot$'
/init
;
then
ventoy_add_udev_rule
"
$VTOY_PATH
/hook/debian/udev_disk_hook.sh %k"
echo
"Here before mountroot ..."
>>
$VTLOG
$SED
"/^mountroot
$/
i
\\
$BUSYBOX_PATH
/sh
$VTOY_PATH
/hook/debian/disk_mount_hook.sh"
-i
/init
$SED
"/^mountroot
$/
i
\\
export LIVEMEDIA=/dev/mapper/ventoy"
-i
/init
$SED
"/^mountroot
$/
i
\\
export LIVE_MEDIA=/dev/mapper/ventoy"
-i
/init
elif
[
-e
/init
]
&&
$GREP
-q
'/start-udev$'
/init
;
then
echo
"Here use notify ..."
>>
$VTLOG
ventoy_set_inotify_script debian/ventoy-inotifyd-hook.sh
$SED
"/start-udev
$/
i
\\
mount -n -o mode=0755 -t devtmpfs devtmpfs /dev"
-i
/init
$SED
"/start-udev
$/
i
\\
$BUSYBOX_PATH
/sh
$VTOY_PATH
/hook/default/ventoy-inotifyd-start.sh"
-i
/init
else
echo
"Here use udev hook ..."
>>
$VTLOG
ventoy_systemd_udevd_work_around
ventoy_add_udev_rule
"
$VTOY_PATH
/hook/debian/udev_disk_hook.sh %k"
fi
IMG/cpio/ventoy/hook/
rhel7/ventoy-dis
k.sh
→
IMG/cpio/ventoy/hook/
debian/disk_mount_hoo
k.sh
View file @
ad9a0310
...
@@ -19,10 +19,6 @@
...
@@ -19,10 +19,6 @@
.
/ventoy/hook/ventoy-hook-lib.sh
.
/ventoy/hook/ventoy-hook-lib.sh
if
is_ventoy_hook_finished
;
then
exit
0
fi
vtlog
"#######
$0
$*
########"
vtlog
"#######
$0
$*
########"
VTPATH_OLD
=
$PATH
;
PATH
=
$BUSYBOX_PATH
:
$VTOY_PATH
/tool:
$PATH
VTPATH_OLD
=
$PATH
;
PATH
=
$BUSYBOX_PATH
:
$VTOY_PATH
/tool:
$PATH
...
@@ -36,9 +32,4 @@ if [ "$vtdiskname" = "unknown" ]; then
...
@@ -36,9 +32,4 @@ if [ "$vtdiskname" = "unknown" ]; then
exit
0
exit
0
fi
fi
ventoy_udev_disk_common_hook
"
${
vtdiskname
#/dev/
}
2"
$BUSYBOX_PATH
/sh
$VTOY_PATH
/hook/debian/udev_disk_hook.sh
"
${
vtdiskname
#/dev/
}
2"
PATH
=
$VTPATH_OLD
set_ventoy_hook_finish
IMG/cpio/ventoy/hook/debian/udev_disk_hook.sh
View file @
ad9a0310
...
@@ -86,6 +86,10 @@ if [ -z "$dmsetup_path" ]; then
...
@@ -86,6 +86,10 @@ if [ -z "$dmsetup_path" ]; then
ventoy_os_install_dmsetup
"/dev/
${
1
:0:-1
}
"
ventoy_os_install_dmsetup
"/dev/
${
1
:0:-1
}
"
fi
fi
if
!
$GREP
-q
'device-mapper'
/proc/devices
;
then
ventoy_os_install_dmsetup
"/dev/
${
1
:0:-1
}
"
fi
ventoy_udev_disk_common_hook
$*
ventoy_udev_disk_common_hook
$*
#
#
...
@@ -103,7 +107,14 @@ else
...
@@ -103,7 +107,14 @@ else
else
else
vtlog
"No boot param, need to mount"
vtlog
"No boot param, need to mount"
$BUSYBOX_PATH
/mkdir /cdrom
$BUSYBOX_PATH
/mkdir /cdrom
$BUSYBOX_PATH
/mount
-t
iso9660
$VTOY_DM_PATH
/cdrom
if
[
-b
$VTOY_DM_PATH
]
;
then
vtlog
"mount
$VTOY_DM_PATH
..."
$BUSYBOX_PATH
/mount
-t
iso9660
$VTOY_DM_PATH
/cdrom
else
vtlog
"mount /dev/
$1
..."
$BUSYBOX_PATH
/mount
-t
iso9660 /dev/
$1
/cdrom
fi
fi
fi
fi
fi
...
...
IMG/cpio/ventoy/hook/debian/ventoy-hook.sh
View file @
ad9a0310
...
@@ -52,14 +52,6 @@ ventoy_get_debian_distro() {
...
@@ -52,14 +52,6 @@ ventoy_get_debian_distro() {
echo
'pve'
;
return
echo
'pve'
;
return
fi
fi
if
$GREP
-q
'[Dd]eepin'
/proc/version
;
then
echo
'deepin'
;
return
fi
if
$GREP
-q
'[Uu][Oo][Ss] '
/proc/version
;
then
echo
'deepin'
;
return
fi
if
[
-d
/porteus
]
;
then
if
[
-d
/porteus
]
;
then
echo
'porteus'
;
return
echo
'porteus'
;
return
fi
fi
...
...
IMG/cpio/ventoy/hook/debian/
deepin-dis
k.sh
→
IMG/cpio/ventoy/hook/debian/
ventoy-inotifyd-hoo
k.sh
View file @
ad9a0310
...
@@ -19,29 +19,17 @@
...
@@ -19,29 +19,17 @@
.
/ventoy/hook/ventoy-hook-lib.sh
.
/ventoy/hook/ventoy-hook-lib.sh
vtlog
"#######
$0
$*
########"
VTPATH_OLD
=
$PATH
;
PATH
=
$BUSYBOX_PATH
:
$VTOY_PATH
/tool:
$PATH
vtmountpoint
=
$1
if
is_ventoy_hook_finished
;
then
if
is_ventoy_hook_finished
;
then
PATH
=
$VTPATH_OLD
exit
0
exit
0
fi
fi
wait_for_usb_disk_ready
vtlog
"##### INOTIFYD:
$2
/
$3
is created ..."
vtdiskname
=
$(
get_ventoy_disk_name
)
VTPATH_OLD
=
$PATH
;
PATH
=
$BUSYBOX_PATH
:
$VTOY_PATH
/tool:
$PATH
if
[
"
$vtdiskname
"
=
"unknown"
]
;
then
vtlog
"ventoy disk not found"
PATH
=
$VTPATH_OLD
exit
0
fi
ventoy_udev_disk_common_hook
"
${
vtdiskname
#/dev/
}
2"
$BUSYBOX_PATH
/mount
-t
iso9660
$VTOY_DM_PATH
$vtmountpoint
if
is_inotify_ventoy_part
$3
;
then
vtlog
"find ventoy partition
$3
..."
$BUSYBOX_PATH
/sh
$VTOY_PATH
/hook/debian/udev_disk_hook.sh
"
$3
"
fi
# OK finish
PATH
=
$VTPATH_OLD
set_ventoy_hook_finish
IMG/cpio/ventoy/hook/default/ventoy-inotifyd-start.sh
0 → 100644
View file @
ad9a0310
#!/ventoy/busybox/sh
#************************************************************************************
# Copyright (c) 2020, longpanda <admin@ventoy.net>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
#************************************************************************************
.
/ventoy/hook/ventoy-hook-lib.sh
vtHook
=
$(
$CAT
$VTOY_PATH
/inotifyd-hook-script.txt
)
vtlog
"... start inotifyd listen
$vtHook
..."
$BUSYBOX_PATH
/nohup
$VTOY_PATH
/tool/inotifyd
$vtHook
/dev:n 2>&- &
IMG/cpio/ventoy/hook/manjaro/ventoy-hook.sh
View file @
ad9a0310
...
@@ -28,6 +28,13 @@ else
...
@@ -28,6 +28,13 @@ else
$CAT
$VTOY_PATH
/hook/default/13-dm-disk.rules
>
"
$DISTRO_UDEV_DIR
/13-dm-disk.rules"
$CAT
$VTOY_PATH
/hook/default/13-dm-disk.rules
>
"
$DISTRO_UDEV_DIR
/13-dm-disk.rules"
fi
fi
ventoy_systemd_udevd_work_around
ventoy_add_udev_rule
"
$VTOY_PATH
/hook/default/udev_disk_hook.sh %k"
if
$GREP
-q
'^mount_setup$'
init
;
then
echo
"Here use notify ..."
>>
$VTLOG
ventoy_set_inotify_script manjaro/ventoy-inotifyd-hook.sh
$SED
"/^mount_setup
$/
a
\\
$BUSYBOX_PATH
/sh
$VTOY_PATH
/hook/default/ventoy-inotifyd-start.sh"
-i
/init
else
ventoy_systemd_udevd_work_around
ventoy_add_udev_rule
"
$VTOY_PATH
/hook/default/udev_disk_hook.sh %k"
fi
IMG/cpio/ventoy/hook/manjaro/ventoy-inotifyd-hook.sh
0 → 100644
View file @
ad9a0310
#!/ventoy/busybox/sh
#************************************************************************************
# Copyright (c) 2020, longpanda <admin@ventoy.net>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
#************************************************************************************
.
/ventoy/hook/ventoy-hook-lib.sh
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
"find ventoy partition
$3
..."
$BUSYBOX_PATH
/sh
$VTOY_PATH
/hook/default/udev_disk_hook.sh
"
$3
"
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
}
)
vtLABEL
=
$(
$BUSYBOX_PATH
/blkid /dev/
$vtDM
|
$AWK
'{print $2}'
|
$SED
's/.*"\(.*\)".*/\1/'
)
vtlog
"blkdev_num=
$blkdev_num
vtDM=
$vtDM
label
$vtLABEL
..."
if
!
[
-d
/dev/disk/by-label
]
;
then
mkdir
-p
/dev/disk/by-label
fi
$BUSYBOX_PATH
/cp
-a
/dev/
$vtDM
/dev/disk/by-label/
$vtLABEL
fi
PATH
=
$VTPATH_OLD
IMG/cpio/ventoy/hook/rhel7/ventoy-hook.sh
View file @
ad9a0310
...
@@ -19,10 +19,13 @@
...
@@ -19,10 +19,13 @@
.
$VTOY_PATH
/hook/ventoy-os-lib.sh
.
$VTOY_PATH
/hook/ventoy-os-lib.sh
ventoy_systemd_udevd_work_around
#
ventoy_systemd_udevd_work_around
ventoy_add_udev_rule
"
$VTOY_PATH
/hook/default/udev_disk_hook.sh %k noreplace"
#
ventoy_add_udev_rule "$VTOY_PATH/hook/default/udev_disk_hook.sh %k noreplace"
#$BUSYBOX_PATH/cp -a $VTOY_PATH/hook/rhel7/ventoy-disk.sh /lib/dracut/hooks/initqueue/01-ventoy-disk.sh
$SED
"s#printf
\(
.*
\)\$
CMDLINE#printf
\1\$
CMDLINE inst.stage2=hd:/dev/dm-0#"
-i
/lib/dracut-lib.sh
ventoy_set_inotify_script rhel7/ventoy-inotifyd-hook.sh
$BUSYBOX_PATH
/cp
-a
$VTOY_PATH
/hook/default/ventoy-inotifyd-start.sh /lib/dracut/hooks/pre-udev/01-ventoy-inotifyd-start.sh
# suppress write protected mount warning
# suppress write protected mount warning
if
[
-e
/usr/sbin/anaconda-diskroot
]
;
then
if
[
-e
/usr/sbin/anaconda-diskroot
]
;
then
...
...
IMG/cpio/ventoy/hook/
debian/deepin
-hook.sh
→
IMG/cpio/ventoy/hook/
rhel7/ventoy-inotifyd
-hook.sh
View file @
ad9a0310
...
@@ -17,31 +17,31 @@
...
@@ -17,31 +17,31 @@
#
#
#************************************************************************************
#************************************************************************************
drop_initramfs_workaround
()
{
.
/ventoy/hook/ventoy-hook-lib.sh
mainfilelist
=
$(
$FIND
/
-name
9990-main.sh
)
echo
"mainfilelist=
$mainfilelist
"
>>
$VTLOG
if
[
-z
"
$mainfilelist
"
]
;
then
return
fi
for
vtfile
in
$mainfilelist
;
do
if
is_ventoy_hook_finished
;
then
vtcnt
=
$(
$GREP
-c
'panic.*Unable to find a medium'
$vtfile
)
exit
0
if
[
$vtcnt
-ne
1
]
;
then
fi
return
fi
done
echo
"direct_hook insert ..."
>>
$VTLOG
for
vtfile
in
$mainfilelist
;
do
$SED
"s#panic.*Unable to find a medium.*#
$BUSYBOX_PATH
/sh
$VTOY_PATH
/hook/debian/deepin-disk.sh
\$
mountpoint; livefs_root=
\$
mountpoint#"
-i
$vtfile
done
}
ventoy_systemd_udevd_work_around
vtlog
"##### INOTIFYD:
$2
/
$3
is created ..."
ventoy_add_udev_rule
"
$VTOY_PATH
/hook/debian/udev_disk_hook.sh %k"
drop_initramfs_workaround
VTPATH_OLD
=
$PATH
;
PATH
=
$BUSYBOX_PATH
:
$VTOY_PATH
/tool:
$PATH
if
is_inotify_ventoy_part
$3
;
then
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
}
)
if
[
"
$vtDM
"
=
"dm-0"
]
;
then
vtlog
"This is dm-0, OK ..."
else
vtlog
"####### This is
$vtDM
####### this is abnormal ..."
ventoy_swap_device /dev/dm-0 /dev/
$vtDM
fi
set_ventoy_hook_finish
fi
PATH
=
$VTPATH_OLD
IMG/cpio/ventoy/hook/ventoy-hook-lib.sh
View file @
ad9a0310
...
@@ -421,4 +421,37 @@ ventoy_udev_disk_common_hook() {
...
@@ -421,4 +421,37 @@ ventoy_udev_disk_common_hook() {
fi
fi
}
}
is_inotify_ventoy_part
()
{
if
echo
$1
|
grep
-q
"2$"
;
then
if
!
[
-e
/sys/block/
$1
]
;
then
if
[
-e
/sys/class/block/
$1
]
;
then
if
[
-e
/dev/
${
1
:0:-1
}
]
;
then
$VTOY_PATH
/tool/vtoydump
-f
$VTOY_PATH
/ventoy_os_param
-c
${
1
:0:-1
}
return
fi
fi
fi
fi
[
"1"
=
"0"
]
}
ventoy_find_dm_id
()
{
for
vt
in
$(
$BUSYBOX_PATH
/ls /sys/block/
)
;
do
if
[
"
${
vt
:0:3
}
"
=
"dm-"
]
;
then
vtMajorMinor
=
$(
$CAT
/sys/block/
$vt
/dev
)
if
[
"
$vtMajorMinor
"
=
"
$1
"
]
;
then
echo
${
vt
}
return
fi
fi
done
echo
'xx'
}
ventoy_swap_device
()
{
mv
$1
$VTOY_PATH
/swap_tmp_dev
mv
$2
$1
mv
$VTOY_PATH
/swap_tmp_dev
$2
}
IMG/cpio/ventoy/hook/ventoy-os-lib.sh
View file @
ad9a0310
...
@@ -101,3 +101,7 @@ ventoy_print_yum_repo() {
...
@@ -101,3 +101,7 @@ ventoy_print_yum_repo() {
echo
"gpgcheck=0"
echo
"gpgcheck=0"
echo
"priority=0"
echo
"priority=0"
}
}
ventoy_set_inotify_script
()
{
echo
$VTOY_PATH
/hook/
$1
>
$VTOY_PATH
/inotifyd-hook-script.txt
}
INSTALL/Ventoy2Disk.exe
View file @
ad9a0310
No preview for this file type
INSTALL/grub/grub.cfg
View file @
ad9a0310
...
@@ -395,7 +395,7 @@ function legacy_iso_memdisk {
...
@@ -395,7 +395,7 @@ function legacy_iso_memdisk {
#############################################################
#############################################################
#############################################################
#############################################################
set VENTOY_VERSION="1.0.0
7
"
set VENTOY_VERSION="1.0.0
8b1
"
#disable timeout
#disable timeout
unset timeout
unset timeout
...
...
INSTALL/ventoy/ventoy.cpio
View file @
ad9a0310
No preview for this file type
Ventoy2Disk/Ventoy2Disk/Ventoy2Disk.rc
View file @
ad9a0310
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
VtoyTool/vtoydump.c
View file @
ad9a0310
...
@@ -448,7 +448,7 @@ static int vtoy_check_device(ventoy_os_param *param, const char *device)
...
@@ -448,7 +448,7 @@ static int vtoy_check_device(ventoy_os_param *param, const char *device)
debug
(
"param->vtoy_disk_size=%llu size=%llu
\n
"
,
debug
(
"param->vtoy_disk_size=%llu size=%llu
\n
"
,
(
unsigned
long
long
)
param
->
vtoy_disk_size
,
(
unsigned
long
long
)
size
);
(
unsigned
long
long
)
param
->
vtoy_disk_size
,
(
unsigned
long
long
)
size
);
if
(
param
->
vtoy_disk_size
==
size
&&
if
(
(
param
->
vtoy_disk_size
==
size
||
param
->
vtoy_disk_size
==
size
+
512
)
&&
memcmp
(
vtguid
,
param
->
vtoy_disk_guid
,
16
)
==
0
)
memcmp
(
vtguid
,
param
->
vtoy_disk_guid
,
16
)
==
0
)
{
{
debug
(
"<%s> is right ventoy disk
\n
"
,
device
);
debug
(
"<%s> is right ventoy disk
\n
"
,
device
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment