[OpenWrt-Devel] Checksums of all files

Michal Hrusecky Michal.Hrusecky at nic.cz
Fri Apr 22 07:38:11 EDT 2016


I run into idea I would like some feedback on before I'll send a real patch.
When people have an old router witch flash that may have some errors or root on
external drive, it can happen, that some files will get damaged. And in that
case it could be really useful to have checksums of all files - normally
package managers have that kind of information. Currently I did this:

--- a/include/package-ipkg.mk
+++ b/include/package-ipkg.mk
@@ -187,6 +187,9 @@ $(_endef)
    $(RSTRIP) $$(IDIR_$(1))
+   (cd $$(IDIR_$(1)); \
+       find . -type f \! -path ./CONTROL/* -exec md5sum \{\} + | \
+       sed 's|\([[:blank:]]\)\./|\1/|' > $$(IDIR_$(1))/CONTROL/files-md5sum )
    (cd $$(IDIR_$(1))/CONTROL; \
        ( \
            echo "$$$$CONTROL"; \

Although hacky, works for me as I can now use

> cat /usr/lib/opkg/info/*.files-md5sum | md5sum -c -

To verify that my installed packages are ok.

If I would send a patch, I would definitely make it optional. Best course of
action would be to include it in current files list and teach opkg to use it,
but that is too far ahead. What do you think about the idea itself for now?
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list