mirror of
https://github.com/ventoy/Ventoy.git
synced 2024-12-26 07:05:58 -05:00
add image_blacklist plugin option
This commit is contained in:
parent
620bcad324
commit
390eec4218
@ -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));
|
||||
|
@ -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;
|
||||
|
@ -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 },
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user