diff --git a/mk/spksrc.copy.mk b/mk/spksrc.copy.mk index a35d01dc715..895188e3c5d 100644 --- a/mk/spksrc.copy.mk +++ b/mk/spksrc.copy.mk @@ -45,18 +45,17 @@ copy_target: SHELL:=/bin/bash copy_target: $(PRE_COPY_TARGET) $(INSTALL_PLIST) ifeq ($(call version_ge, ${TCVERSION}, 7.0),1) @$(MSG) [DSM7+] Copy target to staging, discard var directory - @(mkdir -p $(STAGING_DIR) && cd $(INSTALL_DIR)/$(INSTALL_PREFIX) && tar cpf - `cat $(INSTALL_PLIST) | sed -e '/^.*:var\/.*/d' -e 's/^.*://g'`) | \ + @(mkdir -p $(STAGING_DIR) && cd $(INSTALL_DIR)/$(INSTALL_PREFIX) && tar cpf - $$(cat $(INSTALL_PLIST) | sed -e '/^.*:var\/.*/d' -e 's/^.*://g')) | \ tar xpf - -C $(STAGING_DIR) @$(MSG) "[DSM7+] Copy and merge var and target/var to $(STAGING_DIR)/var" - @if [ "`cat $(INSTALL_PLIST) | sed -n 's?^.*:var/??p'`" ] ; then \ + @if [ "$$(cat $(INSTALL_PLIST) | sed -n 's?^.*:var/??p')" ] ; then \ mkdir -p $(STAGING_DIR)/var ; \ - (cd $(INSTALL_DIR)/$(INSTALL_PREFIX)/../var && tar cpf - $$(eval ls -d $$(cat $(INSTALL_PLIST) | sed -n 's?^.*:var/??p') 2>/dev/null)) | tar xpf - -C $(STAGING_DIR)/var ; \ - (cd $(INSTALL_DIR)/$(INSTALL_PREFIX)/var && tar cpf - $$(eval ls -d $$(cat $(INSTALL_PLIST) | sed -n 's?^.*:var/??p') 2>/dev/null)) | tar xpf - -C $(STAGING_DIR)/var ; \ + ([ -d $(INSTALL_DIR)/$(INSTALL_PREFIX)/../var ] && (cd $(INSTALL_DIR)/$(INSTALL_PREFIX)/../var && tar cpf - $$(eval ls -d $$(cat $(INSTALL_PLIST) | sed -n 's?^.*:var/??p') 2>/dev/null)) | tar xpf - -C $(STAGING_DIR)/var) || true ; \ + ([ -d $(INSTALL_DIR)/$(INSTALL_PREFIX)/var ] && (cd $(INSTALL_DIR)/$(INSTALL_PREFIX)/var && tar cpf - $$(eval ls -d $$(cat $(INSTALL_PLIST) | sed -n 's?^.*:var/??p') 2>/dev/null)) | tar xpf - -C $(STAGING_DIR)/var) || true ; \ fi else @$(MSG) Copy target to staging [DSM6] - @(mkdir -p $(STAGING_DIR) && cd $(INSTALL_DIR)/$(INSTALL_PREFIX) && tar cpf - `cat $(INSTALL_PLIST) | cut -d':' -f2`) | \ - tar xpf - -C $(STAGING_DIR) + @(mkdir -p $(STAGING_DIR) && cd $(INSTALL_DIR)/$(INSTALL_PREFIX) && tar cpf - $$(cat $(INSTALL_PLIST) | cut -d':' -f2)) | tar xpf - -C $(STAGING_DIR) endif post_copy_target: $(COPY_TARGET)