conffile_list_elt_t *iter;
conffile_t *cf;
char *cf_backup;
- char *md5sum;
+ char *chksum;
if (conf->noaction) return 0;
/* 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)) {
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);
}
}
unlink(cf_backup);
- if (md5sum)
- free(md5sum);
+ if (chksum)
+ free(chksum);
}
free(cf_backup);
}
/* check that the repository is valid */
- #if defined(HAVE_GPGME) || defined(HAVE_OPENSSL)
+ #if defined(HAVE_GPGME) || defined(HAVE_OPENSSL) || defined(HAVE_USIGN)
char *list_file_name, *sig_file_name, *lists_dir;
/* check to ensure the package has come from a repository */
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);
}
#endif
+#ifdef HAVE_MD5
/* Check for md5 values */
if (pkg->md5sum)
{
if (file_md5)
free(file_md5);
}
+#endif
#ifdef HAVE_SHA256
/* Check for sha256 value */
file_sha256 = file_sha256sum_alloc(pkg->local_filename);
if (file_sha256 && strcmp(file_sha256, pkg->sha256sum))
{
- opkg_msg(ERROR, "Package %s sha256sum mismatch. "
- "Either the opkg or the package index are corrupt. "
- "Try 'opkg update'.\n",
- pkg->name);
- free(file_sha256);
- return -1;
+ if (!conf->force_checksum)
+ {
+ opkg_msg(ERROR,
+ "Package %s sha256sum mismatch. "
+ "Either the opkg or the package index are corrupt. "
+ "Try 'opkg update'.\n",
+ pkg->name);
+ free(file_sha256);
+ return -1;
+ }
+ else
+ {
+ opkg_msg(NOTICE,
+ "Ignored %s sha256sum mismatch.\n",
+ pkg->name);
+ }
}
if (file_sha256)
free(file_sha256);
opkg_state_changed++;
pkg->state_flag |= SF_FILELIST_CHANGED;
- if (old_pkg)
+ if (old_pkg) {
pkg_remove_orphan_dependent(pkg, old_pkg);
-
+ old_pkg->is_upgrade = 1;
+ pkg->is_upgrade = 1;
+ }
/* XXX: BUG: we really should treat replacement more like an upgrade
* Instead, we're going to remove the replacees
*/
}
- opkg_msg(INFO, "Installing maintainer scripts.\n");
+ opkg_msg(INFO, "%s maintainer scripts.\n", (pkg->is_upgrade) ? ("Upgrading") : ("Installing"));
if (install_maintainer_scripts(pkg, old_pkg)) {
opkg_msg(ERROR, "Failed to extract maintainer scripts for %s."
" Package debris may remain!\n",