From 122de3dcce6158cd23df259b0aaa8cfd324b9ef6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 29 Sep 2026 02:40:30 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=B4=20Sync=202026-09-29=2002:40:30?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- opkg/Makefile | 2 +- .../900-smart-conffile-overwrite.patch | 78 +++++++++++++++++++ 2 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 opkg/patches/900-smart-conffile-overwrite.patch diff --git a/opkg/Makefile b/opkg/Makefile index 44dbaae0a..fe25efc7a 100644 --- a/opkg/Makefile +++ b/opkg/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=opkg -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_FLAGS:=essential PKG_SOURCE_PROTO:=git diff --git a/opkg/patches/900-smart-conffile-overwrite.patch b/opkg/patches/900-smart-conffile-overwrite.patch new file mode 100644 index 000000000..3af681d2e --- /dev/null +++ b/opkg/patches/900-smart-conffile-overwrite.patch @@ -0,0 +1,78 @@ +--- a/libopkg/opkg_install.c ++++ b/libopkg/opkg_install.c +@@ -1102,6 +1102,64 @@ + return 0; + } + ++static int conffile_is_user_modified(const char *cf_name, const char *cf_backup, pkg_t *pkg) ++{ ++ pkg_vec_t *installed; ++ conffile_t *orig_cf = NULL; ++ char *rom_filename; ++ int i; ++ ++ installed = pkg_vec_alloc(); ++ pkg_hash_fetch_all_installed(installed); ++ for (i = 0; i < installed->len; i++) { ++ pkg_t *p = installed->pkgs[i]; ++ if (p == pkg) ++ continue; ++ orig_cf = pkg_get_conffile(p, cf_name); ++ if (orig_cf && orig_cf->value) ++ break; ++ orig_cf = NULL; ++ } ++ pkg_vec_free(installed); ++ ++ if (orig_cf && orig_cf->value) { ++ char *orig_chksum; ++ int modified = 1; ++ ++ if (strlen(orig_cf->value) > 33) ++ orig_chksum = file_sha256sum_alloc(cf_backup); ++ else ++ orig_chksum = file_md5sum_alloc(cf_backup); ++ ++ if (orig_chksum) { ++ modified = (strcmp(orig_chksum, orig_cf->value) != 0); ++ free(orig_chksum); ++ return modified; ++ } ++ } ++ ++ sprintf_alloc(&rom_filename, "/rom%s", cf_name); ++ if (file_exists(rom_filename)) { ++ char *rom_chksum = file_sha256sum_alloc(rom_filename); ++ char *backup_chksum = file_sha256sum_alloc(cf_backup); ++ int modified = 1; ++ ++ if (rom_chksum && backup_chksum) ++ modified = (strcmp(rom_chksum, backup_chksum) != 0); ++ ++ if (rom_chksum) ++ free(rom_chksum); ++ if (backup_chksum) ++ free(backup_chksum); ++ free(rom_filename); ++ ++ return modified; ++ } ++ free(rom_filename); ++ ++ return 1; ++} ++ + static int resolve_conffiles(pkg_t * pkg) + { + conffile_list_elt_t *iter; +@@ -1147,6 +1205,10 @@ + opkg_msg(NOTICE, + "Conffile %s using maintainer's setting.\n", + cf_backup); ++ } else if (!conffile_is_user_modified(cf->name, cf_backup, pkg)) { ++ opkg_msg(NOTICE, ++ "Existing conffile %s was not modified by user, updating to new version.\n", ++ root_filename); + } else { + char *new_conffile; + sprintf_alloc(&new_conffile, "%s-opkg",