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
0f8478fb
Commit
0f8478fb
authored
Jul 22, 2020
by
longpanda
Browse files
update for new release
parent
a6d3ecc7
Changes
433
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
515 additions
and
30 deletions
+515
-30
DOC/BuildVentoyFromSource.txt
DOC/BuildVentoyFromSource.txt
+7
-0
GRUB2/MOD_SRC/grub-2.04/grub-core/normal/context.c
GRUB2/MOD_SRC/grub-2.04/grub-core/normal/context.c
+1
-1
GRUB2/MOD_SRC/grub-2.04/grub-core/normal/menu.c
GRUB2/MOD_SRC/grub-2.04/grub-core/normal/menu.c
+10
-6
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy.c
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy.c
+1
-4
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h
+10
-0
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_linux.c
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_linux.c
+47
-8
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_plugin.c
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_plugin.c
+108
-0
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_windows.c
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_windows.c
+11
-0
GRUB2/MOD_SRC/grub-2.04/include/grub/ventoy.h
GRUB2/MOD_SRC/grub-2.04/include/grub/ventoy.h
+2
-1
GRUB2/MOD_SRC/grub-2.04/install.sh
GRUB2/MOD_SRC/grub-2.04/install.sh
+21
-8
IMG/cpio/ventoy/hook/debian/linuxconsole-disk.sh
IMG/cpio/ventoy/hook/debian/linuxconsole-disk.sh
+71
-0
IMG/cpio/ventoy/hook/debian/linuxconsole-hook.sh
IMG/cpio/ventoy/hook/debian/linuxconsole-hook.sh
+23
-0
IMG/cpio/ventoy/hook/debian/udev_disk_hook.sh
IMG/cpio/ventoy/hook/debian/udev_disk_hook.sh
+1
-1
IMG/cpio/ventoy/hook/debian/ventoy-hook.sh
IMG/cpio/ventoy/hook/debian/ventoy-hook.sh
+4
-0
IMG/cpio/ventoy/hook/vine/dev-listen.sh
IMG/cpio/ventoy/hook/vine/dev-listen.sh
+63
-0
IMG/cpio/ventoy/hook/vine/udev_disk_hook.sh
IMG/cpio/ventoy/hook/vine/udev_disk_hook.sh
+79
-0
IMG/cpio/ventoy/hook/vine/ventoy-hook.sh
IMG/cpio/ventoy/hook/vine/ventoy-hook.sh
+28
-0
IMG/cpio/ventoy/init
IMG/cpio/ventoy/init
+24
-1
IMG/cpio/ventoy/ventoy.sh
IMG/cpio/ventoy/ventoy.sh
+4
-0
INSTALL/EFI/BOOT/grubx64_real.efi
INSTALL/EFI/BOOT/grubx64_real.efi
+0
-0
No files found.
DOC/BuildVentoyFromSource.txt
View file @
0f8478fb
...
...
@@ -202,3 +202,10 @@
https://busybox.net/downloads/binaries/1.31.0-i686-uclibc/ busybox_ASH
SHA-256: 2943f02f85fee0c9551aec47110a558a73f919c032b3c51e56d6f197b5ec4d7b
5.12 7za.exe
download from https://www.7-zip.org/a/7z1900-extra.7z
ISNTALL/ventoy/7z/64/7za.exe SHA-256: 8117e40ee7f824f63373a4f5625bb62749f69159d0c449b3ce2f35aad3b83549
ISNTALL/ventoy/7z/32/7za.exe SHA-256: ea308c76a2f927b160a143d94072b0dce232e04b751f0c6432a94e05164e716d
GRUB2/MOD_SRC/grub-2.04/grub-core/normal/context.c
View file @
0f8478fb
...
...
@@ -99,7 +99,7 @@ grub_env_new_context (int export_all)
grub_err_t
grub_env_context_open
(
void
)
{
return
grub_env_new_context
(
1
);
return
grub_env_new_context
(
grub_env_get
(
"ventoy_new_context"
)
?
0
:
1
);
}
int
grub_extractor_level
=
0
;
...
...
GRUB2/MOD_SRC/grub-2.04/grub-core/normal/menu.c
View file @
0f8478fb
...
...
@@ -853,12 +853,16 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot)
}
break
;
case
GRUB_TERM_KEY_F6
:
cmdstr
=
grub_env_get
(
"VTOY_F6_CMD"
);
if
(
cmdstr
)
{
menu_fini
();
grub_script_execute_sourcecode
(
cmdstr
);
goto
refresh
;
if
(
0
==
g_ventoy_fn_mutex
)
{
cmdstr
=
grub_env_get
(
"VTOY_F6_CMD"
);
if
(
cmdstr
)
{
menu_fini
();
g_ventoy_fn_mutex
=
1
;
grub_script_execute_sourcecode
(
cmdstr
);
g_ventoy_fn_mutex
=
0
;
goto
refresh
;
}
}
break
;
case
GRUB_TERM_KEY_F7
:
...
...
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy.c
View file @
0f8478fb
...
...
@@ -2167,7 +2167,7 @@ static grub_err_t ventoy_cmd_find_bootable_hdd(grub_extcmd_context_t ctxt, int a
return
grub_error
(
GRUB_ERR_BAD_ARGUMENT
,
"Usage: %s variable
\n
"
,
cmd_raw_name
);
}
isopath
=
grub_env_get
(
"iso_pat
h
"
);
isopath
=
grub_env_get
(
"
vtoy_
iso_pa
r
t"
);
if
(
!
isopath
)
{
debug
(
"isopath is null %p
\n
"
,
isopath
);
...
...
@@ -2321,9 +2321,6 @@ static int ventoy_env_init(void)
char
buf
[
64
];
grub_env_set
(
"vtdebug_flag"
,
""
);
grub_env_export
(
"vtdebug_flag"
);
g_tree_script_buf
=
grub_malloc
(
VTOY_MAX_SCRIPT_BUF
);
g_list_script_buf
=
grub_malloc
(
VTOY_MAX_SCRIPT_BUF
);
...
...
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h
View file @
0f8478fb
...
...
@@ -649,6 +649,15 @@ typedef struct menu_class
struct
menu_class
*
next
;
}
menu_class
;
typedef
struct
injection_config
{
int
pathlen
;
char
isopath
[
256
];
char
archive
[
256
];
struct
injection_config
*
next
;
}
injection_config
;
extern
int
g_ventoy_menu_esc
;
extern
int
g_ventoy_suppress_esc
;
extern
int
g_ventoy_last_entry
;
...
...
@@ -666,6 +675,7 @@ persistence_config * ventoy_plugin_find_persistent(const char *isopath);
void
ventoy_plugin_dump_auto_install
(
void
);
int
ventoy_fill_windows_rtdata
(
void
*
buf
,
char
*
isopath
);
int
ventoy_plugin_get_persistent_chunklist
(
const
char
*
isopath
,
int
index
,
ventoy_img_chunk_list
*
chunk_list
);
const
char
*
ventoy_plugin_get_injection
(
const
char
*
isopath
);
const
char
*
ventoy_plugin_get_menu_alias
(
int
type
,
const
char
*
isopath
);
const
char
*
ventoy_plugin_get_menu_class
(
int
type
,
const
char
*
name
);
int
ventoy_get_block_list
(
grub_file_t
file
,
ventoy_img_chunk_list
*
chunklist
,
grub_disk_addr_t
start
);
...
...
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_linux.c
View file @
0f8478fb
...
...
@@ -909,6 +909,8 @@ grub_err_t ventoy_cmd_load_cpio(grub_extcmd_context_t ctxt, int argc, char **arg
char
*
template_file
=
NULL
;
char
*
template_buf
=
NULL
;
char
*
persistent_buf
=
NULL
;
char
*
injection_buf
=
NULL
;
const
char
*
injection_file
=
NULL
;
grub_uint8_t
*
buf
=
NULL
;
grub_uint32_t
mod
;
grub_uint32_t
headlen
;
...
...
@@ -917,8 +919,9 @@ grub_err_t ventoy_cmd_load_cpio(grub_extcmd_context_t ctxt, int argc, char **arg
grub_uint32_t
img_chunk_size
;
grub_uint32_t
template_size
=
0
;
grub_uint32_t
persistent_size
=
0
;
grub_uint32_t
injection_size
=
0
;
grub_file_t
file
;
grub_file_t
script
file
;
grub_file_t
tmp
file
;
ventoy_img_chunk_list
chunk_list
;
(
void
)
ctxt
;
...
...
@@ -960,18 +963,18 @@ grub_err_t ventoy_cmd_load_cpio(grub_extcmd_context_t ctxt, int argc, char **arg
if
(
template_file
)
{
debug
(
"auto install template: <%s>
\n
"
,
template_file
);
script
file
=
ventoy_grub_file_open
(
VENTOY_FILE_TYPE
,
"%s%s"
,
args
[
2
],
template_file
);
if
(
script
file
)
tmp
file
=
ventoy_grub_file_open
(
VENTOY_FILE_TYPE
,
"%s%s"
,
args
[
2
],
template_file
);
if
(
tmp
file
)
{
debug
(
"auto install script size %d
\n
"
,
(
int
)
script
file
->
size
);
template_size
=
script
file
->
size
;
debug
(
"auto install script size %d
\n
"
,
(
int
)
tmp
file
->
size
);
template_size
=
tmp
file
->
size
;
template_buf
=
grub_malloc
(
template_size
);
if
(
template_buf
)
{
grub_file_read
(
script
file
,
template_buf
,
template_size
);
grub_file_read
(
tmp
file
,
template_buf
,
template_size
);
}
grub_file_close
(
script
file
);
grub_file_close
(
tmp
file
);
}
else
{
...
...
@@ -983,7 +986,34 @@ grub_err_t ventoy_cmd_load_cpio(grub_extcmd_context_t ctxt, int argc, char **arg
debug
(
"auto install script skipped or not configed %s
\n
"
,
args
[
1
]);
}
g_ventoy_cpio_buf
=
grub_malloc
(
file
->
size
+
4096
+
template_size
+
persistent_size
+
img_chunk_size
);
injection_file
=
ventoy_plugin_get_injection
(
args
[
1
]);
if
(
injection_file
)
{
debug
(
"injection archive: <%s>
\n
"
,
injection_file
);
tmpfile
=
ventoy_grub_file_open
(
VENTOY_FILE_TYPE
,
"%s%s"
,
args
[
2
],
injection_file
);
if
(
tmpfile
)
{
debug
(
"injection archive size:%d
\n
"
,
(
int
)
tmpfile
->
size
);
injection_size
=
tmpfile
->
size
;
injection_buf
=
grub_malloc
(
injection_size
);
if
(
injection_buf
)
{
grub_file_read
(
tmpfile
,
injection_buf
,
injection_size
);
}
grub_file_close
(
tmpfile
);
}
else
{
debug
(
"Failed to open injection archive %s%s
\n
"
,
args
[
2
],
injection_file
);
}
}
else
{
debug
(
"injection not configed %s
\n
"
,
args
[
1
]);
}
g_ventoy_cpio_buf
=
grub_malloc
(
file
->
size
+
4096
+
template_size
+
persistent_size
+
injection_size
+
img_chunk_size
);
if
(
NULL
==
g_ventoy_cpio_buf
)
{
grub_file_close
(
file
);
...
...
@@ -1020,6 +1050,15 @@ grub_err_t ventoy_cmd_load_cpio(grub_extcmd_context_t ctxt, int argc, char **arg
persistent_buf
=
NULL
;
}
if
(
injection_size
>
0
&&
injection_buf
)
{
headlen
=
ventoy_cpio_newc_fill_head
(
buf
,
injection_size
,
injection_buf
,
"ventoy/ventoy_injection"
);
buf
+=
headlen
+
ventoy_align
(
injection_size
,
4
);
grub_free
(
injection_buf
);
injection_buf
=
NULL
;
}
/* step2: insert os param to cpio */
headlen
=
ventoy_cpio_newc_fill_head
(
buf
,
0
,
NULL
,
"ventoy/ventoy_os_param"
);
padlen
=
sizeof
(
ventoy_os_param
);
...
...
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_plugin.c
View file @
0f8478fb
...
...
@@ -44,6 +44,7 @@ static install_template *g_install_template_head = NULL;
static
persistence_config
*
g_persistence_head
=
NULL
;
static
menu_alias
*
g_menu_alias_head
=
NULL
;
static
menu_class
*
g_menu_class_head
=
NULL
;
static
injection_config
*
g_injection_head
=
NULL
;
static
int
ventoy_plugin_control_check
(
VTOY_JSON
*
json
,
const
char
*
isodisk
)
{
...
...
@@ -805,6 +806,96 @@ static int ventoy_plugin_menualias_entry(VTOY_JSON *json, const char *isodisk)
return
0
;
}
static
int
ventoy_plugin_injection_check
(
VTOY_JSON
*
json
,
const
char
*
isodisk
)
{
const
char
*
path
=
NULL
;
const
char
*
archive
=
NULL
;
VTOY_JSON
*
pNode
=
NULL
;
(
void
)
isodisk
;
if
(
json
->
enDataType
!=
JSON_TYPE_ARRAY
)
{
grub_printf
(
"Not array %d
\n
"
,
json
->
enDataType
);
return
0
;
}
for
(
pNode
=
json
->
pstChild
;
pNode
;
pNode
=
pNode
->
pstNext
)
{
path
=
vtoy_json_get_string_ex
(
pNode
->
pstChild
,
"image"
);
if
(
!
path
)
{
grub_printf
(
"image not found
\n
"
);
continue
;
}
archive
=
vtoy_json_get_string_ex
(
pNode
->
pstChild
,
"archive"
);
if
(
!
archive
)
{
grub_printf
(
"archive not found
\n
"
);
continue
;
}
grub_printf
(
"image: <%s> [%s]
\n
"
,
path
,
ventoy_check_file_exist
(
"%s%s"
,
isodisk
,
path
)
?
"OK"
:
"NOT EXIST"
);
grub_printf
(
"archive: <%s> [%s]
\n\n
"
,
archive
,
ventoy_check_file_exist
(
"%s%s"
,
isodisk
,
archive
)
?
"OK"
:
"NOT EXIST"
);
}
return
0
;
}
static
int
ventoy_plugin_injection_entry
(
VTOY_JSON
*
json
,
const
char
*
isodisk
)
{
const
char
*
path
=
NULL
;
const
char
*
archive
=
NULL
;
VTOY_JSON
*
pNode
=
NULL
;
injection_config
*
node
=
NULL
;
injection_config
*
next
=
NULL
;
(
void
)
isodisk
;
if
(
json
->
enDataType
!=
JSON_TYPE_ARRAY
)
{
debug
(
"Not array %d
\n
"
,
json
->
enDataType
);
return
0
;
}
if
(
g_injection_head
)
{
for
(
node
=
g_injection_head
;
node
;
node
=
next
)
{
next
=
node
->
next
;
grub_free
(
node
);
}
g_injection_head
=
NULL
;
}
for
(
pNode
=
json
->
pstChild
;
pNode
;
pNode
=
pNode
->
pstNext
)
{
path
=
vtoy_json_get_string_ex
(
pNode
->
pstChild
,
"image"
);
archive
=
vtoy_json_get_string_ex
(
pNode
->
pstChild
,
"archive"
);
if
(
path
&&
path
[
0
]
==
'/'
&&
archive
&&
archive
[
0
]
==
'/'
)
{
node
=
grub_zalloc
(
sizeof
(
injection_config
));
if
(
node
)
{
node
->
pathlen
=
grub_snprintf
(
node
->
isopath
,
sizeof
(
node
->
isopath
),
"%s"
,
path
);
grub_snprintf
(
node
->
archive
,
sizeof
(
node
->
archive
),
"%s"
,
archive
);
if
(
g_injection_head
)
{
node
->
next
=
g_injection_head
;
}
g_injection_head
=
node
;
}
}
}
return
0
;
}
static
int
ventoy_plugin_menuclass_entry
(
VTOY_JSON
*
json
,
const
char
*
isodisk
)
{
int
type
;
...
...
@@ -914,6 +1005,7 @@ static plugin_entry g_plugin_entries[] =
{
"persistence"
,
ventoy_plugin_persistence_entry
,
ventoy_plugin_persistence_check
},
{
"menu_alias"
,
ventoy_plugin_menualias_entry
,
ventoy_plugin_menualias_check
},
{
"menu_class"
,
ventoy_plugin_menuclass_entry
,
ventoy_plugin_menuclass_check
},
{
"injection"
,
ventoy_plugin_injection_entry
,
ventoy_plugin_injection_check
},
};
static
int
ventoy_parse_plugin_config
(
VTOY_JSON
*
json
,
const
char
*
isodisk
)
...
...
@@ -1151,6 +1243,22 @@ end:
return
rc
;
}
const
char
*
ventoy_plugin_get_injection
(
const
char
*
isopath
)
{
injection_config
*
node
=
NULL
;
int
len
=
(
int
)
grub_strlen
(
isopath
);
for
(
node
=
g_injection_head
;
node
;
node
=
node
->
next
)
{
if
(
node
->
pathlen
==
len
&&
grub_strcmp
(
node
->
isopath
,
isopath
)
==
0
)
{
return
node
->
archive
;
}
}
return
NULL
;
}
const
char
*
ventoy_plugin_get_menu_alias
(
int
type
,
const
char
*
isopath
)
{
menu_alias
*
node
=
NULL
;
...
...
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_windows.c
View file @
0f8478fb
...
...
@@ -722,6 +722,17 @@ int ventoy_fill_windows_rtdata(void *buf, char *isopath)
{
debug
(
"auto install script skipped or not configed %s
\n
"
,
pos
);
}
script
=
(
char
*
)
ventoy_plugin_get_injection
(
pos
);
if
(
script
)
{
debug
(
"injection archive <%s>
\n
"
,
script
);
grub_snprintf
(
data
->
injection_archive
,
sizeof
(
data
->
injection_archive
)
-
1
,
"%s"
,
script
);
}
else
{
debug
(
"injection archive not configed %s
\n
"
,
pos
);
}
return
0
;
}
...
...
GRUB2/MOD_SRC/grub-2.04/include/grub/ventoy.h
View file @
0f8478fb
...
...
@@ -132,7 +132,8 @@ typedef struct ventoy_os_param
typedef
struct
ventoy_windows_data
{
char
auto_install_script
[
384
];
grub_uint8_t
reserved
[
128
];
char
injection_archive
[
384
];
grub_uint8_t
reserved
[
256
];
}
ventoy_windows_data
;
...
...
GRUB2/MOD_SRC/grub-2.04/install.sh
View file @
0f8478fb
...
...
@@ -20,10 +20,10 @@ all_modules_uefi="blocklist ventoy test search at_keyboard usb_keyboard gcry_md
all_extra_modules
=
"elf macho offsetio regexp file"
if
[
"
$1
"
=
"uefi"
]
;
then
all_modules
=
"
$net_modules_uefi
$all_modules_uefi
$all_extra_modules
"
all_modules
=
"
$net_modules_uefi
$all_modules_uefi
$all_extra_modules
"
grub-mkimage
-v
--directory
"
$VT_DIR
/GRUB2/INSTALL/lib/grub/x86_64-efi"
--prefix
'(,2)/grub'
--output
"
$VT_DIR
/INSTALL/EFI/BOOT/grubx64_real.efi"
--format
'x86_64-efi'
--compression
'auto'
$all_modules_uefi
'fat'
'part_msdos'
else
all_modules
=
"
$net_modules_legacy
$all_modules_legacy
"
all_modules
=
"
$net_modules_legacy
$all_modules_legacy
"
grub-mkimage
-v
--directory
"
$VT_DIR
/GRUB2/INSTALL/lib/grub/i386-pc"
--prefix
'(,2)/grub'
--output
"
$VT_DIR
/INSTALL/grub/i386-pc/core.img"
--format
'i386-pc'
--compression
'auto'
$all_modules_legacy
'fat'
'part_msdos'
'biosdisk'
fi
...
...
@@ -34,16 +34,29 @@ if [ "$1" = "uefi" ]; then
cp
-a
$VT_DIR
/GRUB2/PXE/grub2/x86_64-efi/core.efi
$VT_DIR
/GRUB2/NBP/core.efi
||
exit
1
rm
-f
$VT_DIR
/INSTALL/grub/x86_64-efi/normal.mod
cp
-a
$VT_DIR
/GRUB2/PXE/grub2/x86_64-efi/normal.mod
$VT_DIR
/INSTALL/grub/x86_64-efi/normal.mod
||
exit
1
cp
-a
$VT_DIR
/GRUB2/PXE/grub2/x86_64-efi/normal.mod
$VT_DIR
/INSTALL/grub/x86_64-efi/normal.mod
||
exit
1
#copy other modules
ls
-1
$VT_DIR
/GRUB2/INSTALL/lib/grub/x86_64-efi/ | egrep
'\.(lst|mod)$'
|
while
read
line
;
do
if
!
echo
$all_modules
|
grep
-q
"
${
line
%.mod
}
"
;
then
echo
"Copy
$line
..."
rm
-f
$VT_DIR
/INSTALL/grub/x86_64-efi/
$line
cp
-a
$VT_DIR
/GRUB2/INSTALL/lib/grub/x86_64-efi/
$line
$VT_DIR
/INSTALL/grub/x86_64-efi/
fi
done
else
rm
-f
$VT_DIR
/GRUB2/NBP/core.0
cp
-a
$VT_DIR
/GRUB2/PXE/grub2/i386-pc/core.0
$VT_DIR
/GRUB2/NBP/core.0
||
exit
1
for
md
in
$all_extra_modules
;
do
rm
-f
$VT_DIR
/INSTALL/grub/i386-pc/
${
md
}
.mod
cp
-a
$VT_DIR
/GRUB2/INSTALL/lib/grub/i386-pc/
${
md
}
.mod
$VT_DIR
/INSTALL/grub/i386-pc/
done
rm
-f
$VT_DIR
/INSTALL/grub/i386-pc/boot.img
cp
-a
$VT_DIR
/GRUB2/INSTALL/lib/grub/i386-pc/boot.img
$VT_DIR
/INSTALL/grub/i386-pc/boot.img
||
exit
1
#copy other modules
ls
-1
$VT_DIR
/GRUB2/INSTALL/lib/grub/i386-pc/ | egrep
'\.(lst|mod)$'
|
while
read
line
;
do
if
!
echo
$all_modules
|
grep
-q
"
${
line
%.mod
}
"
;
then
echo
"Copy
$line
..."
rm
-f
$VT_DIR
/INSTALL/grub/i386-pc/
$line
cp
-a
$VT_DIR
/GRUB2/INSTALL/lib/grub/i386-pc/
$line
$VT_DIR
/INSTALL/grub/i386-pc/
fi
done
fi
IMG/cpio/ventoy/hook/debian/linuxconsole-disk.sh
0 → 100644
View file @
0f8478fb
#!/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
"#######
$0
$*
########"
VTPATH_OLD
=
$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
vtoydm
-i
-f
$VTOY_PATH
/ventoy_image_map
-d
$vtdiskname
>
$VTOY_PATH
/iso_file_list
vtline
=
$(
grep
'[-][-] drivers-.*\.squashfs'
$VTOY_PATH
/iso_file_list
)
sector
=
$(
echo
$vtline
|
awk
'{print $(NF-1)}'
)
length
=
$(
echo
$vtline
|
awk
'{print $NF}'
)
vtoydm
-e
-f
$VTOY_PATH
/ventoy_image_map
-d
$vtdiskname
-s
$sector
-l
$length
-o
$VTOY_PATH
/driver.squashfs
mount
-t
squashfs
$VTOY_PATH
/driver.squashfs /lib/modules
modprobe dm-mod
umount /lib/modules
rm
-f
$VTOY_PATH
/driver.squashfs
ventoy_udev_disk_common_hook
"
${
vtdiskname
#/dev/
}
2"
"noreplace"
blkdev_num
=
$(
$VTOY_PATH
/tool/dmsetup
ls
|
grep
ventoy |
sed
's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1:\2/'
)
blkdev_dev
=
$(
$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
!
[
-b
/dev/
$vtDM
]
;
then
mknod
-m
0660 /dev/
$vtDM
b
$blkdev_dev
fi
if
mount /dev/
$vtDM
/media/ydfs
;
then
vtlog
"mount success"
else
vtlog
"mount failed"
fi
PATH
=
$VTPATH_OLD
set_ventoy_hook_finish
IMG/cpio/ventoy/hook/debian/linuxconsole-hook.sh
0 → 100644
View file @
0f8478fb
#!/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/>.
#
#************************************************************************************
$SED
"s#/busybox/bin/sleep 2#/busybox/bin/sleep 10#"
-i
/etc/init.d/tty1
$SED
"/install *-d *.media.ydfs/a return"
-i
/ydfs/detect/media
$SED
"/install *-d *.media.ydfs/a
$BUSYBOX_PATH
/sh
$VTOY_PATH
/hook/debian/linuxconsole-disk.sh"
-i
/ydfs/detect/media
IMG/cpio/ventoy/hook/debian/udev_disk_hook.sh
View file @
0f8478fb
...
...
@@ -50,7 +50,7 @@ ventoy_os_install_dmsetup() {
if
$GREP
-q
'device-mapper'
/proc/devices
;
then
vtlog
"device mapper module is loaded"
else
vtlog
"device mapper module is NOT loaded, now load it..."
vtlog
"device mapper module is NOT loaded, now load it..."
VER
=
$(
$BUSYBOX_PATH
/uname
-r
)
KO
=
$(
$FIND
/lib/modules/
$VER
/kernel/drivers/md
-name
"dm-mod*"
)
...
...
IMG/cpio/ventoy/hook/debian/ventoy-hook.sh
View file @
0f8478fb
...
...
@@ -60,6 +60,10 @@ ventoy_get_debian_distro() {
echo
'porteus'
;
return
fi
if
$GREP
-q
'linuxconsole'
/proc/version
;
then
echo
'linuxconsole'
;
return
fi
echo
'default'
}
...
...
IMG/cpio/ventoy/hook/vine/dev-listen.sh
0 → 100644
View file @
0f8478fb
#!/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
while
[
-n
"1"
]
;
do
if
[
-e
/dev/null
]
;
then
break
else
$SLEEP
0.5
fi
done
while
[
-n
"1"
]
;
do
if
[
-e
/sys/block
]
;
then
break
else
$SLEEP
0.5
fi
done
while
[
-n
"Y"
]
;
do
vtdiskname
=
$(
get_ventoy_disk_name
)
if
[
"
$vtdiskname
"
!=
"unknown"
]
;
then
break
else
$SLEEP
0.5
fi
done
vtshortdev
=
${
vtdiskname
#/dev/
}
if
!
[
-b
$vtdiskname
]
;
then
blkdev
=
$(
$CAT
/sys/class/block/
$vtshortdev
/dev |
$SED
's/:/ /g'
)
$BUSYBOX_PATH
/mknod
-m
0660
$vtdiskname
b
$blkdev
fi
if
!
[
-b
"
${
vtdiskname
}
2"
]
;
then
blkdev
=
$(
$CAT
/sys/class/block/
${
vtshortdev
}
2/dev |
$SED
's/:/ /g'
)
$BUSYBOX_PATH
/mknod
-m
0660
"
${
vtdiskname
}
2"
b
$blkdev
fi
$BUSYBOX_PATH
/ls /dev/
>
/dev/console
$BUSYBOX_PATH
/sh
$VTOY_PATH
/hook/vine/udev_disk_hook.sh
"
${
vtdiskname
#/dev/
}
2"
IMG/cpio/ventoy/hook/vine/udev_disk_hook.sh
0 → 100644
View file @
0f8478fb
#!/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
vtCheatLoop
=
loop6
ventoy_os_install_dmsetup
()
{
vtlog
"ventoy_os_install_dmsetup
$1
"
vt_usb_disk
=
$1
# dump iso file location
$VTOY_PATH
/tool/vtoydm
-i
-f
$VTOY_PATH
/ventoy_image_map
-d
${
vt_usb_disk
}
>
$VTOY_PATH
/iso_file_list
# install dmsetup
LINE
=
$(
$GREP
'kernel-[0-9].*\.rpm'
$VTOY_PATH
/iso_file_list
)
if
[
$?
-eq
0
]
;
then
install_rpm_from_line
"
$LINE
"
${
vt_usb_disk
}
fi
$BUSYBOX_PATH
/modprobe dm-mod
vtlog
"dmsetup install finish, now check it..."
dmsetup_path
=
/ventoy/tool/dmsetup
if
[
-z
"
$dmsetup_path
"
]
;
then
vterr
"dmsetup still not found after install"
elif
$dmsetup_path
info
>>
$VTLOG
2>&1
;
then
vtlog
"
$dmsetup_path
work ok"
else
vterr
"
$dmsetup_path
not work"
fi
}
if
is_ventoy_hook_finished
||
not_ventoy_disk
"
${
1
:0:-1
}
"
;
then
# /dev/vtCheatLoop come first
if
[
"
$1
"
=
"
$vtCheatLoop
"
]
&&
[
-b
$VTOY_DM_PATH
]
;
then
ventoy_copy_device_mapper /dev/
$vtCheatLoop
fi
exit
0
fi
ventoy_os_install_dmsetup
"/dev/
${
1
:0:-1
}
"
ventoy_udev_disk_common_hook
$*
"noreplace"
$BUSYBOX_PATH
/mount
$VTOY_DM_PATH
/mnt/ventoy
#
# We do a trick for rhel6 series here.
# Use /dev/$vtCheatLoop and wapper it as a removable cdrom with bind mount.
# Then the anaconda installer will accept /dev/$vtCheatLoop as the install medium.
#
ventoy_copy_device_mapper /dev/
$vtCheatLoop
$BUSYBOX_PATH
/cp
-a
/sys/devices/virtual/block/
$vtCheatLoop
/tmp/
>>
$VTLOG
2>&1
echo
19
>
/tmp/
$vtCheatLoop
/capability
$BUSYBOX_PATH
/mount
--bind
/tmp/
$vtCheatLoop
/sys/block/
$vtCheatLoop
>>
$VTLOG
2>&1
# OK finish
set_ventoy_hook_finish
IMG/cpio/ventoy/hook/vine/ventoy-hook.sh
0 → 100644
View file @
0f8478fb
#!/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/>.
#
#************************************************************************************
.
$VTOY_PATH
/hook/ventoy-os-lib.sh
$BUSYBOX_PATH
/mkdir
-p
/etc/anaconda.repos.d /mnt/ventoy
ventoy_print_yum_repo
"ventoy"
"file:///mnt/ventoy"
>
/etc/anaconda.repos.d/ventoy.repo
$BUSYBOX_PATH
/mknod
-m
0660 /dev/null c 1 3
$VTOY_PATH
/hook/vine/dev-listen.sh &
IMG/cpio/ventoy/init
View file @
0f8478fb
...
...
@@ -183,7 +183,30 @@ fi
####################################################################
# #
# Step 3 : Hand over to ventoy.sh #
# Step 3 : Extract injection archive #
# #
####################################################################
if
[
-e
$VTOY_PATH
/ventoy_injection
]
;
then
echo
"decompress injection ..."
>>
$VTLOG
vtmagic
=
$(
hexdump
-n
2
-e
'2/1 "%02X"'
$VTOY_PATH
/ventoy_injection
)
echo
"vtmagic=
$vtmagic
..."
>>
$VTLOG
if
[
"1F8B"
=
"vtmagic"
]
||
[
"1F9E"
=
"vtmagic"
]
;
then
zcat
$VTOY_PATH
/ventoy_injection |
tar
-xf
-C
/
elif
[
"425A"
=
"vtmagic"
]
;
then
bzcat
$VTOY_PATH
/ventoy_injection |
tar
-xf
-C
/
elif
[
"FD37"
=
"vtmagic"
]
;
then
xzcat
$VTOY_PATH
/ventoy_injection |
tar
-xf
-C
/
else
unzip
-o
-q
$VTOY_PATH
/ventoy_injection
-d
/
fi
fi
####################################################################
# #
# Step 4 : Hand over to ventoy.sh #
# #
####################################################################
echo
"Now hand over to ventoy.sh"
>>
$VTLOG
...
...
IMG/cpio/ventoy/ventoy.sh
View file @
0f8478fb
...
...
@@ -221,6 +221,9 @@ ventoy_get_os_type() {
echo
'kwort'
;
return
fi
if
$GREP
-q
'iwamoto'
/proc/version
;
then
echo
'vine'
;
return
fi
echo
"default"
}
...
...
@@ -248,6 +251,7 @@ if [ "$VTOY_BREAK_LEVEL" = "03" ] || [ "$VTOY_BREAK_LEVEL" = "13" ]; then
exec
$BUSYBOX_PATH
/sh
fi
####################################################################
# #
# Step 4 : Hand over to real init #
...
...
INSTALL/EFI/BOOT/grubx64_real.efi
View file @
0f8478fb
No preview for this file type
Prev
1
2
3
4
5
…
22
Next
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