增加应用检测ota

This commit is contained in:
zzh 2026-01-13 15:24:48 +08:00
parent 5d8ed18f04
commit 4c50a1d163

View File

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