1
0

100-add-force-checksum.patch 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. --- a/libopkg/opkg_conf.c
  2. +++ b/libopkg/opkg_conf.c
  3. @@ -54,6 +54,7 @@ opkg_option_t options[] = {
  4. { "force_reinstall", OPKG_OPT_TYPE_BOOL, &_conf.force_reinstall },
  5. { "force_space", OPKG_OPT_TYPE_BOOL, &_conf.force_space },
  6. { "force_postinstall", OPKG_OPT_TYPE_BOOL, &_conf.force_postinstall },
  7. + { "force_checksum", OPKG_OPT_TYPE_BOOL, &_conf.force_checksum },
  8. { "check_signature", OPKG_OPT_TYPE_BOOL, &_conf.check_signature },
  9. { "ftp_proxy", OPKG_OPT_TYPE_STRING, &_conf.ftp_proxy },
  10. { "http_proxy", OPKG_OPT_TYPE_STRING, &_conf.http_proxy },
  11. --- a/libopkg/opkg_conf.h
  12. +++ b/libopkg/opkg_conf.h
  13. @@ -78,6 +78,7 @@ struct opkg_conf
  14. int force_removal_of_essential_packages;
  15. int force_postinstall;
  16. int force_remove;
  17. + int force_checksum;
  18. int check_signature;
  19. int nodeps; /* do not follow dependencies */
  20. int nocase; /* perform case insensitive matching */
  21. --- a/libopkg/opkg_install.c
  22. +++ b/libopkg/opkg_install.c
  23. @@ -1327,12 +1327,19 @@ opkg_install_pkg(pkg_t *pkg, int from_up
  24. file_md5 = file_md5sum_alloc(pkg->local_filename);
  25. if (file_md5 && strcmp(file_md5, pkg->md5sum))
  26. {
  27. - opkg_msg(ERROR, "Package %s md5sum mismatch. "
  28. - "Either the opkg or the package index are corrupt. "
  29. - "Try 'opkg update'.\n",
  30. - pkg->name);
  31. - free(file_md5);
  32. - return -1;
  33. + if (!conf->force_checksum)
  34. + {
  35. + opkg_msg(ERROR, "Package %s md5sum mismatch. "
  36. + "Either the opkg or the package index are corrupt. "
  37. + "Try 'opkg update'.\n",
  38. + pkg->name);
  39. + free(file_md5);
  40. + return -1;
  41. + }
  42. + else
  43. + {
  44. + opkg_msg(NOTICE, "Ignored %s md5sum mismatch.\n", pkg->name);
  45. + }
  46. }
  47. if (file_md5)
  48. free(file_md5);
  49. --- a/src/opkg-cl.c
  50. +++ b/src/opkg-cl.c
  51. @@ -42,6 +42,7 @@ enum {
  52. ARGS_OPT_FORCE_SPACE,
  53. ARGS_OPT_FORCE_POSTINSTALL,
  54. ARGS_OPT_FORCE_REMOVE,
  55. + ARGS_OPT_FORCE_CHECKSUM,
  56. ARGS_OPT_ADD_ARCH,
  57. ARGS_OPT_ADD_DEST,
  58. ARGS_OPT_NOACTION,
  59. @@ -84,6 +85,8 @@ static struct option long_options[] = {
  60. {"force_postinstall", 0, 0, ARGS_OPT_FORCE_POSTINSTALL},
  61. {"force-remove", 0, 0, ARGS_OPT_FORCE_REMOVE},
  62. {"force_remove", 0, 0, ARGS_OPT_FORCE_REMOVE},
  63. + {"force-checksum", 0, 0, ARGS_OPT_FORCE_CHECKSUM},
  64. + {"force_checksum", 0, 0, ARGS_OPT_FORCE_CHECKSUM},
  65. {"noaction", 0, 0, ARGS_OPT_NOACTION},
  66. {"download-only", 0, 0, ARGS_OPT_DOWNLOAD_ONLY},
  67. {"nodeps", 0, 0, ARGS_OPT_NODEPS},
  68. @@ -178,6 +181,9 @@ args_parse(int argc, char *argv[])
  69. case ARGS_OPT_FORCE_REMOVE:
  70. conf->force_remove = 1;
  71. break;
  72. + case ARGS_OPT_FORCE_CHECKSUM:
  73. + conf->force_checksum = 1;
  74. + break;
  75. case ARGS_OPT_NODEPS:
  76. conf->nodeps = 1;
  77. break;
  78. @@ -293,6 +299,7 @@ usage()
  79. printf("\t--force-space Disable free space checks\n");
  80. printf("\t--force-postinstall Run postinstall scripts even in offline mode\n");
  81. printf("\t--force-remove Remove package even if prerm script fails\n");
  82. + printf("\t--force-checksum Don't fail on checksum mismatches\n");
  83. printf("\t--noaction No action -- test only\n");
  84. printf("\t--download-only No action -- download only\n");
  85. printf("\t--nodeps Do not follow dependencies\n");