diff options
author | mirabilos <tg@mirbsd.org> | 2017-11-18 16:57:13 +0100 |
---|---|---|
committer | Waldemar Brodkorb <wbx@openadk.org> | 2017-11-19 09:09:27 +0100 |
commit | 0c9c313ff857134107687ee559dd51b8cb42059e (patch) | |
tree | b71b059748bfb0e5d0893aac6d191ad82edb1a1e /mk | |
parent | 64f6f656d1c549d6b934e7367f856217fcce21d3 (diff) |
use tar(1) to copy the extra directories’ content
this should fix symlink traversal for preexisting copy targets
Signed-off-by: mirabilos <tg@mirbsd.org>
Diffstat (limited to 'mk')
-rw-r--r-- | mk/image.mk | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/mk/image.mk b/mk/image.mk index cd9551e28..b69cd80d2 100644 --- a/mk/image.mk +++ b/mk/image.mk @@ -53,8 +53,13 @@ extra-install: @-if [ -h ${TARGET_DIR}/etc/resolv.conf -a -f $(ADK_TOPDIR)/extra/etc/resolv.conf ];then \ rm ${TARGET_DIR}/etc/resolv.conf;\ fi - @if [ -d $(ADK_TOPDIR)/extra ];then $(CP) $(ADK_TOPDIR)/extra/* ${TARGET_DIR};fi - @if [ ! -z $(extra) ];then $(CP) $(extra)/* ${TARGET_DIR};fi + @if test -d '${ADK_TOPDIR}/extra'; then \ + (cd '${ADK_TOPDIR}/extra' && tar -cf - .) | \ + (cd ${TARGET_DIR}; tar -xf -); \ + fi +ifneq (,$(strip ${extra})) + @(cd '${extra}' && tar -cf - .) | (cd ${TARGET_DIR}; tar -xf -) +endif image-prepare-post: $(BASH) $(ADK_TOPDIR)/scripts/update-rcconf |