fix(boot.default): 设置默认系统同步启动菜单权威文件 /data/meow_boot_default
- meow_settings_save() 落库 boot.default 时同步写 /data/meow_boot_default (meow=0/默认MeowOS, hiby=1/默认HiByOS; 与 bootmenu set_boot_default_meow / set_boot_default_hiby 同文件同语义) - init 读入不触发 save, 不反向覆盖权威文件; O_TRUNC 幂等 - launcher 重编 cebded23; M2.61 固件 md5 fe57f361(0.7.56) 含此修复
This commit is contained in:
1 parent
6824defdf9
commit
b6fe812251
2 files changed
+18
No files matched your search
Binary file not shown.
@@ -693,6 +693,24 @@ int meow_settings_save(void)
|
||||
}
|
||||
write_full_conf(fd);
|
||||
close(fd);
|
||||
/* boot.default:除写 settings.conf 外,还要同步到启动菜单的权威文件 /data/meow_boot_default
|
||||
* (bootmenu 开机读它定默认项;与 bootmenu set_boot_default_meow() 写 "0" / launcher
|
||||
* set_boot_default_hiby() 写 "1" 同文件、同语义:meow=0(默认 MeowOS), hiby=1(默认 HiByOS))。
|
||||
* 幂等:值未变也 O_TRUNC 重写,无害。init 读入不触发 save,故不会反向覆盖权威文件。 */
|
||||
meow_setting *bdef = find_set("boot.default");
|
||||
if (bdef) {
|
||||
int v = (!strcmp(bdef->cur, "hiby")) ? 1 : 0; /* meow(默认) -> 0, hiby -> 1 */
|
||||
int bf = open("/data/meow_boot_default", O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
||||
if (bf >= 0) {
|
||||
char bb[8];
|
||||
int n = snprintf(bb, sizeof bb, "%d\n", v);
|
||||
write(bf, bb, n);
|
||||
close(bf);
|
||||
sset_log("boot.default=%s -> /data/meow_boot_default=%d", bdef->cur, v);
|
||||
} else {
|
||||
sset_log("boot.default sync: open /data/meow_boot_default fail: %s", strerror(errno));
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < g_nsets; i++) g_sets[i].dirty = 0;
|
||||
return MEOW_OK;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user