Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define var using localstatedir and use rsync #4797

Closed
wants to merge 42 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
fc7e46d
spksrc: Create new staging/_var directory tree
th0ma7 Aug 18, 2021
5108254
spksrc: Do not copy empty folders from staging
th0ma7 Aug 18, 2021
464d211
spksrc: By default define LOCALSTATEDIR and --localstatedir
th0ma7 Aug 18, 2021
089eded
installer.dsm7: Use rsync, backup, and install new files at dest
th0ma7 Aug 18, 2021
09dcf94
spksrc: Fix typo ETC -> VAR
th0ma7 Aug 18, 2021
678753f
spksrc: Code alignment to previous entry
th0ma7 Aug 18, 2021
a61e111
mk: Only apply --localstatedir when >= DSM-7.0
th0ma7 Sep 8, 2021
ba4d2af
directories.mk: Add STAGING_INSTALL_PREFIX_VAR and adjust to _var
th0ma7 Sep 8, 2021
a460056
zap2epg: Use new STAGING_INSTALL_PREFIX_VAR variable
th0ma7 Sep 8, 2021
53fd214
spksrc.service.installer.dsm7: Remove backup as unecessary
th0ma7 Sep 8, 2021
05c91bc
directories.mk: INSTALL_PREFIX_VAR must point to target/../var
th0ma7 Sep 10, 2021
ef725d0
Migrate cross/* to using *INSTALL_PREFIX_VAR as needed
th0ma7 Sep 10, 2021
c08216c
spk/* Migrate to using STAGING_SPKVAR
th0ma7 Sep 10, 2021
addccb6
directories.mk: Only set target/../var when building from spk/*
th0ma7 Sep 10, 2021
0d06520
mk: Fix var from spk/* and output [var] value at configure time
th0ma7 Sep 10, 2021
7f06b3f
copy.mk: noarch may have no staging/_var directory
th0ma7 Sep 13, 2021
8f10f47
copy.mk: Fix conditional copying
th0ma7 Sep 14, 2021
7f45735
demoservice: Add README files to other generic directories
th0ma7 Sep 28, 2021
3925409
copy.mk: Manage staging/_var copy for DSM >= 7.0
th0ma7 Sep 28, 2021
f02919f
spk.mk: Also include files in staging root directory in package.tgz
th0ma7 Sep 28, 2021
e45074d
copy,mk: Embed creation of staging directory due to parallel build
th0ma7 Sep 28, 2021
7e7b8c9
installer.dsm7: Use tmp directory for DSM6->7 migration
th0ma7 Sep 28, 2021
01b0673
copy.mk: mkdir also needed for DSM <= 6
th0ma7 Sep 28, 2021
cf592e7
copy.mk: Fix _var when empty use case
th0ma7 Sep 29, 2021
0c379d1
salt-master: Fix package creation due to missing privilege file
th0ma7 Sep 29, 2021
0418a4f
installer.dsm7: Fix pre and postupgrade
th0ma7 Sep 30, 2021
e0bf76f
directories.mk: Provide more info in comment and fix typo
th0ma7 Oct 1, 2021
c0ece06
squidguard: Fix conflicts after rebase against master with #4695
th0ma7 Oct 1, 2021
f2563a5
ffsync: Use default target path
th0ma7 Oct 1, 2021
ca2e84f
squidguard: Make config refer to INSTALL_PREFIX_VAR dynamically
th0ma7 Oct 1, 2021
9644d77
c-icap: Change config dynamically and refer to INSTALL_PREFIX_VAR
th0ma7 Oct 1, 2021
a035c0c
squidclamav: Refer to INSTALL_PREFIX_VAR when updating config
th0ma7 Oct 1, 2021
51fa616
squidguard: Use INSTALL_PREFIX_VAR for db and logs
th0ma7 Oct 1, 2021
effcf7d
squidguardmanager: Use STAGING_INSTALL_PREFIX_VAR for installation
th0ma7 Oct 1, 2021
a749fd5
install.mk: Manage PLIST for target/../ when building for DSM >= 7
th0ma7 Oct 2, 2021
4ef3975
spk/*: Migrate SYNOPKG_PKGDEST/var to SYNOPKG_SPKVAR
th0ma7 Oct 5, 2021
3cd7dc4
pre-check.mk: Add option to declare broken packages
th0ma7 Oct 6, 2021
b385c9b
directories.mk: Add missing endif after rebasing to master
th0ma7 Oct 25, 2021
8f743a4
mutt: Fix Muttrc creation after master rebasing
th0ma7 Oct 26, 2021
f88a46b
sickchill: Back to being fully functional
th0ma7 Nov 20, 2021
fc48fa1
umurmur: Missing separator
th0ma7 Dec 8, 2021
062e3a1
kiwix: Migrate to using STAGING_SPKVAR
th0ma7 Dec 8, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cross/c_icap/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ c_icap_pre_configure:

.PHONY: c_icap_post_install
c_icap_post_install:
@$(RUN) sed -i 's?^PidFile .*?PidFile $(INSTALL_PREFIX)/var/run/c-icap/c-icap.pid?' $(STAGING_INSTALL_PREFIX)/etc/c-icap.conf
@$(RUN) sed -i 's?^CommandsSocket .*?CommandsSocket $(INSTALL_PREFIX)/var/run/c-icap/c-icap.ctl?' $(STAGING_INSTALL_PREFIX)/etc/c-icap.conf
@$(RUN) sed -i 's?^PidFile .*?PidFile $(INSTALL_PREFIX_VAR)/run/c-icap/c-icap.pid?' $(STAGING_INSTALL_PREFIX)/etc/c-icap.conf
@$(RUN) sed -i 's?^CommandsSocket .*?CommandsSocket $(INSTALL_PREFIX_VAR)/run/c-icap/c-icap.ctl?' $(STAGING_INSTALL_PREFIX)/etc/c-icap.conf
@$(RUN) sed -i 's?^Port .*?Port 10344?' $(STAGING_INSTALL_PREFIX)/etc/c-icap.conf
2 changes: 1 addition & 1 deletion cross/domoticz/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ domoticz_pre_compile:

.PHONY: domoticz_install
domoticz_install:
install -d $(STAGING_INSTALL_PREFIX)/bin $(STAGING_INSTALL_PREFIX)/var
install -d $(STAGING_INSTALL_PREFIX)/bin $(STAGING_INSTALL_PREFIX_VAR)
install -m 755 $(CMAKE_BUILD_DIR)/domoticz $(STAGING_INSTALL_PREFIX)/bin
install -m 755 $(CMAKE_BUILD_DIR)/extern/minizip/libminizip.so $(STAGING_INSTALL_PREFIX)/lib
@$(RUN) cp -R www $(STAGING_INSTALL_PREFIX)
Expand Down
2 changes: 1 addition & 1 deletion cross/dropbear/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ COMPILE_MAKE_OPTIONS += dropbear scp dbclient dropbearkey dropbearconvert
COMPILE_MAKE_OPTIONS += DSS_PRIV_FILENAME=$(INSTALL_PREFIX)/etc/dropbear/dropbear_dss_host_key
COMPILE_MAKE_OPTIONS += RSA_PRIV_FILENAME=$(INSTALL_PREFIX)/etc/dropbear/dropbear_rsa_host_key
COMPILE_MAKE_OPTIONS += MAX_AUTH_TRIES=3
COMPILE_MAKE_OPTIONS += DROPBEAR_PIDFILE=$(INSTALL_PREFIX)/var/dropbear.pid
COMPILE_MAKE_OPTIONS += DROPBEAR_PIDFILE=$(INSTALL_PREFIX_VAR)/dropbear.pid
COMPILE_MAKE_OPTIONS += DEFAULT_PATH=$(DROPBEAR_DEFAULT_PATH)
COMPILE_MAKE_OPTIONS += _PATH_SSH_PROGRAM=$(INSTALL_PREFIX)/bin/dbclient

Expand Down
2 changes: 1 addition & 1 deletion cross/openssh/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ GNU_CONFIGURE = 1
INSTALL_TARGET = openssh_install
POST_INSTALL_TARGET = openssh_post_install

CONFIGURE_ARGS = --with-privsep-path=$(INSTALL_PREFIX)/var/empty
CONFIGURE_ARGS = --with-privsep-path=$(INSTALL_PREFIX_VAR)/empty
CONFIGURE_ARGS += --disable-lastlog --disable-strip
CONFIGURE_ARGS += --disable-utmp --disable-utmpx
CONFIGURE_ARGS += --disable-wtmp --disable-wtmpx
Expand Down
2 changes: 1 addition & 1 deletion cross/squidclamav/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ include ../../mk/spksrc.cross-cc.mk

.PHONY: squidclamav_post_install
squidclamav_post_install:
@$(RUN) sed -i 's?^clamd_local .*?clamd_local $(INSTALL_PREFIX)/var/run/clamd/clamd.ctl?' $(STAGING_INSTALL_PREFIX)/etc/squidclamav.conf
@$(RUN) sed -i 's?^clamd_local .*?clamd_local $(INSTALL_PREFIX_VAR)/run/clamd/clamd.ctl?' $(STAGING_INSTALL_PREFIX)/etc/squidclamav.conf
16 changes: 8 additions & 8 deletions cross/squidguard/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ include ../../mk/spksrc.cross-cc.mk

CONFIGURE_ARGS = --with-db=$(INSTALL_PREFIX)
CONFIGURE_ARGS += --prefix=$(INSTALL_PREFIX)
CONFIGURE_ARGS += --with-sg-dbhome=$(INSTALL_PREFIX)/var/db
CONFIGURE_ARGS += --with-sg-config=$(INSTALL_PREFIX)/etc/squidguard.conf
CONFIGURE_ARGS += --with-sg-logdir=$(INSTALL_PREFIX)/var/logs
CONFIGURE_ARGS += --with-sg-dbhome=$(INSTALL_PREFIX_VAR)/db
CONFIGURE_ARGS += --with-sg-logdir=$(INSTALL_PREFIX_VAR)/logs
CONFIGURE_ARGS += --with-squiduser=$(USER)
CONFIGURE_ARGS += -with-mysql=no
CONFIGURE_ARGS += --with-ldap-inc=no
Expand All @@ -36,9 +36,9 @@ squidguard_pre_configure:

.PHONY: squidguard_post_install
squidguard_post_install:
@$(RUN) install -m 755 -d $(STAGING_INSTALL_PREFIX)/var/db
@$(RUN) wget $(DB_FILE) -O $(STAGING_INSTALL_PREFIX)/var/db/blacklists.tar.gz
@$(RUN) tar xvzf $(STAGING_INSTALL_PREFIX)/var/db/blacklists.tar.gz -C $(STAGING_INSTALL_PREFIX)/var/db
@$(RUN) cp -R $(STAGING_INSTALL_PREFIX)/var/db/blacklists/* $(STAGING_INSTALL_PREFIX)/var/db/
@$(RUN) rm -Rf $(STAGING_INSTALL_PREFIX)/var/db/blacklists*
@$(RUN) install -m 755 -d $(STAGING_INSTALL_PREFIX)/var/www/squidguardmgr/
@$(RUN) install -m 755 -d $(STAGING_INSTALL_PREFIX_VAR)/db
@$(RUN) wget $(DB_FILE) -O $(STAGING_INSTALL_PREFIX_VAR)/db/blacklists.tar.gz
@$(RUN) tar xvzf $(STAGING_INSTALL_PREFIX_VAR)/db/blacklists.tar.gz -C $(STAGING_INSTALL_PREFIX_VAR)/db
@$(RUN) cp -R $(STAGING_INSTALL_PREFIX_VAR)/db/blacklists/* $(STAGING_INSTALL_PREFIX_VAR)/db/
@$(RUN) rm -Rf $(STAGING_INSTALL_PREFIX_VAR)/db/blacklists*
@$(RUN) install -m 755 -d $(STAGING_INSTALL_PREFIX_VAR)/www/squidguardmgr/
24 changes: 12 additions & 12 deletions cross/squidguardmanager/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ $(SRC_DIR)squid_wrapper/squid_wrapper:

.PHONY: squidguardmgr_install
squidguardmgr_install:
@$(RUN) mkdir -p $(STAGING_INSTALL_PREFIX)/var/www/squidguardmgr
@$(RUN) cp $(SRC_DIR)squid_wrapper/squid_wrapper $(STAGING_INSTALL_PREFIX)/var/www/squidguardmgr/
@$(RUN) cp -R $(WORK_DIR)/$(PKG_DIR)/cgi-bin/* $(STAGING_INSTALL_PREFIX)/var/www/squidguardmgr/
@$(RUN) cp -R $(WORK_DIR)/$(PKG_DIR)/htdocs/* $(STAGING_INSTALL_PREFIX)/var/www/squidguardmgr/
@$(RUN) chmod 775 $(STAGING_INSTALL_PREFIX)/var/www/squidguardmgr/*cgi
@$(RUN) chmod 755 $(STAGING_INSTALL_PREFIX)/var/www/squidguardmgr/squid_wrapper
@$(RUN) sed -i 's?/usr/local/bin/squidGuard?$(INSTALL_PREFIX)/bin/squidGuard?' $(STAGING_INSTALL_PREFIX)/var/www/squidguardmgr/squidguardmgr.cgi
@$(RUN) sed -i 's?/usr/local/squidGuard/squidguard.conf?$(INSTALL_PREFIX)/etc/squidguard.conf?' $(STAGING_INSTALL_PREFIX)/var/www/squidguardmgr/squidguardmgr.cgi
@$(RUN) sed -i 's?/usr/bin/squidclamav?$(INSTALL_PREFIX)/libexec/squidclamav?' $(STAGING_INSTALL_PREFIX)/var/www/squidguardmgr/squidguardmgr.cgi
@$(RUN) sed -i 's?/etc/squidclamav.conf?$(INSTALL_PREFIX)/etc/squidclamav.conf?' $(STAGING_INSTALL_PREFIX)/var/www/squidguardmgr/squidguardmgr.cgi
@$(RUN) sed -i 's?/var/www/squidguardmgr/squid_wrapper?$(INSTALL_PREFIX)/var/www/squidguardmgr/squid_wrapper?' $(STAGING_INSTALL_PREFIX)/var/www/squidguardmgr/squidguardmgr.cgi
@$(RUN) sed -i 's?/var/run/c-icap/c-icap.ctl?$(INSTALL_PREFIX)/var/run/c-icap/c-icap.ctl?' $(STAGING_INSTALL_PREFIX)/var/www/squidguardmgr/squidguardmgr.cgi
@$(RUN) mkdir -p $(STAGING_INSTALL_PREFIX_VAR)/www/squidguardmgr
@$(RUN) cp $(SRC_DIR)squid_wrapper/squid_wrapper $(STAGING_INSTALL_PREFIX_VAR)/www/squidguardmgr/
@$(RUN) cp -R $(WORK_DIR)/$(PKG_DIR)/cgi-bin/* $(STAGING_INSTALL_PREFIX_VAR)/www/squidguardmgr/
@$(RUN) cp -R $(WORK_DIR)/$(PKG_DIR)/htdocs/* $(STAGING_INSTALL_PREFIX_VAR)/www/squidguardmgr/
@$(RUN) chmod 775 $(STAGING_INSTALL_PREFIX_VAR)/www/squidguardmgr/*cgi
@$(RUN) chmod 755 $(STAGING_INSTALL_PREFIX_VAR)/www/squidguardmgr/squid_wrapper
@$(RUN) sed -i 's?/usr/local/bin/squidGuard?$(INSTALL_PREFIX)/bin/squidGuard?' $(STAGING_INSTALL_PREFIX_VAR)/www/squidguardmgr/squidguardmgr.cgi
@$(RUN) sed -i 's?/usr/local/squidGuard/squidguard.conf?$(INSTALL_PREFIX)/etc/squidguard.conf?' $(STAGING_INSTALL_PREFIX_VAR)/www/squidguardmgr/squidguardmgr.cgi
@$(RUN) sed -i 's?/usr/bin/squidclamav?$(INSTALL_PREFIX)/libexec/squidclamav?' $(STAGING_INSTALL_PREFIX_VAR)/www/squidguardmgr/squidguardmgr.cgi
@$(RUN) sed -i 's?/etc/squidclamav.conf?$(INSTALL_PREFIX)/etc/squidclamav.conf?' $(STAGING_INSTALL_PREFIX_VAR)/www/squidguardmgr/squidguardmgr.cgi
@$(RUN) sed -i 's?/var/www/squidguardmgr/squid_wrapper?$(INSTALL_PREFIX_VAR)/www/squidguardmgr/squid_wrapper?' $(STAGING_INSTALL_PREFIX_VAR)/www/squidguardmgr/squidguardmgr.cgi
@$(RUN) sed -i 's?/var/run/c-icap/c-icap.ctl?$(INSTALL_PREFIX_VAR)/run/c-icap/c-icap.ctl?' $(STAGING_INSTALL_PREFIX_VAR)/www/squidguardmgr/squidguardmgr.cgi
4 changes: 2 additions & 2 deletions cross/zap2epg/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ include ../../mk/spksrc.install-resources.mk
zap2epg_install:
install -m 755 -d $(STAGING_INSTALL_PREFIX)/bin
install -m 755 $(WORK_DIR)/$(PKG_DIR)/tv_grab_zap2epg $(STAGING_INSTALL_PREFIX)/bin
install -m 750 -d $(STAGING_INSTALL_PREFIX)/var/epggrab/conf
install -m 640 $(WORK_DIR)/$(PKG_DIR)/epggrab/conf/zap2epg.xml $(STAGING_INSTALL_PREFIX)/var/epggrab/conf
install -m 750 -d $(STAGING_INSTALL_PREFIX_VAR)/epggrab/conf
install -m 640 $(WORK_DIR)/$(PKG_DIR)/epggrab/conf/zap2epg.xml $(STAGING_INSTALL_PREFIX_VAR)/epggrab/conf
7 changes: 7 additions & 0 deletions mk/spksrc.configure.mk
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,18 @@ REAL_CONFIGURE_ARGS =
ifneq ($(strip $(GNU_CONFIGURE)),)
REAL_CONFIGURE_ARGS += $(TC_CONFIGURE_ARGS)
REAL_CONFIGURE_ARGS += --prefix=$(INSTALL_PREFIX)
# DSM7 appdir
ifeq ($(call version_ge, ${TCVERSION}, 7.0),1)
REAL_CONFIGURE_ARGS += --localstatedir=$(INSTALL_PREFIX_VAR)
endif
endif
REAL_CONFIGURE_ARGS += $(CONFIGURE_ARGS)

configure_msg:
@$(MSG) "Configuring for $(NAME)"
@$(MSG) - Configure ARGS: $(CONFIGURE_ARGS)
@$(MSG) - Install prefix: $(INSTALL_PREFIX)
@$(MSG) - Install prefix [var]: $(INSTALL_PREFIX_VAR)

pre_configure_target: configure_msg

Expand Down
15 changes: 13 additions & 2 deletions mk/spksrc.copy.mk
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,24 @@ endif
copy_msg:
@$(MSG) "Creating target installation dir of $(NAME)"
@rm -fr $(STAGING_DIR)
@mkdir $(STAGING_DIR)

pre_copy_target: copy_msg

copy_target: $(PRE_COPY_TARGET) $(INSTALL_PLIST)
(cd $(INSTALL_DIR)/$(INSTALL_PREFIX) && tar cpf - `cat $(INSTALL_PLIST) | cut -d':' -f2`) | \
ifeq ($(call version_ge, ${TCVERSION}, 7.0),1)
@$(MSG) Copy target to staging, discard var directory [DSM7]
@(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) Copy var to STAGING_SPKVAR
@if [ "`cat $(INSTALL_PLIST) | sed -n 's?^.*:var/??p'`" ] ; then \
(mkdir -p $(STAGING_SPKVAR) && cd $(INSTALL_DIR)/$(INSTALL_PREFIX_VAR) && tar cpf - `cat $(INSTALL_PLIST) | sed -n 's?^.*:var/??p'`) | \
tar xpf - -C $(STAGING_SPKVAR) ; \
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)
endif

post_copy_target: $(COPY_TARGET)

Expand Down
5 changes: 5 additions & 0 deletions mk/spksrc.cross-cmake-env.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ CMAKE_ARGS += -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE
CMAKE_ARGS += -DCMAKE_BUILD_WITH_INSTALL_RPATH=TRUE
CMAKE_ARGS += -DBUILD_SHARED_LIBS=ON

# DSM7 appdir
ifeq ($(call version_ge, ${TCVERSION}, 7.0),1)
CMAKE_ARGS += -DCMAKE_INSTALL_LOCALSTATEDIR=$(INSTALL_PREFIX_VAR)
endif

# Use native cmake
ifeq ($(strip $(USE_NATIVE_CMAKE)),1)
BUILD_DEPENDS += native/cmake
Expand Down
29 changes: 27 additions & 2 deletions mk/spksrc.directories.mk
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ endif
ifndef INSTALL_DIR
INSTALL_DIR = $(WORK_DIR)/install
endif
STAGING_DIR = $(WORK_DIR)/staging

ifndef INSTALL_PREFIX
ifneq ($(strip $(SPK_NAME)),)
Expand All @@ -51,6 +50,33 @@ ifeq ($(strip $(STAGING_INSTALL_PREFIX)),)
STAGING_INSTALL_PREFIX = $(INSTALL_DIR)$(INSTALL_PREFIX)
endif

#
# When building spk packages set var directory under
# target/../var to be consequent with the new directory
# structure using localstatedir flag. But only do so
# when invoking make from under spk/*. Setting var when
# test-building dependencies from under cross/* is unecessary.
#
ifeq ($(call version_ge, ${TCVERSION}, 7.0),1)
ifeq ($(lastword $(subst /, ,$(INSTALL_PREFIX))),target)
INSTALL_PREFIX_VAR = $(INSTALL_PREFIX)/../var
endif
endif
ifeq ($(strip $(INSTALL_PREFIX_VAR)),)
INSTALL_PREFIX_VAR = $(INSTALL_PREFIX)/var
endif
STAGING_INSTALL_PREFIX_VAR = $(INSTALL_DIR)$(INSTALL_PREFIX_VAR)

ifeq ($(strip $(STAGING_DIR)),)
STAGING_DIR = $(WORK_DIR)/staging
endif

ifeq ($(call version_ge, ${TCVERSION}, 7.0),1)
STAGING_SPKVAR = $(STAGING_DIR)/_var
else
STAGING_SPKVAR = $(STAGING_DIR)/var
endif

# python wheelhouse directories
ifndef WHEELHOUSE
WHEELHOUSE = $(WORK_DIR)/wheelhouse
Expand All @@ -63,4 +89,3 @@ endif
define create_target_dir
@mkdir -p `dirname $@`
endef

18 changes: 14 additions & 4 deletions mk/spksrc.install.mk
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ INSTALL_COOKIE = $(WORK_DIR)/.$(COOKIE_PREFIX)install_done
INSTALL_PLIST = $(WORK_DIR)/$(PKG_NAME).plist
PRE_INSTALL_PLIST = $(INSTALL_PLIST).tmp

# Define find search path for creating plist
ifeq ($(call version_ge, ${TCVERSION}, 7.0),1)
ifeq ($(lastword $(subst /, ,$(INSTALL_PREFIX))),target)
PLIST_SEARCH_PATH = $(INSTALL_DIR)/$(INSTALL_PREFIX)/../
endif
endif
ifeq ($(strip $(PLIST_SEARCH_PATH)),)
PLIST_SEARCH_PATH = $(INSTALL_DIR)/$(INSTALL_PREFIX)/
endif

$(PRE_INSTALL_PLIST): install_msg_target
ifeq ($(strip $(PRE_INSTALL_TARGET)),)
PRE_INSTALL_TARGET = pre_install_target
Expand All @@ -47,8 +57,8 @@ install_msg_target:

$(PRE_INSTALL_PLIST):
$(create_target_dir)
@mkdir -p $(INSTALL_DIR)/$(INSTALL_PREFIX)
find $(INSTALL_DIR)/$(INSTALL_PREFIX)/ \! -type d -printf '%P\n' | sort > $@
@mkdir -p $(INSTALL_DIR)/$(INSTALL_PREFIX) $(INSTALL_DIR)/$(INSTALL_PREFIX_VAR)
find $(PLIST_SEARCH_PATH) \! -type d -printf '%P\n' | sed 's?^target/??g' | sort > $@

pre_install_target: install_msg_target $(PRE_INSTALL_PLIST)

Expand All @@ -61,8 +71,8 @@ install_destdir_target: $(PRE_INSTALL_TARGET)
post_install_target: $(INSTALL_TARGET)

$(INSTALL_PLIST):
find $(INSTALL_DIR)/$(INSTALL_PREFIX)/ \! -type d -printf '%P\n' | sort | \
diff $(PRE_INSTALL_PLIST) - | grep '>' | cut -d' ' -f2- > $@
find $(PLIST_SEARCH_PATH)/ \! -type d -printf '%P\n' | sed 's?^target/??g' | sort | \
diff $(PRE_INSTALL_PLIST) - | grep '>' | sed 's?> ??g' > $@
# Generate $(PKG_NAME).plist.auto for newly added files (diff against .tmp)
comm -3 $(PRE_INSTALL_PLIST) $(INSTALL_PLIST) > $(INSTALL_PLIST).auto

Expand Down
52 changes: 44 additions & 8 deletions mk/spksrc.service.installer.dsm7
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,33 @@ call_func "reload_inst_variables"
# init variables either reloaded, from package or from wizard
call_func "initialize_variables"


### Functions library

#
# New DSM7 folders: copy no-verwrite + remove source
# (@appdata) /var/packages/<package>/target/_var -> /var/packages/<package>/target/../var
#
syno_sync_app_folders () {
for appdir in $(find ${SYNOPKG_PKGDEST} -mindepth 1 -maxdepth 1 -not -empty -type d -name "_*");
do
dest=/var/packages/${SYNOPKG_PKGNAME}/${appdir##*_}

# Copy and delete all files except don't overwrite any existing
echo "$RSYNC --ignore-existing --remove-source-files ${SYNOPKG_PKGDEST}/_${appdir##*_}/ ${dest}"
$RSYNC --ignore-existing --remove-source-files ${SYNOPKG_PKGDEST}/_${appdir##*_}/ ${dest}

# Rename any remaining (thus pre-existing) files with .new suffix
find ${SYNOPKG_PKGDEST}/_${appdir##*_} -type f -exec sh -c 'x="{}"; mv "$x" "${x}.new"' \;

# Force-copy and delete all .new files
echo "$RSYNC --remove-source-files ${SYNOPKG_PKGDEST}/_${appdir##*_}/ ${dest}"
$RSYNC --remove-source-files ${SYNOPKG_PKGDEST}/_${appdir##*_}/ ${dest}

# Remove remaining directory
$RM ${SYNOPKG_PKGDEST}/_${appdir##*_}
done
}

set_unix_permissions ()
{
echo "Notice: set_unix_permissions() is no longer required on DSM7."
Expand Down Expand Up @@ -128,9 +152,7 @@ postinst ()

# copy target/var data to permanent storage
# and don't override old configurations
if [ -d ${SYNOPKG_PKGDEST}/var ] && [ "$(find ${SYNOPKG_PKGVAR} -mindepth 1 -not -name '*.log' -print)" = "" ]; then
$CP ${SYNOPKG_PKGDEST}/var/. ${SYNOPKG_PKGVAR} 2>&1 | install_log
fi
call_func "syno_sync_app_folders" install_log

call_func "service_postinst" install_log

Expand Down Expand Up @@ -177,10 +199,12 @@ preupgrade ()
call_func "validate_preupgrade"

# dsm6 -> dsm7
# Migrate data to permanent storage
if [ -d ${SYNOPKG_PKGDEST}/var -a ! "$(ls -A ${SYNOPKG_PKGVAR})" ]; then
# only migrate when destination is empty
$CP ${SYNOPKG_PKGDEST}/var/. ${SYNOPKG_PKGVAR} 2>&1 | install_log
# Copy first to temporary directory is upgrading from DSM6 -> DSM7
# Then migrate data once to permanent storage at postupgrade
if [ -d ${SYNOPKG_PKGDEST}/var -a "$(ls -A ${SYNOPKG_PKGDEST}/var 2>/dev/null)" ]; then
echo "$RSYNC ${SYNOPKG_PKGDEST}/var/ ${TMP_DIR}" | install_log
$RSYNC ${SYNOPKG_PKGDEST}/var/ ${TMP_DIR} 2>&1 | install_log && chk=$?
[ "${chk}" = "0" ] && rm -fr ${SYNOPKG_PKGDEST}/var || true
fi

call_func "service_preupgrade" install_log
Expand All @@ -193,6 +217,18 @@ postupgrade ()
log_step "postupgrade"

call_func "service_restore" install_log

# dsm6 -> dsm7
# Migrate data once to permanent storage at postupgrade
if [ -d ${TMP_DIR} -a "$(ls -A ${TMP_DIR} 2>/dev/null)" ]; then
echo "$RSYNC --backup --suffix=.new ${TMP_DIR}/ ${SYNOPKG_PKGVAR}" | install_log
$RSYNC --backup --suffix=.new ${TMP_DIR}/ ${SYNOPKG_PKGVAR} 2>&1 | install_log && chk=$?
[ "${chk}" = "0" ] && rm -fr ${TMP_DIR} || true
fi

# dsm7: Now sync in any new files to permanent storage
call_func "syno_sync_app_folders" install_log
call_func "service_postupgrade" install_log

exit 0
}
3 changes: 2 additions & 1 deletion mk/spksrc.service.installer.functions
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ CP="/bin/cp -rfp"
MKDIR="/bin/mkdir -p"
LN="/bin/ln -nsf"
TEE="/usr/bin/tee -a"

RSYNC="/bin/rsync -avh"
TAR="/bin/tar"

INST_ETC="/var/packages/${SYNOPKG_PKGNAME}/etc"
INST_VARIABLES="${INST_ETC}/installer-variables"
Expand Down
2 changes: 1 addition & 1 deletion mk/spksrc.spk.mk
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ $(DSM_LICENSE_FILE): $(LICENSE_FILE)
$(WORK_DIR)/package.tgz: icon service
$(create_target_dir)
@[ -f $@ ] && rm $@ || true
(cd $(STAGING_DIR) && tar cpzf $@ --owner=root --group=root *)
(cd $(STAGING_DIR) && find . -mindepth 1 -maxdepth 1 -not -empty | tar cpzf $@ --owner=root --group=root --files-from=/dev/stdin)

DSM_SCRIPTS = $(addprefix $(DSM_SCRIPTS_DIR)/,$(DSM_SCRIPT_FILES))

Expand Down
2 changes: 1 addition & 1 deletion spk/boxbackup-client/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ include ../../mk/spksrc.spk.mk

.PHONY: boxbackup-client_extra_install
boxbackup-client_extra_install:
install -m 755 -d $(STAGING_DIR)/var
install -m 755 -d $(STAGING_SPKVAR)
install -m 755 src/syno-bbackupd-config $(STAGING_DIR)/sbin/syno-bbackupd-config
install -m 755 src/syno-bbackupctl $(STAGING_DIR)/sbin/syno-bbackupctl
install -m 755 src/syno-bbackupquery $(STAGING_DIR)/sbin/syno-bbackupquery
6 changes: 3 additions & 3 deletions spk/comskip/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ comskip_pre_depend:
$(foreach lib,$(FFMPEG_LIBS),ln -sf $(FFMPEG_DIR)/lib/pkgconfig/$(lib) $(STAGING_INSTALL_PREFIX)/lib/pkgconfig/ ;)

comskip_extra_install:
install -m 755 -d $(STAGING_DIR)/var
install -m 644 src/comskip.ini $(STAGING_DIR)/var/comskip.ini
install -m 644 src/comskip.dictionary $(STAGING_DIR)/var/comskip.dictionary
install -m 755 -d $(STAGING_SPKVAR)
install -m 644 src/comskip.ini $(STAGING_SPKVAR)/comskip.ini
install -m 644 src/comskip.dictionary $(STAGING_SPKVAR)/comskip.dictionary
4 changes: 2 additions & 2 deletions spk/couchpotatoserver-custom/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ include ../../mk/spksrc.spk.mk

.PHONY: couchpotatoserver-custom_extra_install
couchpotatoserver-custom_extra_install:
install -m 755 -d $(STAGING_DIR)/var
install -m 600 src/settings.conf $(STAGING_DIR)/var/settings.conf
install -m 755 -d $(STAGING_SPKVAR)
install -m 600 src/settings.conf $(STAGING_SPKVAR)/settings.conf
6 changes: 3 additions & 3 deletions spk/couchpotatoserver-custom/src/service-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ PATH="${SYNOPKG_PKGDEST}/bin:${SYNOPKG_PKGDEST}/env/bin:${PYTHON_DIR}:${GIT_DIR}
PYTHON="${SYNOPKG_PKGDEST}/env/bin/python"
VIRTUALENV="${PYTHON_DIR}/virtualenv"
GIT="${GIT_DIR}/git"
COUCHPOTATOSERVER="${SYNOPKG_PKGDEST}/var/CouchPotatoServer/CouchPotato.py"
CFG_FILE="${SYNOPKG_PKGDEST}/var/settings.conf"
COUCHPOTATOSERVER="${SYNOPKG_PKGVAR}/CouchPotatoServer/CouchPotato.py"
CFG_FILE="${SYNOPKG_PKGVAR}/settings.conf"

GROUP="sc-download"
LEGACY_GROUP="sc-media"
Expand All @@ -28,7 +28,7 @@ service_postinst ()

if [ "${SYNOPKG_PKG_STATUS}" == "INSTALL" ]; then
# Clone the repository
${GIT} clone -q -b ${wizard_fork_branch:=master} ${wizard_fork_url:=git://github.com/CouchPotato/CouchPotatoServer.git} ${SYNOPKG_PKGDEST}/var/CouchPotatoServer
${GIT} clone -q -b ${wizard_fork_branch:=master} ${wizard_fork_url:=git://github.com/CouchPotato/CouchPotatoServer.git} ${SYNOPKG_PKGVAR}/CouchPotatoServer
fi

# Create logs directory, otherwise it might not start
Expand Down
Loading