210-add-force-signature.patch 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. --- a/libopkg/opkg_conf.h
  2. +++ b/libopkg/opkg_conf.h
  3. @@ -80,6 +80,7 @@ struct opkg_conf
  4. int force_remove;
  5. int force_checksum;
  6. int check_signature;
  7. + int force_signature;
  8. int nodeps; /* do not follow dependencies */
  9. int nocase; /* perform case insensitive matching */
  10. char *offline_root;
  11. --- a/src/opkg-cl.c
  12. +++ b/src/opkg-cl.c
  13. @@ -51,6 +51,7 @@ enum {
  14. ARGS_OPT_NOCASE,
  15. ARGS_OPT_AUTOREMOVE,
  16. ARGS_OPT_CACHE,
  17. + ARGS_OPT_FORCE_SIGNATURE,
  18. };
  19. static struct option long_options[] = {
  20. @@ -87,6 +88,8 @@ static struct option long_options[] = {
  21. {"force_remove", 0, 0, ARGS_OPT_FORCE_REMOVE},
  22. {"force-checksum", 0, 0, ARGS_OPT_FORCE_CHECKSUM},
  23. {"force_checksum", 0, 0, ARGS_OPT_FORCE_CHECKSUM},
  24. + {"force-signature", 0, 0, ARGS_OPT_FORCE_SIGNATURE},
  25. + {"force_signature", 0, 0, ARGS_OPT_FORCE_SIGNATURE},
  26. {"noaction", 0, 0, ARGS_OPT_NOACTION},
  27. {"download-only", 0, 0, ARGS_OPT_DOWNLOAD_ONLY},
  28. {"nodeps", 0, 0, ARGS_OPT_NODEPS},
  29. @@ -210,6 +213,9 @@ args_parse(int argc, char *argv[])
  30. case ARGS_OPT_DOWNLOAD_ONLY:
  31. conf->download_only = 1;
  32. break;
  33. + case ARGS_OPT_FORCE_SIGNATURE:
  34. + conf->force_signature = 1;
  35. + break;
  36. case ':':
  37. parse_err = -1;
  38. break;
  39. --- a/libopkg/opkg_install.c
  40. +++ b/libopkg/opkg_install.c
  41. @@ -1306,13 +1306,15 @@ opkg_install_pkg(pkg_t *pkg, int from_up
  42. if (opkg_verify_file (list_file_name, sig_file_name)){
  43. opkg_msg(ERROR, "Failed to verify the signature of %s.\n",
  44. list_file_name);
  45. - return -1;
  46. + if (!conf->force_signature)
  47. + return -1;
  48. }
  49. }else{
  50. opkg_msg(ERROR, "Signature file is missing for %s. "
  51. "Perhaps you need to run 'opkg update'?\n",
  52. pkg->name);
  53. - return -1;
  54. + if (!conf->force_signature)
  55. + return -1;
  56. }
  57. free (lists_dir);
  58. --- a/libopkg/opkg_cmd.c
  59. +++ b/libopkg/opkg_cmd.c
  60. @@ -196,7 +196,7 @@ opkg_update_cmd(int argc, char **argv)
  61. else
  62. opkg_msg(NOTICE, "Signature check failed.\n");
  63. }
  64. - if (err) {
  65. + if (err && !conf->force_signature) {
  66. /* The signature was wrong so delete it */
  67. opkg_msg(NOTICE, "Remove wrong Signature file.\n");
  68. unlink (tmp_file_name);