Editing Synology package files
Jump to navigation
Jump to search
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 6: | Line 6: | ||
An .spk file is nothing more then a tar file, containing a standard structure and files. It is not related to any existing .spk packaging formats that are known and it looks like this .spk structure is designed/defined by Synology themselves and in no way compatible with any other packaging methods. You can 'unpack' any spk file simply by untarring (tar -xvf ''filename'') the file. Every package will contain the following files/directories (mind the capitals!): | An .spk file is nothing more then a tar file, containing a standard structure and files. It is not related to any existing .spk packaging formats that are known and it looks like this .spk structure is designed/defined by Synology themselves and in no way compatible with any other packaging methods. You can 'unpack' any spk file simply by untarring (tar -xvf ''filename'') the file. Every package will contain the following files/directories (mind the capitals!): | ||
'''INFO'''<BR> | |||
This is a file containing information that will be displayed and used during installation. It consists of multiple key="value" lines. The following keys are used: | |||
::*'''package''' : The - unique! - name of the package, as will be displayed during install en will be used as directory name under which the whole package will reside. | |||
::*'''version''' : guess what... | |||
::*'''maintainer''': Who is the 'owner' of the package. Only used for information purposes | |||
::*'''description''': A small description of the package. Only used for information purposes | |||
::*'''arch''': Architecture. Not sure what valuable options are. At least "noarch" will work on every disk station. Other options might be "ppc" or "arm", but that has not been proven yet. When trying to install a package that doesn't fit the architecture of you disk station, it will fail (since it will not work anyway). | |||
::*'''adminport''': optional. If the program is installed and has it own "administration" webpage, this will be the port number the server listens to. There is no way to set the complete URL or path.. | |||
'''package.tgz'''<BR> | |||
This is a compressed (gzip) tar file containing all the files that are needed. The installer will automatically unpack this package.The file has to have this name exactly, otherwise installation will end with an error "invalid file format".<BR> | |||
'''scripts'''<BR> | |||
This is a directory containing multiple unix sh shell scripts: | |||
::* '''postinst''' | |||
::* '''postuninst''' | |||
::* '''preinst''' | |||
::* '''preuninst''' | |||
::* '''start-stop-status''' | |||
all '*inst' scripts are used during installation and uninstallation of the package. Returning anything other then '0' as result will break the installation or uninstallation. Preinst will be called before anything is installed (this is the place to check if all installation requirements are met, for example), Postinst after (to set the file rights of the installed files, for example). Same fore the "*uninst" but then when using the 'uninstall' button on the package manager page. The start-stop-status script will be called by the package manager. This script will always be given an argument via the package manager. Hitting "run" in packagemanager will start this script with the 'start' argument, 'stop' result in 'stop'. When (re-)loading the packagemanager page, it will also call the script for a 'status' update. Finally, there is the possibility to show the log file via the info window. In all cases, returning '0' means 'all ok' and '1' means 'error occurred' or 'not running' (when checking status). When given the 'log' argument in the start-stop-status script, you are able to echo the filename of the logfile to STDOUT and the content of that file will be displayed under the 'log' tab of the info window. | |||
===Installation process=== | ===Installation process=== | ||
Line 93: | Line 33: | ||
Even before the firmware 722, it was possible to create a '3rdparty' option in the disk station manager. Using the package installer, this will become much easier to do. | Even before the firmware 722, it was possible to create a '3rdparty' option in the disk station manager. Using the package installer, this will become much easier to do. | ||
It's quite simple: | It's quite simple: | ||
# | # Create an application.cfg file and image directory as described in '3rd party apps integration guide' | ||
# place that file along with program files, images, cgi scripts and all in ''package.tgz'' | # place that file along with program files, images, cgi scripts and all in ''package.tgz'' | ||
# Create a softlink (ln -s ) from /usr/syno/synoman/3rdparty/webman/$SYNOPKG_PKGNAME to $SYNOPKG_PKGDEST in your ''postinst'' script and make sure link is removed in the ''postuninst'' | # Create a softlink (ln -s ) from /usr/syno/synoman/3rdparty/webman/$SYNOPKG_PKGNAME to $SYNOPKG_PKGDEST in your ''postinst'' script and make sure link is removed in the ''postuninst'' | ||
Line 100: | Line 39: | ||
# Create other files (scripts, INFO) and pack them (tar -cvf whatevername.spk *) into a .spk . | # Create other files (scripts, INFO) and pack them (tar -cvf whatevername.spk *) into a .spk . | ||
Thats it. By installing it, it will also create a 3rdparty directory. If you press 'reload' you will see the package can also be found in the navigation tree. Uninstallation removes all the files of the package, including the softlink. | |||
===Tips for creating packages=== | ===Tips for creating packages=== | ||
Line 108: | Line 47: | ||
# Creating softlinks from /usr/syno/synoman/webman/3rdparty/ to the package on a volume is a better idea then to place all under /usr/syno... directory itself. Doing this way, you prevent that disk doesn't run out of space | # Creating softlinks from /usr/syno/synoman/webman/3rdparty/ to the package on a volume is a better idea then to place all under /usr/syno... directory itself. Doing this way, you prevent that disk doesn't run out of space | ||
# You can add your 'own' key="value" pairs to the INFO file. These will be ignored by the installer, but can be used for 'global configuration keys' during your post/preinstall scripts. | # You can add your 'own' key="value" pairs to the INFO file. These will be ignored by the installer, but can be used for 'global configuration keys' during your post/preinstall scripts. | ||
# Make sure the read- | # Make sure the read-right-execute rights are in place. Use the 'chown' and 'chmod' commands in the scripts to make sure they are. | ||
# 3rdparty options always points to webpages. If you are using the same webserver/port as the disk station manager, '.nph' files will not work (without altering configuration), but ".cgi" files will. They will be treated the 'old cgi way', which means the webserver just executes them and the cgi program makes sure they spit out the relevant HTML code. | # 3rdparty options always points to webpages. If you are using the same webserver/port as the disk station manager, '.nph' files will not work (without altering configuration), but ".cgi" files will. They will be treated the 'old cgi way', which means the webserver just executes them and the cgi program makes sure they spit out the relevant HTML code. | ||
# Because the installation process is called via the webmanager interface, it is possible to retrieve more information via the environment variables that might be needed during the installation process. You can think of "USERNAME" => logged in user or "DOCUMENT_ROOT" => handy to know where to install .html or .cgi files for use under the webmanager interface. | # Because the installation process is called via the webmanager interface, it is possible to retrieve more information via the environment variables that might be needed during the installation process. You can think of "USERNAME" => logged in user or "DOCUMENT_ROOT" => handy to know where to install .html or .cgi files for use under the webmanager interface. | ||
Line 114: | Line 53: | ||
===Example=== | ===Example=== | ||
You can find a example .spk file 'curcon' at http://www.mertymade.com/syno/. After installing this package, you will notice a 3rdpary entry in the navigation tree on the left with the name 'Current Connections'. When clicking on it, it will show all network and windows filesharing connections from/to the diskstation. It isn't that spectacular, but a good working example how to use packages and 3rdparty option. | You can find a example .spk file 'curcon' at http://www.mertymade.com/syno/. After installing this package, you will notice a 3rdpary entry in the navigation tree on the left with the name 'Current Connections'. When clicking on it, it will show all network and windows filesharing connections from/to the diskstation. It isn't that spectacular, but a good working example how to use packages and 3rdparty option. | ||