X-Git-Url: https://git.librecmc.org/?p=oweals%2Fopkg-lede.git;a=blobdiff_plain;f=libopkg%2Fopkg_install.c;h=0db0acdf84e7d6f297da9f690e82aa8d4a41e15e;hp=7e0e17e8262768e9b6025d65108e27c47009768f;hb=733eb7729491810c346bbbecd31051ecc118fd82;hpb=71f02a3eb65b2996957faf81c2e54196a35f3c59 diff --git a/libopkg/opkg_install.c b/libopkg/opkg_install.c index 7e0e17e..0db0acd 100644 --- a/libopkg/opkg_install.c +++ b/libopkg/opkg_install.c @@ -1082,7 +1082,7 @@ resolve_conffiles(pkg_t *pkg) conffile_list_elt_t *iter; conffile_t *cf; char *cf_backup; - char *md5sum; + char *chksum; if (conf->noaction) return 0; @@ -1093,7 +1093,7 @@ resolve_conffiles(pkg_t *pkg) /* Might need to initialize the md5sum for each conffile */ if (cf->value == NULL) { - cf->value = file_md5sum_alloc(root_filename); + cf->value = file_sha256sum_alloc(root_filename); } if (!file_exists(root_filename)) { @@ -1105,8 +1105,16 @@ resolve_conffiles(pkg_t *pkg) if (file_exists(cf_backup)) { /* Let's compute md5 to test if files are changed */ - md5sum = file_md5sum_alloc(cf_backup); - if (md5sum && cf->value && strcmp(cf->value,md5sum) != 0 ) { +#ifdef HAVE_MD5 + if(cf->value && strlen(cf->value) > 33) { + chksum = file_sha256sum_alloc(cf_backup); + } else { + chksum = file_md5sum_alloc(cf_backup); + } +#else + chksum = file_sha256sum_alloc(cf_backup); +#endif + if (chksum && cf->value && strcmp(cf->value,chksum) != 0 ) { if (conf->force_maintainer) { opkg_msg(NOTICE, "Conffile %s using maintainer's setting.\n", cf_backup); @@ -1123,8 +1131,8 @@ resolve_conffiles(pkg_t *pkg) } } unlink(cf_backup); - if (md5sum) - free(md5sum); + if (chksum) + free(chksum); } free(cf_backup); @@ -1306,13 +1314,15 @@ opkg_install_pkg(pkg_t *pkg, int from_upgrade) if (opkg_verify_file (list_file_name, sig_file_name)){ opkg_msg(ERROR, "Failed to verify the signature of %s.\n", list_file_name); - return -1; + if (!conf->force_signature) + return -1; } }else{ opkg_msg(ERROR, "Signature file is missing for %s. " "Perhaps you need to run 'opkg update'?\n", pkg->name); - return -1; + if (!conf->force_signature) + return -1; } free (lists_dir); @@ -1321,6 +1331,7 @@ opkg_install_pkg(pkg_t *pkg, int from_upgrade) } #endif +#ifdef HAVE_MD5 /* Check for md5 values */ if (pkg->md5sum) { @@ -1344,6 +1355,7 @@ opkg_install_pkg(pkg_t *pkg, int from_upgrade) if (file_md5) free(file_md5); } +#endif #ifdef HAVE_SHA256 /* Check for sha256 value */