rpcd: iwinfo plugin fixes
[openwrt.git] / package / system / opkg / patches / 210-add-force-signature.patch
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  
20  static struct option long_options[] = {
21 @@ -87,6 +88,8 @@ static struct option long_options[] = {
22         {"force_remove", 0, 0, ARGS_OPT_FORCE_REMOVE},
23         {"force-checksum", 0, 0, ARGS_OPT_FORCE_CHECKSUM},
24         {"force_checksum", 0, 0, ARGS_OPT_FORCE_CHECKSUM},
25 +       {"force-signature", 0, 0, ARGS_OPT_FORCE_SIGNATURE},
26 +       {"force_signature", 0, 0, ARGS_OPT_FORCE_SIGNATURE},
27         {"noaction", 0, 0, ARGS_OPT_NOACTION},
28         {"download-only", 0, 0, ARGS_OPT_DOWNLOAD_ONLY},
29         {"nodeps", 0, 0, ARGS_OPT_NODEPS},
30 @@ -210,6 +213,9 @@ args_parse(int argc, char *argv[])
31          case ARGS_OPT_DOWNLOAD_ONLY:
32                         conf->download_only = 1;
33                         break;
34 +               case ARGS_OPT_FORCE_SIGNATURE:
35 +                       conf->force_signature = 1;
36 +                       break;
37                 case ':':
38                         parse_err = -1;
39                         break;
40 --- a/libopkg/opkg_install.c
41 +++ b/libopkg/opkg_install.c
42 @@ -1306,13 +1306,15 @@ opkg_install_pkg(pkg_t *pkg, int from_up
43           if (opkg_verify_file (list_file_name, sig_file_name)){
44             opkg_msg(ERROR, "Failed to verify the signature of %s.\n",
45                             list_file_name);
46 -           return -1;
47 +           if (!conf->force_signature)
48 +             return -1;
49           }
50         }else{
51           opkg_msg(ERROR, "Signature file is missing for %s. "
52                           "Perhaps you need to run 'opkg update'?\n",
53                          pkg->name);
54 -         return -1;
55 +         if (!conf->force_signature)
56 +           return -1;
57         }
58  
59         free (lists_dir);
60 --- a/libopkg/opkg_cmd.c
61 +++ b/libopkg/opkg_cmd.c
62 @@ -196,7 +196,7 @@ opkg_update_cmd(int argc, char **argv)
63                    else
64                        opkg_msg(NOTICE, "Signature check failed.\n");
65                }
66 -              if (err) {
67 +              if (err && !conf->force_signature) {
68                    /* The signature was wrong so delete it */
69                    opkg_msg(NOTICE, "Remove wrong Signature file.\n");
70                    unlink (tmp_file_name);