Ergebnis 1 bis 8 von 8
  1. #1
    Anwender Avatar von itari
    Registriert seit
    15.05.2008
    Beiträge
    21.945
    Blog-Einträge
    25

    Standard Paketmanagement

    Mit der aktuellen Firmware (722) ist ein neues Paketmanagement eingeführt worden. Die ladbaren Paket-Dateien habe die Endung .spk. Zur Zeit gibt es ein Paket im Synology-Download: SqueezeCenter-7.2.0-011. Ich habe mir mal den Inhalt des Archivs angesehen und folgende Directories-Struktur vorgefunden:

    INFO
    package.tgz
    scripts
    --postinst
    --preinst
    --start-stop-status
    --postuninst
    --preuninst

    Inhalt der Datei INFO:
    Code:
    package="SqueezeCenter"
    version="7.2"
    maintainer="Synology Inc."
    description="SqueezeCenter is the best software to stream your music."
    adminport="9002"
    arch="noarch"
    Inhalt der Datei postinst:
    Code:
    #!/bin/sh
    
    eval $(env | grep "^SYNOPKG_PKGDEST=")
    ret=`chown -R admin.users $SYNOPKG_PKGDEST`
    if [ "x" == "x$ret" ]; then
    	exit 0 
    else
    	exit 0 
    fi
    Inhalt der Datei preinst, postuninst und preuninst:
    Code:
    #!/bin/sh
    
    exit 0
    Inhalt der Datei start-stop-status:
    Code:
    #!/bin/sh
    PKGPATH="/var/packages/SqueezeCenter"
    
    SLIMPKG=`ls -l $PKGPATH/target | awk -F "-> " '{print $2}'`
    SLIMPORT=`/bin/get_key_value $PKGPATH/INFO adminport`
    CACHEPATH="Cache"
    LOGPATH="Logs"
    PREFSPATH="prefs"
    PIDFILENAME="${CACHEPATH}/slimserver.pid"
    MYSQLPIDFILENAME="${CACHEPATH}/squeezecenter-mysql.pid"
    LOGFILENAME="${LOGPATH}/server.log"
    
    SLIMPIDFILE="${SLIMPKG}/${PIDFILENAME}"
    SLIMMYSQLPIDFILE="${SLIMPKG}/${MYSQLPIDFILENAME}"
    SLIMLOGFILE="${SLIMPKG}/${LOGFILENAME}"
    SLIMCACHEPATH="${SLIMPKG}/${CACHEPATH}"
    SLIMLOGPATH="${SLIMPKG}/${LOGPATH}"
    SLIMPREFSPATH="${SLIMPKG}/${PREFSPATH}"
    
    SLIMSERVERBIN="slimserver.pl"
    SLIMSCANNERBIN="scanner.pl"
    
    get_pid()
    {
    	if [ ! -f ${SLIMPIDFILE} ]; then
    		return 1
    	else
    		pid=`cat ${SLIMPIDFILE} 2>/dev/null`
    		if [ -f /proc/$pid/cmdline ]; then
    			echo $pid
    			return 0
    		else
    			rm -f ${SLIMPIDFILE}
    			return 2
    		fi
    	fi
    }
    
    case $1 in
    	start)
    		slimperl="${SLIMPKG}/${SLIMSERVERBIN}"
    		cmd="${slimperl} --daemon --user admin --pidfile ${SLIMPIDFILE}"
    		cmd="$cmd --cachedir ${SLIMCACHEPATH} --logdir ${SLIMLOGPATH} --prefsdir ${SLIMPREFSPATH}"
    		if [ "x${SLIMPORT}" != "x" ]; then
    			cmd="$cmd --httpport ${SLIMPORT}"
    		fi
    		`$cmd`
    		if [ -f "{$SLIMPIDFILE}" ]; then
    			`chown admin.users ${SLIMPIDFILE}`
    		fi
    		exit 0
    	;;
    	stop)
    		#0 if pid exist but proc/pid do not exist, program crashed
    		SLIM_PID=`get_pid`
    		RET=$?
    		case "$RET" in
    			2)
    				exit 2
    			;;
    			1)
    				exit 1
    			;;                                                  
    		esac
    		#1 kill pid and check that pidfile is removed
    		# send kill signal and wait maximum 30 seconds for the process to end
    		`kill ${SLIM_PID}`
    		waittime=0
    		while [ -d /proc/$SLIM_PID ]; do
    			`sleep 1`
                            waittime=`expr $waittime + 1`
    			if [ $waittime -ge 30 ]; then
    				break
    			fi
    		done
    		`$0 killall`
    		#2 check proc/pid do not exist
    		if [ ! -d /proc/$SLIM_PID ]; then
    			[ -f ${SLIMPIDFILE} ] && rm -f ${SLIMPIDFILE}
    			exit 0
    		else
    			exit 1
    		fi
    	;;
    	status)
    		SLIM_PID=`get_pid`
    		RET=$?
    		exit $RET
    	;;
    	killall)
    		SlimPLPID=`pidof ${SLIMSERVERBIN}`
    		if [ ! -z "${SlimPLPID}" ]; then
    			`kill -9 ${SlimPLPID}`
    		fi
    		SlimSQLPID=`ps | grep mysqld | grep SqueezeCenter |grep -v grep | awk '{print $1}'`
    		if [ ! -z "${SlimSQLPID}" ]; then
    			`kill -9 ${SlimSQLPID}`
    		fi
    		SlimScannerPID=`pidof ${SLIMSCANNERBIN}`
    		if [ ! -z "${SlimScannerPID}" ]; then
    			`kill -9 ${SlimScannerPID}`
    		fi
            ;;
    	log)
    		echo "${SLIMLOGFILE}"
    		exit 0
    	;;
    esac
    Vielleicht hat ja jemand das Paket installiert und kann mal schauen, wo (in welchem rc-Verzeichnis) und unter welchem Namen das start-stop-status-Skript gelagert wird. Und vielleicht kann derjenige auch schauen, wo das Paket hinkopiert wurde.

    Vielen Dank bereits jetzt

    itari
    207+ Basic(2x500) [1618] | 509+ Basic(1x500,4x2000) [2166] | 2411+ Basic-SSD(50), Raid-5(4x2000), SHR(3x750+1x1000+2x1500) [2166]

    Synology-Kontakt-Formular
    Come to the dark side, we have cookies!

  2. #2
    Moderator
    Registriert seit
    12.07.2007
    Beiträge
    9.858

    Standard

    Dazu gibt es jetzt auch einen Beitrag im internationalen Forum: http://www.synology.com/enu/forum/vi...p=44919#p44919

    Trolli
    Disk Station 1511+ - DSM 4.3 - 3776
    3x3TB Western Digital WD30EZRX, Raid 5
    1x1TB
    Western Digital WD10EADS, Basic

    Disk Station 212+
    - DSM 4.3 - 3776
    2x1TB Western Digital WD10EADS, Basic

  3. #3
    Anwender Avatar von itari
    Registriert seit
    15.05.2008
    Beiträge
    21.945
    Blog-Einträge
    25

    Standard

    Joa, soweit sind wir nur auch schon gewesen ...

    Ich denke, dass wird erst so richtig werden, wenn die Synology-Leute eine Anleitung veröffentlichen und da ein wenig beschreiben, was wo wie hinkopiert wird. Denn im Moment seh ich nicht, wo man die Verzeichnisse konfigurieren kann. Ich weiß es deshalb nicht, weil ich annehme, dass das Start-Stop-Skript einfach als rc-File kopiert wird und die darin vereinbarten Verzeichnisse nur für die Start/Stop-Geschichte drin sind. Was ich meine, ist, dass sowas wie ein Installationsskript fehlt, in dem Pfade angegeben werden können.

    Und das nur durch Trial&Error herauszutesten, da ist mir die Zeit zu schade.

    itari
    207+ Basic(2x500) [1618] | 509+ Basic(1x500,4x2000) [2166] | 2411+ Basic-SSD(50), Raid-5(4x2000), SHR(3x750+1x1000+2x1500) [2166]

    Synology-Kontakt-Formular
    Come to the dark side, we have cookies!

  4. #4
    Anwender
    Registriert seit
    11.05.2007
    Beiträge
    132

    Standard

    Zitat Zitat von itari Beitrag anzeigen

    Vielleicht hat ja jemand das Paket installiert und kann mal schauen, wo (in welchem rc-Verzeichnis) und unter welchem Namen das start-stop-status-Skript gelagert wird. Und vielleicht kann derjenige auch schauen, wo das Paket hinkopiert wurde.

    Vielen Dank bereits jetzt

    itari
    Hallo itari,
    unter:
    /root/usr/local/etc/rc.d
    habe ich die Datei SqueezeCenter.sh gefunden
    kann dir das Helfen ?

    mfg
    Henryk42
    Angehängte Dateien Angehängte Dateien

    Modellname: CS-406
    Aktuelle FW: DSM 3.1-1635
    FW Datum: 2011/09/28
    Vielen Dank an Alfredo für die Firmware
    4*Samsung SP2504C SATAII Raid 5 (29.02.2008 rausgeworfen Raid5 defekt ständige Fehler egal welche Firmware in der alten CS 406 lief, Platten mit Tools geprüft, alle ok)
    Am 10.04.08 CS 406 Austausch erfolgt. Läuft ohne Probleme. Juhuu
    4*Seagate ST3320620NS Raid 5
    Logitech V 20 USB Notebook Lautsprecher (Tasten ohne Funktion)
    Synology Remote

  5. #5
    Anwender Avatar von itari
    Registriert seit
    15.05.2008
    Beiträge
    21.945
    Blog-Einträge
    25

    Standard

    qHenryk42,

    ah ja. Hatte ich fast vermutet und ist nun zur Gewissheit geworden. Erstens, dass es tatsächlich ausschließlich das rc-Skript ist und zweitens, dass es genau da ist, wo sich auch die anderen rc-skripte tummeln.

    Danke sehr.

    itari
    207+ Basic(2x500) [1618] | 509+ Basic(1x500,4x2000) [2166] | 2411+ Basic-SSD(50), Raid-5(4x2000), SHR(3x750+1x1000+2x1500) [2166]

    Synology-Kontakt-Formular
    Come to the dark side, we have cookies!

  6. #6
    Anwender
    Registriert seit
    17.04.2008
    Beiträge
    101

    Standard

    Im englischen Forum hat der User merty eine Erklärung zu .spk packages gepostet. Ich zitiere es ausnahmsweise, da ich nicht weiss, wie lange synology.com heute down ist (Wartung).

    Zitat Zitat von merty
    Hi,

    why
    When the new firmware came out, I noticed, like many others, the new 'package management' option. Finally a simple way for non-experienced users to 'update' their disk stations with other programs and possibilities. As an experienced unix developer, I was interested in the way those packages works so that I would be able to create them on my own. However, at the moment, there is no documentation whatsoever how this will work. Luckely enough, the first package, squeezecenter, was also released. By looking at the code en playing around with home-made-packages, I was able to determine how packages and packaging manager works. I'll try to explain in this posting how to make .spk files and how they are able to work. Doing this, I hope more developers will develop packages that can be used and downloaded by users without any knowledge about linux, toolchains, command lines and other scary stuff..
    Mind you, I'm not affiliated with Synology in any way, I'm just an enthusiastic user of a DS408..
    To create packages, one must have a basic understanding of unix tools and writing shell scripts.

    Package Structure
    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 I know off and as far as I can see, 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
      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. I presume other options will be "ppc" or "arm". 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..

      WARNING: Since most keywords and values might be parsed by unix programs and shell scripts during the installation process, it is recommended not to use any special characters (like '"';-[!@]\ ....) , just stick with regular ASCII.
      package.tgz
      This is a compressed (gzip) tar file containing all the files that are needed. The installer will automatically unpack this package. WARNING Any other name will be ignored and not unpacked..
      scripts
      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
    When uploading a .spk file, the file will be uploaded to a temporary directory (can be found in the environment variable 'SYNOPKG_PKGINST_TEMP_DIR, during the running of the 'preinst' script). Normally, this will be in a '@tmp' dir on the root of volume1. It will be unpacked (not the package.tgz yet) and script 'preinst' will be called. After that, the user has to select a volume to install to.Under the root of this volume, a '@appstore will be created, if this directory not exists already. In this directory, a directory using the name given in the INFO file as value of key 'package' will be created (this name can also be found in the SYNOPKG_PKGNAME environment variable). The 'package.tgz' will be uncompressed and unpacked under that directory (which can be found in environment variable 'SYNOPKG_PKGDEST'. After this, in the directory /var/packages will be a directory created by the name of the package. In this directory there will be the scripts dir and INFO file of the package. Also a link called 'target' which will point to the unpacked directory under your @appstore dir in the destination volume. The directories under /var/packages/ will be used by the packagemanager. Finally, the script 'postinst' will be called and all temporary files will be removed.

    Note that the 'adminport' option under INFO is a bit strange. It will only be used when displaying management page URL if the program status returns 'running' . The packagemanager will automaticly create the url out of 'http://' +hostname+':'+adminport. There is no way to change that url other then the port number.

    Adding a 3rdparty program into the package
    Even before the new firmware, 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:
    1. Create an application.cfg file and image directory as described in '3rd party apps integration guide'
    2. place that file along with program files, images, cgi scripts and all in package.tgz
    3. 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
    4. Make sure start-stop-status script will always return '0' (or '1' for status info, since nothing is running all the time)
    5. 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.

    Warnings/tips
    * Installation is done under 'root' rights. THIS CAN BE EXTREMELY DANGEROUS. Be sure in what you are doing. Stay away from any 'normal' directories like /sbin /usr/bin /usr/syno/bin, unless you know what you are doing. Dont install .spk unless you trust the sender or checked the installation scripts.
    * Installing and using .spk files is at your own risk. Don't blame Synology -or even me- for not working correctly or not giving the right answers. Read the disclaimer of this forum !
    * 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.
    * 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.
    * 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.

    Example
    You can find a example .spk file made by me at http://merty.xs4all.nl/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 great, but a good working example how to use packages and 3rdparty option.

    Remco Schellekens
    DS216+

  7. #7
    Anwender Avatar von itari
    Registriert seit
    15.05.2008
    Beiträge
    21.945
    Blog-Einträge
    25

    Standard

    Ich hoffe, du hast meine Fragen zu dem Paket-Management auch im internationalen Forum gelesen und bemerkt, dass ich ein wenig skeptisch bin, solange die Frage nach einem update-Prozess nicht vernünftig beantwortet ist. Wollen wir ähnliche Verhältnisse wie beim katastrophalen Firmware-Update auch für die Applications? Insbesondere, wo wir einen guten update-Prozess durch das ipkg gewohnt sind? Andere Herstellen machen es da im meinen Augen besser. Aber es kann sich ja noch ändern - die Hoffnung stirbt ja bekanntlich immer zuletzt ...

    itari
    207+ Basic(2x500) [1618] | 509+ Basic(1x500,4x2000) [2166] | 2411+ Basic-SSD(50), Raid-5(4x2000), SHR(3x750+1x1000+2x1500) [2166]

    Synology-Kontakt-Formular
    Come to the dark side, we have cookies!

  8. #8
    Moderator
    Registriert seit
    12.07.2007
    Beiträge
    9.858

    Standard

    Den Beitrag aus dem internationalen Forum gibt es jetzt auch im englischen Wiki: http://www.synology.com/wiki/index.p..._package_files

    Trolli
    Disk Station 1511+ - DSM 4.3 - 3776
    3x3TB Western Digital WD30EZRX, Raid 5
    1x1TB
    Western Digital WD10EADS, Basic

    Disk Station 212+
    - DSM 4.3 - 3776
    2x1TB Western Digital WD10EADS, Basic

Ähnliche Themen

  1. NFS und Paketmanagement
    Von falcone im Forum NFS-Server
    Antworten: 4
    Letzter Beitrag: 22.09.2008, 14:47

Lesezeichen

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •