Dne 21.4.2013 2:24, Shawn Lewis napsal(a):
> Hi, I have a package that overrides files from other packages, and I build in 
> to my image. I'd like it to always be installed last, to ensure that it's 
> files are the ones that show up in the image.
> 
> Currently in my package's Makefile I specify PKG_BUILD_DEPENDS for any 
> packages whose files I'm overriding. This doesn't seem to work for the 
> base-files package (my package ends up being built before base-files).
> 
> I don't want to use the openwrt/files directory, as I want to be able to 
> "opkg upgrade" this package and get the new files.
> 
> Any ideas on better ways to do this?
> 
> Thanks,
> Shawn
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
> 

Hello Shawn,

that's quite a problem I suppose, but I might be wrong. :-) Handling the same 
files from two packages can't end up well. I would suggest to write a postinst 
and postrm script that would copy and restore your files the same way you would 
do in /install macro. Take a look at BuildPackage defines at:

http://wiki.openwrt.org/doc/devel/packages

Just a guess:

#Makefile
...
        $(INSTALL_DIR) $(1)/etc/uci-defaults
        $(INSTALL_DATA) \
                ./files/uci-defaults/my-preparation-script \
                $(1)/etc/uci-defaults/
endef

define Package/mypackage/postinst
        #!/bin/sh
        [ -n "$${IPKG_INSTROOT}" ] && exit
        . /lib/functions.sh
        uci_apply_defaults
endef

# mypreparationscript
#!/bin/sh
if [ -f /path/original-file ]; then
        mv /path/original-file /path/original-file.backup
fi
cp /path/your-file /path/original-file

and also the same for Package/prerm or Package/postrm that would do the 
opposite of it on package removal. Try that, it's quite fun.

~ Jiri
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to