cli: implement --force-checksum
[oweals/opkg-lede.git] / libopkg / opkg_install.c
index e68c8131e85e69d9b0d058fe889a7a0c44e92cd9..2c61a5fccd7b12f8d1598098030aaa702cf1b792 100644 (file)
@@ -1327,12 +1327,19 @@ opkg_install_pkg(pkg_t *pkg, int from_upgrade)
          file_md5 = file_md5sum_alloc(pkg->local_filename);
          if (file_md5 && strcmp(file_md5, pkg->md5sum))
          {
-              opkg_msg(ERROR, "Package %s md5sum mismatch. "
-                       "Either the opkg or the package index are corrupt. "
-                       "Try 'opkg update'.\n",
-                       pkg->name);
-              free(file_md5);
-              return -1;
+              if (!conf->force_checksum)
+              {
+                  opkg_msg(ERROR, "Package %s md5sum mismatch. "
+                           "Either the opkg or the package index are corrupt. "
+                           "Try 'opkg update'.\n",
+                           pkg->name);
+                  free(file_md5);
+                  return -1;
+              }
+              else
+              {
+                  opkg_msg(NOTICE, "Ignored %s md5sum mismatch.\n", pkg->name);
+              }
          }
         if (file_md5)
               free(file_md5);