Installing Custom package containing files of another package

Hello All,

I am building an image for Sama5d2 Atmel chip with OpenWRT.

In my openwrt build, I have modified many lua scripts provided by the package luci-base. For all these modified files, I have created a separate package. This separate package will copy these modified files into the file system but with enabling this package, If i build the openwrt image, I get this error.

Configuring wireless-tools.
Configuring kmod-ipt-offload.
Configuring ppp-mod-pppoe.
Collected errors:
 * resolve_conffiles: Existing conffile /home/chandresh/goodFromB/zoll_medical/openWRT/openWRT_18.06/openwrt-at91/build_dir/target-arm_cortex-a5+neon-vfpv4_glibc_eabi/root-at91/etc/config/firewall is different from the conffile in the new package. The new conffile will be placed at /home/chandresh/goodFromB/zoll_medical/openWRT/openWRT_18.06/openwrt-at91/build_dir/target-arm_cortex-a5+neon-vfpv4_glibc_eabi/root-at91/etc/config/firewall-opkg.
 * check_data_file_clashes: Package web-UI wants to install file /home/chandresh/goodFromB/zoll_medical/openWRT/openWRT_18.06/openwrt-at91/build_dir/target-arm_cortex-a5+neon-vfpv4_glibc_eabi/root-at91/usr/lib/lua/luci/cacheloader.lua
        But that file is already provided by package  * luci-base
 * check_data_file_clashes: Package web-UI wants to install file /home/chandresh/goodFromB/zoll_medical/openWRT/openWRT_18.06/openwrt-at91/build_dir/target-arm_cortex-a5+neon-vfpv4_glibc_eabi/root-at91/usr/lib/lua/luci/cbi/datatypes.lua
        But that file is already provided by package  * luci-base
 * check_data_file_clashes: Package web-UI wants to install file /home/chandresh/goodFromB/zoll_medical/openWRT/openWRT_18.06/openwrt-at91/build_dir/target-arm_cortex-a5+neon-vfpv4_glibc_eabi/root-at91/usr/lib/lua/luci/cbi.lua
        But that file is already provided by package  * luci-base
 * check_data_file_clashes: Package web-UI wants to install file /home/chandresh/goodFromB/zoll_medical/openWRT/openWRT_18.06/openwrt-at91/build_dir/target-arm_cortex-a5+neon-vfpv4_glibc_eabi/root-at91/usr/lib/lua/luci/ccache.lua
        But that file is already provided by package  * luci-base
 * check_data_file_clashes: Package web-UI wants to install file /home/chandresh/goodFromB/zoll_medical/openWRT/openWRT_18.06/openwrt-at91/build_dir/target-arm_cortex-a5+neon-vfpv4_glibc_eabi/root-at91/usr/lib/lua/luci/config.lua
        But that file is already provided by package  * luci-base

Is there any way to install my modified files into the image with by another package?

Thanks,
Chandresh

opkg --help

opkg ... 	
--force-overwrite	Overwrite files from other package(s)

Thanks for answering.

I am building the image file. Is there any configuration option in menuconfig for adding "--force-overwrite" option or can you tell me which Makefile, Should i add this "--force-overwrite" command?

Is it possible, I mean i can overwrite opkg package in the openwrt build right?

Chandresh

Please post the output of;

git remote -v

Please use the "Preformatted text </>" button for logs, scripts, configs and general console output.
grafik
Please edit your post accordingly. Thank you! :slight_smile:

fwiw... you need to either use your own "alternate" package ( via the use of a local feed or altering the original package files within the feed dir ) or make use of "./files"...

Just add this option to your opkg install command line... like :

opkg install <custompackage> --force-overwrite

My git repository is local to my organisation. I am using openWRT which is provided by Atmel. I followed this link for openWRT build.
https://www.linux4sam.org/bin/view/Linux4SAM/OpenWrt

I am using luci feed and for my modified lua files which i am trying to install at /usr/lib/lua/luci/* directory using my custom feed and custom package. Here is my package makefile.

include $(TOPDIR)/rules.mk

# Name, version and release number
# The name and version of your package are used to define the variable to point to the build directory of your package: $(PKG_BUILD_DIR)
PKG_NAME:=web-UI
PKG_VERSION:=1.0
PKG_RELEASE:=1

# Source settings (i.e. where to find the source codes)
# This is a custom variable, used below

include $(INCLUDE_DIR)/package.mk

# Package definition; instructs on how and where our package will appear in the overall configuration menu ('make menuconfig')
define Package/web-UI
  SECTION:=web-UI
  CATEGORY:=Zoll-Applications
  TITLE:=web-UI
endef

# Package preparation instructions; create the build directory and copy the source code.
# The last command is necessary to ensure our preparation instructions remain compatible with the patching system.
define Build/Prepare
        echo "Compilation Step for web-UI if required"
endef

# Package build instructions; invoke the target-specific compiler to first compile the source file, and then to link the file into the final executable
define Build/Compile
        echo "Compilation Step2 for web-UI if required"
endef

# Package description; a more verbose description on what our package does
define Package/web-UI/description
        To copy the web-UI related files in the file system.
endef

# Package install instructions; create a directory inside the package to hold our executable, and then copy the executable we built previously into the folder
define Package/web-UI/install
        rsync -a ./files/* $(1)/
endef

# This command is always the last, it uses the definitions and variables we give above in order to get the job done
$(eval $(call BuildPackage,web-UI))

In the files directory, If I keep any files or directory which is not present in the file system (Not provided by any other package), Then the image is built properly without any error but problem is if I try to modify any files in the "files/" directory which is provided by any other package like lua-base
For example, If my "files" directory is like this, I will get the error as these files are provided by luci-base

files/
├── etc
│   └── testFile
├── usr
│   └── lib
│       └── lua
│           └── luci
│               ├── cacheloader.lua
│               ├── cbi
│               │   └── datatypes.lua
│               ├── cbi.lua
│               ├── ccache.lua
│               ├── config.lua
│               ├── controller
│               │   ├── admin
│               │   │   ├── admin.lua
│               │   │   ├── filebrowser.lua
│               │   │   ├── index.lua
│               │   │   ├── network.lua
│               │   │   ├── settings.lua
│               │   │   ├── status.lua
│               │   │   ├── system.lua
│               │   │   ├── systemsetting.lua
│               │   │   └── uci.lua
│               │   └── firewall.lua
│               ├── debug.lua
│               ├── dispatcher.lua
│               ├── http.lua
│               ├── i18n.lua

Thanks,
Chandresh

Given that you have already been informed that you are not working with
official OpenWrt sources. The least you can do is avoid deception in your posts and tell other users that you are working with a "fork of OpenWrt".

There are several reasons for this, but primarily it is to ensure that you are not wasting the time of others or exposing yourself to risks that would not be the case using official sources;

  • Forks may contain many modifications
  • Forks may use non official package feeds
  • Forks may use old, insecure versions which are a risk to you and also difficult/improper for the current userbase to offer input to

If you are using a fork... tell people... be honest and upfront... i'm sure you expect the same in return.

There is no clean, supported way to have one package overwrite files contained in another package. It appears you attempt to overwrite parts of LuCI (for customization, I guess) - best is to deselect LuCI entirely and only install your own Web-UI packages.

@jow
Thank you.

@wulfy23
I am sorry

I knew that I was using OpenWRT provided by Atmel but I didn't on purpose hide the information about me using "fork of OpenWrt". I would never do that.
Anyhow, Next time if I post anything, I will keep it in mind.

Thankyou :upside_down_face:

seeings your such a good sport...

  • don't use files ( or at least in combination other stuff )
  • follow this (or similar ) in a new clone...
  • urge your vendor to upstream/update their device/repo so you can work with more recent code and avoid security/support issues.

basically you are "replacing an official package with a custom one"... there are quite a few posts / guides and resources on this topic if you search properly. nothing unsolvable with due diligence and practice.

I found that the luci-base and luci-mod-admin-full are the two packages containing all these files so later on, i will replace files of those packages with either patch or scripting.

For now, I am updating the image itself, I.e once the zip gets created, mount it, update the contents anc create image out of thoses updated content.

@wulfy23: Thanks for the help.

Chandresh