From: Jo-Philipp Wich Date: Wed, 14 May 2014 11:19:07 +0000 (+0000) Subject: opkg: introduce a --force-checksum cmdline flag to be ale to ignore mismatching md5sums X-Git-Tag: reboot~7260 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=1f3a36b9c397aa6718978ac145ed30a75c64b1db;p=oweals%2Fopenwrt.git opkg: introduce a --force-checksum cmdline flag to be ale to ignore mismatching md5sums Signed-off-by: Jo-Philipp Wich SVN-Revision: 40766 --- diff --git a/package/system/opkg/Makefile b/package/system/opkg/Makefile index 0dc3d6a7be..857fe561d8 100644 --- a/package/system/opkg/Makefile +++ b/package/system/opkg/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2006-2012 OpenWrt.org +# Copyright (C) 2006-2014 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/version.mk PKG_NAME:=opkg PKG_REV:=9c97d5ecd795709c8584e972bfdf3aee3a5b846d PKG_VERSION:=$(PKG_REV) -PKG_RELEASE:=6 +PKG_RELEASE:=7 PKG_SOURCE_PROTO:=git PKG_SOURCE_VERSION:=$(PKG_REV) diff --git a/package/system/opkg/patches/100-add-force-checksum.patch b/package/system/opkg/patches/100-add-force-checksum.patch new file mode 100644 index 0000000000..5f65a7540c --- /dev/null +++ b/package/system/opkg/patches/100-add-force-checksum.patch @@ -0,0 +1,85 @@ +--- a/libopkg/opkg_conf.c ++++ b/libopkg/opkg_conf.c +@@ -54,6 +54,7 @@ opkg_option_t options[] = { + { "force_reinstall", OPKG_OPT_TYPE_BOOL, &_conf.force_reinstall }, + { "force_space", OPKG_OPT_TYPE_BOOL, &_conf.force_space }, + { "force_postinstall", OPKG_OPT_TYPE_BOOL, &_conf.force_postinstall }, ++ { "force_checksum", OPKG_OPT_TYPE_BOOL, &_conf.force_checksum }, + { "check_signature", OPKG_OPT_TYPE_BOOL, &_conf.check_signature }, + { "ftp_proxy", OPKG_OPT_TYPE_STRING, &_conf.ftp_proxy }, + { "http_proxy", OPKG_OPT_TYPE_STRING, &_conf.http_proxy }, +--- a/libopkg/opkg_conf.h ++++ b/libopkg/opkg_conf.h +@@ -78,6 +78,7 @@ struct opkg_conf + int force_removal_of_essential_packages; + int force_postinstall; + int force_remove; ++ int force_checksum; + int check_signature; + int nodeps; /* do not follow dependencies */ + int nocase; /* perform case insensitive matching */ +--- a/libopkg/opkg_install.c ++++ b/libopkg/opkg_install.c +@@ -1327,12 +1327,19 @@ opkg_install_pkg(pkg_t *pkg, int from_up + 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); +--- a/src/opkg-cl.c ++++ b/src/opkg-cl.c +@@ -42,6 +42,7 @@ enum { + ARGS_OPT_FORCE_SPACE, + ARGS_OPT_FORCE_POSTINSTALL, + ARGS_OPT_FORCE_REMOVE, ++ ARGS_OPT_FORCE_CHECKSUM, + ARGS_OPT_ADD_ARCH, + ARGS_OPT_ADD_DEST, + ARGS_OPT_NOACTION, +@@ -84,6 +85,8 @@ static struct option long_options[] = { + {"force_postinstall", 0, 0, ARGS_OPT_FORCE_POSTINSTALL}, + {"force-remove", 0, 0, ARGS_OPT_FORCE_REMOVE}, + {"force_remove", 0, 0, ARGS_OPT_FORCE_REMOVE}, ++ {"force-checksum", 0, 0, ARGS_OPT_FORCE_CHECKSUM}, ++ {"force_checksum", 0, 0, ARGS_OPT_FORCE_CHECKSUM}, + {"noaction", 0, 0, ARGS_OPT_NOACTION}, + {"download-only", 0, 0, ARGS_OPT_DOWNLOAD_ONLY}, + {"nodeps", 0, 0, ARGS_OPT_NODEPS}, +@@ -178,6 +181,9 @@ args_parse(int argc, char *argv[]) + case ARGS_OPT_FORCE_REMOVE: + conf->force_remove = 1; + break; ++ case ARGS_OPT_FORCE_CHECKSUM: ++ conf->force_checksum = 1; ++ break; + case ARGS_OPT_NODEPS: + conf->nodeps = 1; + break; +@@ -293,6 +299,7 @@ usage() + printf("\t--force-space Disable free space checks\n"); + printf("\t--force-postinstall Run postinstall scripts even in offline mode\n"); + printf("\t--force-remove Remove package even if prerm script fails\n"); ++ printf("\t--force-checksum Don't fail on checksum mismatches\n"); + printf("\t--noaction No action -- test only\n"); + printf("\t--download-only No action -- download only\n"); + printf("\t--nodeps Do not follow dependencies\n");