增加应用检测ota
This commit is contained in:
parent
5d8ed18f04
commit
4c50a1d163
@ -708,13 +708,17 @@ static int get_remote_file_md5(const char* host, const char* remote_path, char*
|
||||
|
||||
FILE* fp = popen(cmd, "r");
|
||||
if (!fp) {
|
||||
fprintf(stderr, "无法执行SSH命令获取远程文件MD5\n");
|
||||
// SSH命令执行失败,黄灯快速闪烁表示错误
|
||||
start_yellow_fast_blink();
|
||||
sleep(2);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (fgets(out_md5, (int)out_size, fp) == NULL) {
|
||||
pclose(fp);
|
||||
fprintf(stderr, "无法读取远程文件MD5值\n");
|
||||
// 无法读取MD5,黄灯快速闪烁表示错误
|
||||
start_yellow_fast_blink();
|
||||
sleep(2);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -728,7 +732,9 @@ static int get_remote_file_md5(const char* host, const char* remote_path, char*
|
||||
|
||||
// 验证MD5格式(32个十六进制字符)
|
||||
if (strlen(out_md5) != 32) {
|
||||
fprintf(stderr, "远程文件MD5格式无效: %s\n", out_md5);
|
||||
// MD5格式错误,黄灯快速闪烁表示错误
|
||||
start_yellow_fast_blink();
|
||||
sleep(2);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -746,7 +752,9 @@ static int copy_remote_directory(const char* host, const char* remote_dir, const
|
||||
|
||||
int result = system(cmd);
|
||||
if (result != 0) {
|
||||
fprintf(stderr, "复制远程目录失败,返回码: %d\n", result);
|
||||
// 复制失败,黄灯快速闪烁表示错误
|
||||
start_yellow_fast_blink();
|
||||
sleep(2);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -775,7 +783,6 @@ static int check_and_update_pigeon_dll(void) {
|
||||
|
||||
// 获取远程文件MD5
|
||||
if (get_remote_file_md5(remote_host, remote_file, remote_md5, sizeof(remote_md5)) != 0) {
|
||||
fprintf(stderr, "获取远程文件MD5失败\n");
|
||||
return -1;
|
||||
}
|
||||
fprintf(stdout, "远程文件MD5: %s\n", remote_md5);
|
||||
@ -832,7 +839,6 @@ static int check_program_upgrade(char** argv) {
|
||||
|
||||
// 获取远程程序文件MD5
|
||||
if (get_remote_file_md5(remote_host, remote_program, remote_md5, sizeof(remote_md5)) != 0) {
|
||||
fprintf(stderr, "获取远程程序文件MD5失败,跳过升级检查\n");
|
||||
return 0; // 不影响主程序运行
|
||||
}
|
||||
fprintf(stdout, "远程程序MD5: %s\n", remote_md5);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user