1 --- a/libopkg/conffile.c
2 +++ b/libopkg/conffile.c
5 int conffile_has_been_modified(conffile_t *conffile)
9 char *filename = conffile->name;
14 root_filename = root_filename_alloc(filename);
16 - md5sum = file_md5sum_alloc(root_filename);
18 - if (md5sum && (ret = strcmp(md5sum, conffile->value))) {
19 - opkg_msg(INFO, "Conffile %s:\n\told md5=%s\n\tnew md5=%s\n",
20 - conffile->name, md5sum, conffile->value);
22 + chksum = file_md5sum_alloc(root_filename);
24 + chksum = file_sha256sum_alloc(root_filename);
26 + if (chksum && (ret = strcmp(chksum, conffile->value))) {
27 + opkg_msg(INFO, "Conffile %s:\n\told chk=%s\n\tnew chk=%s\n",
28 + conffile->name, chksum, conffile->value);
39 --- a/libopkg/file_util.c
40 +++ b/libopkg/file_util.c
43 #include "sprintf_alloc.h"
44 #include "file_util.h"
48 #include "libbb/libbb.h"
50 #if defined HAVE_SHA256
52 return make_directory(path, mode, FILEUTILS_RECUR);
56 char *file_md5sum_alloc(const char *file_name)
58 static const int md5sum_bin_len = 16;
66 char *file_sha256sum_alloc(const char *file_name)
67 --- a/libopkg/opkg_install.c
68 +++ b/libopkg/opkg_install.c
70 conffile_list_elt_t *iter;
76 if (conf->noaction) return 0;
78 @@ -1093,7 +1093,11 @@
80 /* Might need to initialize the md5sum for each conffile */
81 if (cf->value == NULL) {
83 cf->value = file_md5sum_alloc(root_filename);
85 + cf->value = file_sha256sum_alloc(root_filename);
89 if (!file_exists(root_filename)) {
90 @@ -1105,8 +1109,12 @@
92 if (file_exists(cf_backup)) {
93 /* Let's compute md5 to test if files are changed */
94 - md5sum = file_md5sum_alloc(cf_backup);
95 - if (md5sum && cf->value && strcmp(cf->value,md5sum) != 0 ) {
97 + chksum = file_md5sum_alloc(cf_backup);
99 + chksum = file_sha256sum_alloc(cf_backup);
101 + if (chksum && cf->value && strcmp(cf->value,chksum) != 0 ) {
102 if (conf->force_maintainer) {
103 opkg_msg(NOTICE, "Conffile %s using maintainer's setting.\n",
105 @@ -1123,8 +1131,8 @@
116 @@ -1323,6 +1331,7 @@
121 /* Check for md5 values */
124 @@ -1346,6 +1355,7 @@
131 /* Check for sha256 value */
132 --- a/libopkg/Makefile.am
133 +++ b/libopkg/Makefile.am
135 pkg_src.c pkg_src.h pkg_src_list.c pkg_src_list.h \
136 str_list.c str_list.h void_list.c void_list.h \
137 active_list.c active_list.h list.h
138 -opkg_util_sources = file_util.c file_util.h opkg_message.h opkg_message.c md5.c md5.h \
139 +opkg_util_sources = file_util.c file_util.h opkg_message.h opkg_message.c \
140 parse_util.c parse_util.h \
141 sprintf_alloc.c sprintf_alloc.h \
142 xregex.c xregex.h xsystem.c xsystem.h
144 opkg_util_sources += opkg_pathfinder.c opkg_pathfinder.h
147 +opkg_util_sources += md5.c md5.h
150 opkg_util_sources += sha256.c sha256.h
155 AC_DEFINE(HAVE_SHA256, 1, [Define if you want sha256 support])
157 AM_CONDITIONAL(HAVE_SHA256, test "x$want_sha256" = "xyes")
158 +AM_CONDITIONAL(HAVE_MD5, test "x$want_sha256" = "xno")
161 AC_ARG_ENABLE(openssl,