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

Add DSM 7 Support #4395

Merged
merged 56 commits into from
Mar 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
0d79590
prepare for dsm7
publicarray Oct 12, 2020
859e729
Add 7.0 toolchain for testing
publicarray Oct 12, 2020
cfcd884
Add x64-7.0 to CI
publicarray Oct 12, 2020
40748f7
start on dsm7 install/service script
publicarray Oct 18, 2020
4eae70a
fix DSM_APP_NAME in dsm7
publicarray Oct 18, 2020
1872b1e
remove tools that require root permissions:
publicarray Dec 12, 2020
121cf68
fix username, keep DSM6 name convention sc-packagename
publicarray Dec 12, 2020
b182b0e
Issue user facing warning on unsupported functions
publicarray Dec 12, 2020
3ced581
change package icon size
hgy59 Dec 12, 2020
66d3d7c
cleanup
publicarray Dec 12, 2020
ecdeeea
Store log files, pid and other files in permanent storage
publicarray Dec 12, 2020
0ee9f48
Migrate some JSON processing to jq
publicarray Dec 20, 2020
182ed23
fix adding GROUPs DSM7
publicarray Dec 20, 2020
56ca487
join-pkg-groupnames Creates group but is different from the groups th…
publicarray Dec 22, 2020
a01babc
DSM6->DSM7 move target/var to var/
publicarray Feb 21, 2021
156551b
Added dsm7 preview toolchain for syno-armada38x-7.0
Dec 31, 2020
f57993c
Add DSM7.0 toolchains
publicarray Jan 2, 2021
716742a
Add v1000 to generic x64-7.0
publicarray Jan 2, 2021
7ded188
Add evansport DSM 7.0 Toolkit
publicarray Jan 2, 2021
49d9e57
fix builds for dsm versions < 7
publicarray Jan 2, 2021
56c1426
DSM7 Log install script to /var/log/packages/{package}.log
publicarray Jan 2, 2021
1a434a9
add back firewall install/removal
publicarray Jan 2, 2021
48fa6e7
Acquire Shared folder resource/permissions
publicarray Feb 21, 2021
5bf00d9
Only migrate /var directory to permanent storage when destination is …
publicarray Jan 2, 2021
a97d758
set SYNOPKG_PKGVAR for DSM versions less than 7.0
publicarray Jan 2, 2021
9a03505
Add uninstaller that can optionally remove all package files
publicarray Jan 3, 2021
27a8285
uninstaller: also remove /etc
publicarray Jan 3, 2021
f44477a
fix noarch in dsm7
publicarray Jan 3, 2021
3ab525e
fix missing files on clean install
publicarray Jan 3, 2021
7db9b14
Error on dropped support for busybox start-stop-daemon aka SERVICE_EXE
publicarray Jan 3, 2021
475ebd4
fix don't override old configurations
publicarray Jan 3, 2021
f0ca13c
Add ability for packages to join a SYSTEM_GROUP and cleanup
publicarray Jan 7, 2021
f2d5ca6
fix DSM6 regression and code review
publicarray Jan 7, 2021
541f846
fix regression: backwards compatibility with DSM6
publicarray Jan 12, 2021
e982641
for DSM6 don't set "groupname". fixes permission issues with sc-{groups}
publicarray Jan 13, 2021
d71e651
fix noarch for dsm7
hgy59 Jan 17, 2021
9cc4e32
update github action to build noarch-7.0 packages
hgy59 Jan 17, 2021
ff814d9
fix github build action for noarch-7.0
hgy59 Jan 17, 2021
c67bca1
another fix for noarch build action
hgy59 Jan 17, 2021
4ede543
fix DSM7 running with su command:
publicarray Jan 19, 2021
403e4e0
Toolchains: Update DSM7 hashes and fix typos
publicarray Jan 19, 2021
80ade03
Add supported DSM 7 archs to CI/GH Actions
publicarray Jan 19, 2021
14e6b55
fix os_min_vers for DSM 7 noarch
hgy59 Jan 19, 2021
5f3fab5
regenerated digests of dsm7 toolchains
hgy59 Jan 19, 2021
e1ca6fa
Add sha256 digest to evansport toolkit
publicarray Jan 24, 2021
c4de2da
fix TC_BUILD for DSM7.0
publicarray Jan 26, 2021
e4b2fb3
Apply new version comparison function
publicarray Jan 30, 2021
dbfde24
framework, resource: simplify jq command
publicarray Jan 30, 2021
94d76fa
framework: code review
publicarray Jan 30, 2021
d558293
Add linking support for /usr/local/lib and /usr/local/etc
publicarray Jan 30, 2021
d714eb1
fix SPK_USR_LOCAL_LINKS
publicarray Jan 31, 2021
2bb13c6
Fix comments being output to command line
publicarray Feb 1, 2021
0f59242
Framework: DSM7 Make sure folder exists before migrating files
publicarray Feb 1, 2021
9900138
Framework: Fix unable to override uninstall wizard
publicarray Feb 21, 2021
186f1dd
Update mk/spksrc.service.start-stop-status
publicarray Feb 24, 2021
178bd04
Fraework: avoid creating wizard folder when it's not needed
publicarray Feb 24, 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
11 changes: 8 additions & 3 deletions .github/actions/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ echo "===> ARCH packages: ${arch_packages}"
echo "===> NOARCH packages: ${noarch_packages}"
echo "::endgroup::"

if [ "${GH_ARCH}" = "noarch" ]; then
if [ "${GH_ARCH%%-*}" = "noarch" ]; then
build_packages=${noarch_packages}
else
build_packages=${arch_packages}
Expand All @@ -112,11 +112,16 @@ for package in ${build_packages}
do
echo "::group:: ---- build ${package}"

if [ "${GH_ARCH}" != "noarch" ]; then
if [ "${GH_ARCH%%-*}" != "noarch" ]; then
# use TCVERSION and ARCH to get real exit codes.
make TCVERSION=${GH_ARCH##*-} ARCH=${GH_ARCH%%-*} -C ./spk/${package}
else
make -C ./spk/${package}
if [ "${GH_ARCH}" = "noarch" ]; then
TCVERSION=
else
TCVERSION=${GH_ARCH##*-}
fi
make TCVERSION=${TCVERSION} ARCH= -C ./spk/${package}
fi
result=$?

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
matrix:
# x64=x86_64, evansport=i686, aarch64=armv8, armv7, hi3535=armv7l, 88f6281=armv5, qoriq=ppc
# https://github.com/SynoCommunity/spksrc/wiki/Synology-and-SynoCommunity-Package-Architectures
arch: [noarch, x64-6.1, evansport-6.1, aarch64-6.1, armv7-6.1, hi3535-6.1, 88f6281-6.1, qoriq-6.1]
arch: [noarch, noarch-7.0, x64-6.1, x64-7.0, evansport-6.1, evansport-7.0, aarch64-6.1, aarch64-7.0, armv7-6.1, armv7-7.0, hi3535-6.1, 88f6281-6.1, qoriq-6.1]

steps:
- name: Cache toolchains
Expand Down
5 changes: 5 additions & 0 deletions mk/spksrc.common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ COMPILE_MAKE_OPTIONS += -j$(NCPUS)
endif
endif

# Terminal colors
RED=`tput setaf 1`
GREEN=`tput setaf 2`
NC=`tput sgr0`

# Version Comparison
version_le = $(shell if printf '%s\n' "$(1)" "$(2)" | sort -VC ; then echo 1; fi)
version_ge = $(shell if printf '%s\n' "$(1)" "$(2)" | sort -VCr ; then echo 1; fi)
Expand Down
2 changes: 1 addition & 1 deletion mk/spksrc.directories.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# * all goes in $(WORK_DIR) : work-arch, or simple work, in the current directory
# * all goes in $(WORK_DIR) : work-arch (for noarch: work-all or work-dsm7), in the current directory
# * it will be installed in $(INSTALL_PREFIX) on the target system (/usr/local/transmission)
# * each source package is unpacked in $(WORK_DIR)
# * the install target installs files in $(WORK_DIR)/install/, known as $(INSTALL_DIR)
Expand Down
1 change: 1 addition & 0 deletions mk/spksrc.service.installer
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ INST_LOG="/tmp/${SYNOPKG_PKGNAME}_install.log"
INST_ETC="/var/packages/${SYNOPKG_PKGNAME}/etc"
INST_VARIABLES="${INST_ETC}/installer-variables"
INST_VAR="${SYNOPKG_PKGDEST}/var"
SYNOPKG_PKGVAR="${SYNOPKG_PKGDEST}/var" # backwards compatibility

# Optional FWPORTS file
FWPORTS_FILE="/var/packages/${SYNOPKG_PKGNAME}/conf/${SYNOPKG_PKGNAME}.sc"
Expand Down
229 changes: 229 additions & 0 deletions mk/spksrc.service.installer.dsm7
Original file line number Diff line number Diff line change
@@ -0,0 +1,229 @@
#!/bin/sh

# DSM 5 -> 7 upgrade path:
# Not supported
# DSM 6 -> 7 upgrade path:
# files are migrated from ${SYNOPKG_PKGDEST}/var to ${SYNOPKG_PKGVAR}
# Not supported (yet)

INST_ETC="/var/packages/${SYNOPKG_PKGNAME}/etc"
INST_VARIABLES="${INST_ETC}/installer-variables"
INST_VAR="${SYNOPKG_PKGVAR}"

# Optional FWPORTS file
FWPORTS_FILE="/var/packages/${SYNOPKG_PKGNAME}/conf/${SYNOPKG_PKGNAME}.sc"

TMP_DIR="${SYNOPKG_TEMP_UPGRADE_FOLDER}/var"

# Source package specific variable and functions
SVC_SETUP=`dirname $0`"/service-setup"
if [ -r "${SVC_SETUP}" ]; then
. "${SVC_SETUP}"
fi

# Reload wizard variables stored by postinst
if [ -r "${INST_VARIABLES}" ]; then
. "${INST_VARIABLES}"
fi

# Expect user to be set from package specific variables
if [ -n "${USER}" -a -z "${USER_DESC}" ]; then
USER_DESC="User running $SYNOPKG_PKGNAME"
fi

# Default description if group name provided by UI
if [ -n "${GROUP}" -a -z "${GROUP_DESC}" ]; then
GROUP_DESC="SynoCommunity Package Group"
fi

# Extract share volume and share name from download location if provided
if [ -n "${SHARE_PATH}" ]; then
SHARE_VOLUME=$(echo "${SHARE_PATH}" | awk -F/ '{print "/"$2}')
SHARE_NAME=$(echo "${SHARE_PATH}" | awk -F/ '{print $3}')
fi

# Tools shortcuts
MV="/bin/mv -f"
RM="/bin/rm -rf"
CP="/bin/cp -rfp"
MKDIR="/bin/mkdir -p"
LN="/bin/ln -nsf"
TEE="/usr/bin/tee -a"

### Functions library

log ()
{
echo "$1" 1>&2 # /var/log/packages/{package}.log
}


log_step ()
{
log $(date)
log "===> Step $1. USER=$USER GROUP=$GROUP SHARE_PATH=${SHARE_PATH}"
}

save_wizard_variables ()
{
if [ -e "${INST_VARIABLES}" ]; then
$RM "${INST_VARIABLES}"
fi
if [ -n "${GROUP}" ]; then
echo "GROUP=${GROUP}" >> ${INST_VARIABLES}
fi
if [ -n "${SHARE_PATH}" ]; then
echo "SHARE_PATH=${SHARE_PATH}" >> ${INST_VARIABLES}
fi
}

set_unix_permissions ()
{
log "${SYNOPKG_PKGNAME} has not been updated to DSM7 yet. set_unix_permissions() is no longer supported."
}

syno_remove_user ()
{
log "${SYNOPKG_PKGNAME} has not been updated to DSM7 yet. syno_remove_user() is no longer supported."
}

syno_group_create ()
{
log "${SYNOPKG_PKGNAME} has not been updated to DSM7 yet. syno_group_create() is no longer supported."
}

syno_group_remove ()
{
log "${SYNOPKG_PKGNAME} has not been updated to DSM7 yet. syno_group_remove() is no longer supported."
}

syno_user_add_to_group ()
{
log "${SYNOPKG_PKGNAME} has not been updated to DSM7 yet. syno_user_add_to_group() is no longer supported."
}

set_syno_permissions ()
{
log "${SYNOPKG_PKGNAME} has not been updated to DSM7 yet. set_syno_permissions() is no longer supported."
}

syno_user_add_to_legacy_group () {
log "${SYNOPKG_PKGNAME} has not been updated to DSM7 yet. syno_user_add_to_legacy_group() is no longer supported."
}


### Generic package behaviors

preinst ()
{
log_step "preinst"
call_func "service_preinst"

# Check volume exists
if [ -n "${SHARE_PATH}" ]; then
if [ ! -d "${SHARE_VOLUME}" ]; then
echo "Volume ${SHARE_VOLUME} does not exist." | $TEE 1>&2
exit 1
fi
fi

exit 0
}

postinst ()
{
log_step "postinst"
save_wizard_variables

# 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 -RT ${SYNOPKG_PKGDEST}/var/. ${SYNOPKG_PKGVAR}
fi

if [ "${SYNOPKG_PKG_STATUS}" == "INSTALL" ]; then
# Add firewall config
if [ -r "${FWPORTS_FILE}" ]; then
echo "Installing service configuration ${FWPORTS_FILE}" >> ${INST_LOG}
servicetool --install-configure-file --package "${FWPORTS_FILE}" >> ${INST_LOG} 2>&1
fi
fi

call_func "service_postinst"
call_func "service_create_links"

exit 0
}

preuninst ()
{
log_step "preuninst"

if [ "${SYNOPKG_PKG_STATUS}" == "UNINSTALL" ]; then
# Remove firewall config
if [ -r "${FWPORTS_FILE}" ]; then
echo "Removing service configuration ${SYNOPKG_PKGNAME}.sc" >> ${INST_LOG}
servicetool --remove-configure-file --package "${SYNOPKG_PKGNAME}.sc" >> ${INST_LOG} 2>&1
fi
fi

call_func "service_preuninst"
exit 0
}

postuninst ()
{
log_step "postuninst"

call_func "service_postuninst"
call_func "service_remove_links"

if [ "$wizard_delete_data" = "true" ]; then

if [ "$(ls -A ${SYNOPKG_PKGHOME})" != "" ]; then
rm -rf ${SYNOPKG_PKGHOME}/
fi

if [ "$(ls -A ${SYNOPKG_PKGVAR})" != "" ]; then
rm -rf ${SYNOPKG_PKGVAR}/
fi

if [ "$(ls -A /var/packages/${SYNOPKG_PKGNAME}/etc)" != "" ]; then
rm -rf /var/packages/${SYNOPKG_PKGNAME}/etc/
fi

if ["$(ls -A ${SYNOPKG_PKGTMP})" != "" ]; then
rm -rf ${SYNOPKG_PKGTMP}/
fi
fi
exit 0
}

preupgrade ()
{
log_step "preupgrade"

# dsm6 -> dsm7
# Migrate data to permanent storage
if [ ! "$(ls -A ${SYNOPKG_PKGVAR})" ]; then
# only migrate when destination is empty
$CP -RT ${SYNOPKG_PKGDEST}/var/. ${SYNOPKG_PKGVAR}
fi

call_func "service_preupgrade"

call_func "service_save"

exit 0
}

postupgrade ()
{
log_step "postupgrade"

call_func "service_restore"

call_func "service_postupgrade"

exit 0
}
Loading