DSM 7.0 - SynoCommunity/spksrc GitHub Wiki

DSM 7

Developers

Developer Guide: https://global.download.synology.com/download/Document/Software/DeveloperGuide/Os/DSM/All/enu/DSM_Developer_Guide_7_enu.pdf

# only for the wallabag package
git checkout dsm7-packages

build all supported arches:

make -j`nproc` arch-x64-7.0 arch-armv7-7.0 arch-aarch64-7.0 arch-evansport-7.0

noarch build:

make && make TCVERSION=7.0

New makefile variables

  • SYSTEM_GROUP = http
    • add package to a system group (e.g. http, system)
  • SPK_GROUP
    • override group, the default is sc-{packagename}
    • Synology uses this to add the package to a group, if the group already exists in the GUI the group will be renamed to {groupname}__PKG_. Synology also uses it for the following command, during package install/upgrade.
      • chown sc-{packagename}:{SPK_GROUP}
  • SPK_USR_LOCAL_LINKS
    • Allows the package to link files to /usr/local/etc and /usr/local/lib
    • e.g. SPK_USR_LOCAL_LINKS = etc:var/foo lib:libs/bar

Changes

  • ${SYNOPKG_PKGDEST}/var/ -> ${SYNOPKG_PKGVAR}
    • migrate files to preserve user settings/preferences from a DSM 6 package
      • pre-DSM7, SYNOPKG_PKGVAR gets set to SYNOPKG_PKGDEST/var to keep forwards compatibility and make migrating packages easier.
    • package files are only moved to permanent storage if SYNOPKG_PKGVAR is empty
    • /var/packages/{package}/target/var -> /var/packages/{package}/var
    • Why? On DSM7 SYNOPKG_PKGDEST gets overridden during package upgrades. See the Package Filesystem Hierarchy Standard (FHS) below.
  • generic uninstall script:
    • new uninstall wizard which allows the user to choose whether to remove all files in
      • /var/packages/{package}/var
      • /var/packages/{package}/etc
      • /var/packages/{package}/home
      • /var/packages/{package}/tmp
  • newer GCC versions
  • packages are executed with package permissions
  • new log file location during install
    • /var/log/packages/{package}.log

Deprecated/Unsupported

  • assuming root privileges in install/startup scripts or while running service
    • inc. chmod, chown, su, synouser, synogroup etc.
    • synoacltool -get is still allowed
  • package managed groups e.g sc-download, sc-media
  • busybox
  • SPK_LINKS please use SPK_USR_LOCAL_LINKS instead
  • the former installer created link /usr/local/{package-name} -> /var/packages/{package-name}/target is not supported anymore due to restricted permissions. Any package specific installation or configuration must be updated to use /var/packages/{package-name}/target instead of /usr/local/{package-name}. This does not need DSM7 specific installer code as it is backwards compatible.

Known Issue

On armv7 and aarch64 the gold linker in the toolchain is broken. See #4494

Learnings

  • package users (sc-{packagename}) show up as "System Internal User" for shared folder permissions
  • package users (sc-{packagename}) can have permissions set in the file manager for more granular control
  • package groups no longer show up in the GUI
  • VAAPI (for hardware acceleration) with ffmpeg make sure the resource file contains:
    • conf/resource: {"video-driver":{}}
    • This is needed to gain access to /dev/dri/renderD128
  • Package Filesystem Hierarchy Standard:
Directory Purpose Mode Creation Timing Remove Timing Script Variable
etc permanant config storage 0755 installed/upgraded none none
var (since 7.0-40314) permanant data storage 0755 installed/upgraded none SYNOPKG_PKGVAR
tmp (since 7.0-40356) temporary data storage 0755 installed/upgraded uninstalled/upgrading SYNOPKG_PKGTMP
home (since 7.0-40759) private storage 0700 installed/upgraded none SYNOPKG_PKGHOME
target data extracted from `package.tgz 0755 installed/upgraded uninstalled/upgrading SYNOPKG_PKGDEST
/var/packages/[package_name]
├── etc -> /usr/syno/etc/packages/[package_name]
├── var -> /volume[volume_number]/@appdata/[package_name]
├── tmp -> /volume[volume_number]/@apptemp/[package_name]
├── home -> /volume[volume_number]/@apphome/[package_name]
└── target -> /volume[volume_number]/@appstore/[package_name]

Package migration

  • Shared folder permissions: see Transmission package for an example
    • set SERVICE_WIZARD_SHARE = wizard_download_dir in makefile
    • update install wizard
  • WebServer with php: see Adminer package for an example
  • Create a Database with MariaDB: see Wallabag package for an example - resource file - wizards
  • packages with SPK_COMMANDS will function with no major changes
    • All specified files will auto link to /usr/local/bin/
  • SERVICE_EXE / (start-stop-daemon) with busybox
    • must migrate using the generic service script:
    • SERVICE_COMMAND=
      • SVC_BACKGROUND=y
      • SVC_WRITE_PID=y

End users

Permission migration

Option 1 - Full Shared Folder access

  • Control Panel > Shared Folder > Edit > Permissions > System internal user

edit-permissions shared-folder-permissions

Option 2 - Per folder access

In DSM File Station, select target folder, open "Properties" with right click and open the "Permissions" tab.

parent-folder-permissions per-folder-permissions apply-to-sub-permissions