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
390eec42
Commit
390eec42
authored
Jan 26, 2021
by
longpanda
Browse files
add image_blacklist plugin option
parent
620bcad3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
5 deletions
+42
-5
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy.c
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy.c
+9
-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
+4
-0
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_plugin.c
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_plugin.c
+9
-1
INSTALL/grub/debug.cfg
INSTALL/grub/debug.cfg
+9
-0
INSTALL/grub/grub.cfg
INSTALL/grub/grub.cfg
+11
-0
No files found.
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy.c
View file @
390eec42
...
...
@@ -1031,7 +1031,7 @@ int ventoy_cmp_img(img_info *img1, img_info *img2)
int
c1
=
0
;
int
c2
=
0
;
if
(
g_plugin_image_list
)
if
(
g_plugin_image_list
==
VENTOY_IMG_WHITE_LIST
)
{
return
(
img1
->
plugin_list_index
-
img2
->
plugin_list_index
);
}
...
...
@@ -1069,7 +1069,7 @@ static int ventoy_cmp_subdir(img_iterator_node *node1, img_iterator_node *node2)
int
c1
=
0
;
int
c2
=
0
;
if
(
g_plugin_image_list
)
if
(
g_plugin_image_list
==
VENTOY_IMG_WHITE_LIST
)
{
return
(
node1
->
plugin_list_index
-
node2
->
plugin_list_index
);
}
...
...
@@ -1173,7 +1173,7 @@ static int ventoy_colect_img_files(const char *filename, const struct grub_dirho
return
0
;
}
if
(
g_plugin_image_list
)
if
(
g_plugin_image_list
==
VENTOY_IMG_WHITE_LIST
)
{
grub_snprintf
(
g_img_swap_tmp_buf
,
sizeof
(
g_img_swap_tmp_buf
),
"%s%s/"
,
node
->
dir
,
filename
);
index
=
ventoy_plugin_get_image_list_index
(
vtoy_class_directory
,
g_img_swap_tmp_buf
);
...
...
@@ -1275,11 +1275,16 @@ static int ventoy_colect_img_files(const char *filename, const struct grub_dirho
{
grub_snprintf
(
g_img_swap_tmp_buf
,
sizeof
(
g_img_swap_tmp_buf
),
"%s%s"
,
node
->
dir
,
filename
);
index
=
ventoy_plugin_get_image_list_index
(
vtoy_class_image_file
,
g_img_swap_tmp_buf
);
if
(
index
==
0
)
if
(
VENTOY_IMG_WHITE_LIST
==
g_plugin_image_list
&&
index
==
0
)
{
debug
(
"File %s not found in image_list plugin config...
\n
"
,
g_img_swap_tmp_buf
);
return
0
;
}
else
if
(
VENTOY_IMG_BLACK_LIST
==
g_plugin_image_list
&&
index
>
0
)
{
debug
(
"File %s found in image_blacklist plugin config...
\n
"
,
g_img_swap_tmp_buf
);
return
0
;
}
}
img
=
grub_zalloc
(
sizeof
(
img_info
));
...
...
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h
View file @
390eec42
...
...
@@ -867,7 +867,11 @@ extern int g_ventoy_iso_uefi_drv;
extern
int
g_ventoy_case_insensitive
;
extern
grub_uint8_t
g_ventoy_chain_type
;
extern
int
g_vhdboot_enable
;
#define VENTOY_IMG_WHITE_LIST 1
#define VENTOY_IMG_BLACK_LIST 2
extern
int
g_plugin_image_list
;
extern
ventoy_gpt_info
*
g_ventoy_part_info
;
extern
grub_uint64_t
g_conf_replace_offset
;
extern
grub_uint64_t
g_svd_replace_offset
;
...
...
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_plugin.c
View file @
390eec42
...
...
@@ -1625,7 +1625,14 @@ static int ventoy_plugin_image_list_entry(VTOY_JSON *json, const char *isodisk)
g_image_list_head
=
NULL
;
}
g_plugin_image_list
=
1
;
if
(
grub_strcmp
(
json
->
pcName
,
"image_blacklist"
)
==
0
)
{
g_plugin_image_list
=
VENTOY_IMG_BLACK_LIST
;
}
else
{
g_plugin_image_list
=
VENTOY_IMG_WHITE_LIST
;
}
for
(
pNode
=
json
->
pstChild
;
pNode
;
pNode
=
pNode
->
pstNext
)
{
...
...
@@ -1693,6 +1700,7 @@ static plugin_entry g_plugin_entries[] =
{
"injection"
,
ventoy_plugin_injection_entry
,
ventoy_plugin_injection_check
},
{
"auto_memdisk"
,
ventoy_plugin_auto_memdisk_entry
,
ventoy_plugin_auto_memdisk_check
},
{
"image_list"
,
ventoy_plugin_image_list_entry
,
ventoy_plugin_image_list_check
},
{
"image_blacklist"
,
ventoy_plugin_image_list_entry
,
ventoy_plugin_image_list_check
},
{
"conf_replace"
,
ventoy_plugin_conf_replace_entry
,
ventoy_plugin_conf_replace_check
},
{
"dud"
,
ventoy_plugin_dud_entry
,
ventoy_plugin_dud_check
},
{
"password"
,
ventoy_plugin_pwd_entry
,
ventoy_plugin_pwd_check
},
...
...
INSTALL/grub/debug.cfg
View file @
390eec42
...
...
@@ -139,6 +139,15 @@ submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json {
unset pager
}
menuentry 'Check image blacklist plugin configuration' --class=debug_imageblacklist {
set pager=1
vt_check_plugin_json $vt_plugin_path image_blacklist $vtoy_iso_part
echo -e "\npress ENTER to exit ..."
read vtInputKey
unset pager
}
menuentry 'Check boot conf replace plugin configuration' --class=debug_bootconf_replace {
set pager=1
vt_check_plugin_json $vt_plugin_path conf_replace $vtoy_iso_part
...
...
INSTALL/grub/grub.cfg
View file @
390eec42
...
...
@@ -1631,6 +1631,17 @@ if [ -n "$VTOY_PLUGIN_SYNTAX_ERROR" ]; then
read vtInputKey
fi
for vtTFile in ventoy.json ventoy_grub.cfg; do
if [ -f $vtoy_efi_part/ventoy/$vtTFile ]; then
clear
echo -e "\n You need to put $vtTFile in the 1st partition which hold the ISO files.\n"
echo -e " $vtTFile 放错分区了,请放到镜像分区里的 ventoy 目录下(此目录需要手动创建)!\n"
echo -e "\n press ENTER to continue (请按 回车 键继续) ..."
read vtInputKey
fi
done
#export necessary variable
export theme
export gfxmode
...
...
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