aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2018-01-10 20:17:48 +0100
committerJo-Philipp Wich <jo@mein.io>2018-01-13 17:39:53 +0100
commit3fa86282fae7a0a06ddde7ad0323b56b432e0be3 (patch)
treed0e94d52455ffac7dcd0a47b37309d582ab0de9a
parent987a7e31759c0ef3124d521f434bd2d96ed89d6a (diff)
downloadupstream-3fa86282fae7a0a06ddde7ad0323b56b432e0be3.tar.gz
upstream-3fa86282fae7a0a06ddde7ad0323b56b432e0be3.tar.bz2
upstream-3fa86282fae7a0a06ddde7ad0323b56b432e0be3.zip
build: fix restoring /etc/opkg with PER_DEVICE_ROOTFS
When generating per-device rootfs directories, the ./etc/opkg/ directory is moved away prior to calling opkg install, opkg remove and rootfs_prepare. After the opkg invocations and the rootfs_prepare macro call, the saved opkg config directory is supposed to be moved back to its previous ./etc/opkg location. The mv command however can fail to properly restore the directory under certain circumstances, e.g. when the prior opkg or files/ overlay copy operations caused a new ./etc/opkg/ directory to be created. In this case, the backed up directory (named target-dir-$hash.opkg) will be moved into the preexisting ./etc/opkg/ directory instead, causing the opkg configuration to be located in a wrong path on the final rootfs, e.g. in /etc/opkg/target-dir-$hash.opkg/distfeeds.conf instead of /etc/opkg/distfeeds.conf. Solve this problem by replacing the naive "mv" command with a recursive "cp -T" invocation which causes the backed up directory tree to get merged with the destination directory in case it already exists. Also perform the rootfs_prepare macro call after restoring the opkg configuration, to allow users to override it again by using the files/ overlay mechanism. Signed-off-by: Jo-Philipp Wich <jo@mein.io> (cherry picked from commit ab1785b1b2559c9f2d09d4d3ce43e11f4b828616)
-rw-r--r--include/image.mk4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/image.mk b/include/image.mk
index 84b46f256c..8846353390 100644
--- a/include/image.mk
+++ b/include/image.mk
@@ -302,9 +302,9 @@ target-dir-%: FORCE
$(opkg_target) update && \
$(opkg_target) install \
$(call opkg_package_files,$(mkfs_packages_add)))
+ -$(CP) -T $(mkfs_cur_target_dir).opkg/ $(mkfs_cur_target_dir)/etc/opkg/
+ rm -rf $(mkfs_cur_target_dir).opkg $(mkfs_cur_target_dir).conf
$(call prepare_rootfs,$(mkfs_cur_target_dir))
- -mv $(mkfs_cur_target_dir).opkg $(mkfs_cur_target_dir)/etc/opkg
- rm -f $(mkfs_cur_target_dir).conf
$(KDIR)/root.%: kernel_prepare
$(call Image/mkfs/$(word 1,$(target_params)),$(target_params))