mirror of
https://github.com/ventoy/Ventoy.git
synced 2025-01-11 23:13:26 -05:00
Case insensitive when checking checksum value.
This commit is contained in:
parent
a93b0f6656
commit
e713946fd0
@ -918,6 +918,38 @@ static grub_err_t ventoy_cmd_strbegin(grub_extcmd_context_t ctxt, int argc, char
|
||||
return 0;
|
||||
}
|
||||
|
||||
static grub_err_t ventoy_cmd_strcasebegin(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
char *c0, *c1;
|
||||
|
||||
(void)ctxt;
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
c0 = args[0];
|
||||
c1 = args[1];
|
||||
|
||||
while (*c0 && *c1)
|
||||
{
|
||||
if ((*c0 != *c1) && (*c0 != grub_toupper(*c1)))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
c0++;
|
||||
c1++;
|
||||
}
|
||||
|
||||
if (*c1)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static grub_err_t ventoy_cmd_incr(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
long value_long = 0;
|
||||
@ -5051,6 +5083,7 @@ static cmd_para ventoy_cmds[] =
|
||||
{ "vt_mod", ventoy_cmd_mod, 0, NULL, "{Int} {Int} {Var}", "mod integer variable", NULL },
|
||||
{ "vt_strstr", ventoy_cmd_strstr, 0, NULL, "", "", NULL },
|
||||
{ "vt_str_begin", ventoy_cmd_strbegin, 0, NULL, "", "", NULL },
|
||||
{ "vt_str_casebegin", ventoy_cmd_strcasebegin, 0, NULL, "", "", NULL },
|
||||
{ "vt_debug", ventoy_cmd_debug, 0, NULL, "{on|off}", "turn debug on/off", NULL },
|
||||
{ "vtdebug", ventoy_cmd_debug, 0, NULL, "{on|off}", "turn debug on/off", NULL },
|
||||
{ "vtbreak", ventoy_cmd_break, 0, NULL, "{level}", "set debug break", NULL },
|
||||
|
@ -5,8 +5,8 @@ if [ -e "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}.md5" ]; then
|
||||
md5sum "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}"
|
||||
|
||||
vt_1st_line "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}.md5" vtReadChecksum
|
||||
|
||||
if vt_str_begin "$vtReadChecksum" "$VT_LAST_CHECK_SUM"; then
|
||||
|
||||
if vt_str_casebegin "$vtReadChecksum" "$VT_LAST_CHECK_SUM"; then
|
||||
echo -e "\n\nCheck MD5 value with .md5 file. [ OK ]"
|
||||
else
|
||||
echo -e "\n\nCheck MD5 value with .md5 file. [ FAIL ]"
|
||||
@ -33,7 +33,7 @@ if [ -e "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}.sha1" ]; then
|
||||
|
||||
vt_1st_line "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}.sha1" vtReadChecksum
|
||||
|
||||
if vt_str_begin "$vtReadChecksum" "$VT_LAST_CHECK_SUM"; then
|
||||
if vt_str_casebegin "$vtReadChecksum" "$VT_LAST_CHECK_SUM"; then
|
||||
echo -e "\n\nCheck SHA1 value with .sha1 file. [ OK ]"
|
||||
else
|
||||
echo -e "\n\nCheck SHA1 value with .sha1 file. [ FAIL ]"
|
||||
@ -62,7 +62,7 @@ if [ -e "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}.sha256" ]; then
|
||||
|
||||
vt_1st_line "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}.sha256" vtReadChecksum
|
||||
|
||||
if vt_str_begin "$vtReadChecksum" "$VT_LAST_CHECK_SUM"; then
|
||||
if vt_str_casebegin "$vtReadChecksum" "$VT_LAST_CHECK_SUM"; then
|
||||
echo -e "\n\nCheck SHA256 value with .sha256 file. [ OK ]"
|
||||
else
|
||||
echo -e "\n\nCheck SHA256 value with .sha256 file. [ FAIL ]"
|
||||
@ -91,7 +91,7 @@ if [ -e "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}.sha512" ]; then
|
||||
|
||||
vt_1st_line "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}.sha512" vtReadChecksum
|
||||
|
||||
if vt_str_begin "$vtReadChecksum" "$VT_LAST_CHECK_SUM"; then
|
||||
if vt_str_casebegin "$vtReadChecksum" "$VT_LAST_CHECK_SUM"; then
|
||||
echo -e "\n\nCheck SHA512 value with .sha512 file. [ OK ]"
|
||||
else
|
||||
echo -e "\n\nCheck SHA512 value with .sha512 file. [ FAIL ]"
|
||||
|
Loading…
Reference in New Issue
Block a user