eg-blog

Feed Rss

Archive for November, 2012

After having some troubles with the last two packages, the new one should work smoothly.

4.5.1. is basically a bugfix package without major changes.

Dropbox Folder is already updated:

https://www.dropbox.com/sh/4i5mjlhlnoe1qg4/B-SLEOoZH2

The package has been successfully uploaded to the community package hub and the update button appears soon.

 

 

For those of you, updating from 4.5.0: Please read the release announcement of the 4.5.1 package.

 

Have a nice Weekend and 1st Advent, Eric

 

Errors errors errors…fixes fixes fixes (hopefully)

Many of you had troubles starting my last build of the Subsonic package. I changed the detection method of the PID. Now it will most certainly run. But As I din’t have any errors I can’t really guarantee a smooth operation because there was no real bug fixing possible to me…

 

 

The rest is equal to the previous package.

Download from Dropbox folder:

https://www.dropbox.com/sh/vd06e2fn2157gh0/kE6FO5J1cD

 

Update button in the Package Center will appear soon.

 

 

 

 

 

 

 

Hi Guys,

sorry for being away for a while, but I had some more important things to do last week, but I am back now, my favorite football club Borussia Dortmund has made it to the CL finals and the weather is fine, so everything is OK now ;)

Anything else? Ah Yeah, the new ownCloud package!:

It fixes many bugs, so install it and be happy, no special tricks n this one.

Download from Dropbox folder:

https://www.dropbox.com/sh/4i5mjlhlnoe1qg4/B-SLEOoZH2

Update button in the Package Center should appear soon…

 

Edit: After some delays the package is online now and will be approved soon.

For those of you updating from 4.5.0: please read this post.

 

 

Attention: There are some serious issues with this package on x86 and ppc Disk Stations. I will fix them as soon as I can. Until then: Don’t update if your Subsonic runs fine now!

Hi everyone,

I’ve spent the last 2 days completely rewriting the install script, updating ffmpeg and adding power pc support for this package and here it is:

What is different?

  • Support of new Powerpc Qoriq powered Diskstations DS413 and DS213+
  • completely rewrote installation script
  • Now Subsonic, MashupMod, MiniSub, Subtunes and the ffmpeg packages are downloaded from the original sources during install
  • There is just one .spk for all CPU architectures
  • Updated MiniSub to the latest version (which is detected during install thanks to github) – now with Podcast support
  • Updated MashupMod to 4.7_B3158SE
  • now the Synology standard scripts are calling one big installer.sh which contains every script (inspired by patters from pcloadletter.co.uk)
  • fixed a few old bugs and many many new ones created during recoding

But my Diskstation is not connected to the Internet, what can I do?

  • Download Subsonic Stand alone from here  http://www.subsonic.org/pages/download.jsp and rename the downloaded file to Subsonic.tgz
  • OR if you want to use MashupMod download the newest SE version from here http://uploaded.net/f/zryfjb and rename the downloaded file to Mashupmod.zip
  • Download the correct ffmpeg binary from here http://www.eg-blog.de/download/ (yes they are called serviio-native because I am using the ones from patters) and rename it to ffmpeg.tgz
  • Put the two downloaded files into your public folder and start the installation, the script will detect and use them.
  • Note: you can not update MiniSub or install Subtunes with this method, but you can download them separately and place them into /volumeX/@appstore/Subsonic/jetty/<number>/webapp/mini or …/subtunes to install/update them.

Note for MashupMod users who use transcoding:

  • Go to Settings->Transcoding and change the three “Audioffmpeg” lines in “Step 1″ into “ffmpeg”.
  • Copy the “Step1″ field from mp3 audio into the one from m4a/FLAC audio.
  • Afterwards it should look like this:

Download from Dropbox: https://www.dropbox.com/sh/vd06e2fn2157gh0/kE6FO5J1cD

scripts:

installer.sh:

#!/bin/sh

#--------Subsonic installer script
#--------package maintained at eg-blog.de

DOWNLOAD_URL_STANDARD="http://sourceforge.net/projects/subsonic/files/subsonic/4.7/subsonic-4.7-standalone.tar.gz/download"
DOWNLOAD_URL_MASHUPMOD="http://uploaded.net/file/6kzehtl6/from/zryfjb"
DOWNLOAD_URL_SUBTUNES="http://subtunes.googlecode.com/files/subtunes-0.9.4b.zip"
DOWNLOAD_URL_MINISUB="https://github.com/tsquillario/MiniSub/tarball/master"
SYNO_CPU_ARCH="`uname -m`"
NATIVE_BINS_URL="http://eg-blog.de/download/serviio-native-${SYNO_CPU_ARCH}.tgz"
NATIVE_BINS_FILE="`echo ${NATIVE_BINS_URL} | sed -r "s%^.*/(.*)%\1%"`"

source /etc/profile
TEMP_FOLDER="`find / -maxdepth 2 -name '@tmp' | head -n 1`"
PUBLIC_FOLDER="`cat /usr/syno/etc/smb.conf | sed -r '/\/public$/!d;s/^.*path=(\/volume[0-9]{1,4}\/public).*$/\1/'`"

PID=""
subsonic_get_pid ()
{
	PID=`ps | grep java | grep subsonic | awk '{print $1}'`
}

preinst ()
{
	source /etc/profile

	########################################
	#check if Java is installed

	if [ -z ${JAVA_HOME} ]; then
		echo "Java is not installed or not properly configured. JAVA_HOME is not defined. " > $SYNOPKG_TEMP_LOGFILE
			echo "Download and install the Java Synology package from http://wp.me/pVshC-z5" >> $SYNOPKG_TEMP_LOGFILE
			echo "$(date +%d.%m.%y_%H:%M:%S): Download and install the Java Synology package from http://wp.me/pVshC-z5" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
		exit 1
	fi

	if [ ! -f ${JAVA_HOME}/bin/java ]; then
		echo "Java is not installed or not properly configured. The Java binary could not be located. " > $SYNOPKG_TEMP_LOGFILE
			echo "Download and install the Java Synology package from http://wp.me/pVshC-z5" >> $SYNOPKG_TEMP_LOGFILE
			echo "$(date +%d.%m.%y_%H:%M:%S): Download and install the Java Synology package from http://wp.me/pVshC-z5" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
		exit 1
	else
		echo "$(date +%d.%m.%y_%H:%M:%S): found Java in ${JAVA_HOME}" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
	fi

	#########################################
	#check if Subsonic folder is in public folder wehn restore is selected
	if [ ! -z ${install_restore} ]; then

		if [ ! -d $PUBLIC_FOLDER/Subsonic ]; then
			echo "Can't find a folder named 'Subsonic' in your public folder. " > $SYNOPKG_TEMP_LOGFILE
			echo "$(date +%d.%m.%y_%H:%M:%S): Can't find a folder named 'Subsonic' in your public folder. " >> ${SYNOPKG_PKGDEST}/subsonic_package.log
			echo "Please check your public folder and make sure there is a folder called Subsonic (with Capital S) in it. Or select 'No' if you don't want to restore anything and just install Subsonic normally" >> $SYNOPKG_TEMP_LOGFILE
			echo "$(date +%d.%m.%y_%H:%M:%S): Please check your public folder and make sure there is a folder called Subsonic (with Capital S) in it. Or select 'No' if you don't want to restore anything and just install Subsonic normally" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
			exit 1
		fi
	fi

	#########################################
	#is the User Home service enabled?
	UH_SERVICE=maybe
	synouser --add userhometest Testing123 "User Home test user" 0 "" ""
	UHT_HOMEDIR=`cat /etc/passwd | sed -r '/User Home test user/!d;s/^.*:User Home test user:(.*):.*$/\1/'`
	if echo $UHT_HOMEDIR | grep '/var/services/homes/' > /dev/null; then
		if [ ! -d $UHT_HOMEDIR ]; then
			UH_SERVICE=false
		fi
	fi
	synouser --del userhometest
	if [ ${UH_SERVICE} == "false" ]; then
		echo "The User Home service is not enabled. Please enable this feature in the User control panel in DSM." >> $SYNOPKG_TEMP_LOGFILE
		echo "The User Home service is not enabled. Please enable this feature in the User control panel in DSM." >> ${SYNOPKG_PKGDEST}/subsonic_package.log
		exit 1
	else
		echo "$(date +%d.%m.%y_%H:%M:%S): User home is enabled" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
	fi

	exit 0
}

postinst ()
{
	#create subsonic daemon user
	synouser --add subsonic `${SYNOPKG_PKGDEST}/passgen 1 20` "Subsonic daemon user" 0 "" ""
	echo "$(date +%d.%m.%y_%H:%M:%S): create subsonic daemon user" >> ${SYNOPKG_PKGDEST}/subsonic_package.log

	#determine the subsonic user homedir and save that variable in the user's profile
	#this is needed because librtmp needs to write a file called ~/.swfinfo
	#and new users seem to inherit a HOME value of /root which they have no permissions for
	SUBSONIC_HOMEDIR=`cat /etc/passwd | sed -r '/Subsonic daemon user/!d;s/^.*:Subsonic daemon user:(.*):.*$/\1/'`
	su - subsonic -s /bin/sh -c "echo export HOME=${SUBSONIC_HOMEDIR} >> .profile"

	#########################################
	##download stuff
	#select the right mods / version to download/install
	if [ ! -z ${mashupmod_install} ]; then
		echo "$(date +%d.%m.%y_%H:%M:%S): download and install MashupMod" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
		wget ${DOWNLOAD_URL_MASHUPMOD} --output-document=${SYNOPKG_PKGDEST}/MashupMod.zip
		if [ -f ${SYNOPKG_PKGDEST}/MashupMod.zip ]; then
			echo "$(date +%d.%m.%y_%H:%M:%S): downloaded MashupMod from $DOWNLOAD_URL_MASHUPMOD" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
		else
			if [ -d ${PUBLIC_FOLDER} ] && [ -f ${PUBLIC_FOLDER}/Mashupmod.zip ]; then
				cp ${PUBLIC_FOLDER}/Mashupmod.zip ${SYNOPKG_PKGDEST}
				echo "$(date +%d.%m.%y_%H:%M:%S): copied Mashupmod install files from public folder" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
			else
				echo "There was a problem downloading  Mashupmod from the official download link, " >> $SYNOPKG_TEMP_LOGFILE
				echo "which was ${DOWNLOAD_URL_MASHUPMOD}" >> $SYNOPKG_TEMP_LOGFILE
				echo "Alternatively, you may download this file manually and place it in the 'public' shared folder. and name it Mashupmod.zip" >> $SYNOPKG_TEMP_LOGFILE
				exit 1
			fi
		fi
		unzip ${SYNOPKG_PKGDEST}/MashupMod.zip -d ${SYNOPKG_PKGDEST}
		echo "$(date +%d.%m.%y_%H:%M:%S): extracted MashupMod" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
		rm ${SYNOPKG_PKGDEST}/MashupMod.zip
		echo "$(date +%d.%m.%y_%H:%M:%S): deleted downloaded files" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
	else
		#download Subsonic
		echo "$(date +%d.%m.%y_%H:%M:%S): download and install Subsonic standard" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
		wget ${DOWNLOAD_URL_STANDARD} --output-document=${SYNOPKG_PKGDEST}/Subsonic.tgz
		if [ -f ${SYNOPKG_PKGDEST}/Subsonic.tgz ]; then
			echo "$(date +%d.%m.%y_%H:%M:%S): downloaded Subsonic install file from $DOWNLOAD_URL_STANDARD" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
		else
			if [ -d ${PUBLIC_FOLDER} ] && [ -f ${PUBLIC_FOLDER}/Subsonic.tar.gz ]; then
				cp ${PUBLIC_FOLDER}/Subsonic.tgz ${SYNOPKG_PKGDEST}
				echo "$(date +%d.%m.%y_%H:%M:%S): copied Subsonic install files from public folder" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
			else
				echo "There was a problem downloading  Subsonic from the official download link, " >> $SYNOPKG_TEMP_LOGFILE
				echo "which was ${DOWNLOAD_URL_STANDARD}" >> $SYNOPKG_TEMP_LOGFILE
				echo "Alternatively, you may download this file manually and place it in the 'public' shared folder. and name it Subsonic.tgz" >> $SYNOPKG_TEMP_LOGFILE
				exit 1
			fi

		fi
		tar xzf ${SYNOPKG_PKGDEST}/Subsonic.tgz -C ${SYNOPKG_PKGDEST}
		echo "$(date +%d.%m.%y_%H:%M:%S): extracted Subsonic" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
		rm ${SYNOPKG_PKGDEST}/Subsonic.tgz
		echo "$(date +%d.%m.%y_%H:%M:%S): deleted downloaded files" >> ${SYNOPKG_PKGDEST}/subsonic_package.log

	fi
	#delete the original subsonic.sh and use the edited file for Synology
	if [ -f ${SYNOPKG_PKGDEST}/subsonic.sh ]; then
		rm ${SYNOPKG_PKGDEST}/subsonic.sh
		echo "$(date +%d.%m.%y_%H:%M:%S): deleted original subsonic.sh file" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
	fi

	if [ -f ${SYNOPKG_PKGDEST}/subsonic_synology.sh ]; then
		mv ${SYNOPKG_PKGDEST}/subsonic_synology.sh ${SYNOPKG_PKGDEST}/subsonic.sh
		echo "$(date +%d.%m.%y_%H:%M:%S): now using edited subsonic.sh file for Synology" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
	fi

	#download and install ffmpeg binarys
	wget ${NATIVE_BINS_URL} --output-document=${SYNOPKG_PKGDEST}/ffmpeg.tgz
	if [ ! -f ${SYNOPKG_PKGDEST}/ffmpeg.tgz ]; then
		if [ -d ${PUBLIC_FOLDER} ] && [ -f ${PUBLIC_FOLDER}/ffmpeg.tgz ]; then
			cp ${PUBLIC_FOLDER}/ffmpeg.tgz ${SYNOPKG_PKGDEST}
			echo "$(date +%d.%m.%y_%H:%M:%S): copied ffmpeg files from public folder" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
		else
			echo "There was a problem downloading  ffmpeg from the official download link, " >> $SYNOPKG_TEMP_LOGFILE
			echo "which was ${NATIVE_BINS_URL}" >> $SYNOPKG_TEMP_LOGFILE
			echo "Alternatively, you may download this file manually and place it in the 'public' shared folder and neme it ffmpeg.tgz" >> $SYNOPKG_TEMP_LOGFILE
			exit 1
		fi
	else
		echo "$(date +%d.%m.%y_%H:%M:%S): downloaded ffmpeg files from $NATIVE_BINS_URL" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
	fi
	if [ ! -d  ${SYNOPKG_PKGDEST}/transcode ]; then
		mkdir ${SYNOPKG_PKGDEST}/transcode
		echo "$(date +%d.%m.%y_%H:%M:%S): created transcode directory" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
	fi
	if [ ! -d  ${SYNOPKG_PKGDEST}/lib ]; then
		mkdir ${SYNOPKG_PKGDEST}/lib
		echo "$(date +%d.%m.%y_%H:%M:%S): created lib directory" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
	fi

	tar xzvf ${SYNOPKG_PKGDEST}/ffmpeg.tgz -C ${SYNOPKG_PKGDEST}/transcode
	cp -r ${SYNOPKG_PKGDEST}/transcode/lib* ${SYNOPKG_PKGDEST}/lib/
	rm -r ${SYNOPKG_PKGDEST}/transcode/lib*
	rm ${SYNOPKG_PKGDEST}/ffmpeg.tgz
	echo "$(date +%d.%m.%y_%H:%M:%S): copied ffmpeg file and libraries" >> ${SYNOPKG_PKGDEST}/subsonic_package.log

	#########################################
	##start Subsonic
	#fix file permissions
	chmod +x ${SYNOPKG_PKGDEST}/subsonic.sh
	chmod 775 ${SYNOPKG_PKGDEST}/subsonic-booter-jar-with-dependencies.jar
	chmod 775 ${SYNOPKG_PKGDEST}/subsonic.war
	chown -R subsonic:users ${SYNOPKG_PKGDEST}
	echo "$(date +%d.%m.%y_%H:%M:%S): start Subsonic for first initialisation" >> ${SYNOPKG_PKGDEST}/subsonic_package.log

	#set up symlink for the DSM GUI
	ln -s ${SYNOPKG_PKGDEST}/ /usr/syno/synoman/webman/3rdparty/Subsonic

	#create custom temp folder so temp files can be bigger
	if [ ! -d ${SYNOPKG_PKGDEST}/../../@tmp/subsonic ]; then
		mkdir ${SYNOPKG_PKGDEST}/../../@tmp/subsonic
		chown -R subsonic ${SYNOPKG_PKGDEST}/../../@tmp/subsonic
	fi
	#create symlink to the created directory
	if [ ! -L /tmp/subsonic ]; then
		ln -s ${SYNOPKG_PKGDEST}/../../@tmp/subsonic /tmp/
	fi

	#start subsonic as subsonic user
	su - subsonic -s /bin/sh -c /usr/syno/synoman/webman/3rdparty/Subsonic/subsonic.sh

	sleep 5

	subsonic_get_pid
	if [ ! -z $PID ]; then
		echo "$(date +%d.%m.%y_%H:%M:%S): started Subsonic successfully. PID is: $PID" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
	else
		echo "Error: Can not start Subsonic during install" >> $SYNOPKG_TEMP_LOGFILE
		echo "$(date +%d.%m.%y_%H:%M:%S): Error: Can not start Subsonic during install" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
		exit 1
	fi

	#give it some time to start up
	sleep 90

	#stop subsonic

	kill $PID
	sleep 5
	echo "$(date +%d.%m.%y_%H:%M:%S): Stopped Subsonic" >> ${SYNOPKG_PKGDEST}/subsonic_package.log

	####################################
	##download and install additional features
	echo "$(date +%d.%m.%y_%H:%M:%S): Download and install additional Features" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
	#Subtunes
	if [ ! -z ${subtunes_install} ]; then
		wget ${DOWNLOAD_URL_SUBTUNES}  --output-document=${SYNOPKG_PKGDEST}/Subtunes.zip
		if [ -f ${SYNOPKG_PKGDEST}/Subtunes.zip ]; then
			echo "$(date +%d.%m.%y_%H:%M:%S): Downloaded Subtunes" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
			unzip ${SYNOPKG_PKGDEST}/Subtunes.zip -d ${SYNOPKG_PKGDEST}/Subtunes/
			echo "$(date +%d.%m.%y_%H:%M:%S): extracted Subtunes" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
		else
			echo "$(date +%d.%m.%y_%H:%M:%S): Error: Subtunes could not be downloaded" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
			echo "$(date +%d.%m.%y_%H:%M:%S): Please check the internet connection of your Diskstation" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
			echo "Error: Subtunes could not be downloaded" > $SYNOPKG_TEMP_LOGFILE
			echo "Please check the internet connection of your Diskstation" >> $SYNOPKG_TEMP_LOGFILE
			exit 1
		fi

		cp -r ${SYNOPKG_PKGDEST}/Subtunes /usr/syno/synoman/webman/3rdparty/Subsonic/jetty/*/webapp/
		rm -r ${SYNOPKG_PKGDEST}/Subtunes
		rm ${SYNOPKG_PKGDEST}/Subtunes.zip

		echo "$(date +%d.%m.%y_%H:%M:%S): copied Subtunes and deleted downloaded files" >> ${SYNOPKG_PKGDEST}/subsonic_package.log

		#Subtuneslink
		if [ -d ${SYNOPKG_PKGDEST}/Subtuneslink ]; then
			cp ${SYNOPKG_PKGDEST}/Subtuneslink/* /usr/syno/synoman/webman/3rdparty/Subsonic/jetty/*/webapp/mini/
		fi

	fi
	rm -r ${SYNOPKG_PKGDEST}/Subtuneslink

	#MiniSub Update
	if [ ! -z ${minisub_install} ]; then
		wget ${DOWNLOAD_URL_MINISUB} --no-check-certificate --output-document=${SYNOPKG_PKGDEST}/MiniSub.tgz
		if [ -f ${SYNOPKG_PKGDEST}/MiniSub.tgz ]; then
			echo "$(date +%d.%m.%y_%H:%M:%S): Downloaded MiniSub" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
			tar xzf ${SYNOPKG_PKGDEST}/MiniSub.tgz -C ${SYNOPKG_PKGDEST}/MiniSub
			echo "$(date +%d.%m.%y_%H:%M:%S): extracted MiniSub" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
		else
			echo "$(date +%d.%m.%y_%H:%M:%S): Error: MiniSub could not be downloaded" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
			echo "$(date +%d.%m.%y_%H:%M:%S): Please check the internet connection of your Diskstation" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
			echo "Error: MiniSub could not be downloaded" > $SYNOPKG_TEMP_LOGFILE
			echo "Please check the internet connection of your Diskstation" >> $SYNOPKG_TEMP_LOGFILE
			exit 1
		fi
		if [ -d /usr/syno/synoman/webman/3rdparty/Subsonic/jetty/*/webapp/mini/ ]; then
			rm -r /usr/syno/synoman/webman/3rdparty/Subsonic/jetty/*/webapp/mini/*
			cp -r ${SYNOPKG_PKGDEST}/MiniSub/* /usr/syno/synoman/webman/3rdparty/Subsonic/jetty/*/webapp/mini/
		else
			echo "$(date +%d.%m.%y_%H:%M:%S): Error: Can't find the MiniSub directory -> MiniSub will not be updated " >> ${SYNOPKG_PKGDEST}/subsonic_package.log
			echo "Error: Can't find the MiniSub directory -> MiniSub will not be updated " >> ${SYNOPKG_PKGDEST}/subsonic_package.log >> $SYNOPKG_TEMP_LOGFILE
			exit 1
		fi
		rm -r ${SYNOPKG_PKGDEST}/MiniSub
		rm ${SYNOPKG_PKGDEST}/MiniSub.tgz
		echo "$(date +%d.%m.%y_%H:%M:%S): copied MiniSub and deleted downloaded files" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
	fi

	#MiniSub Link
	echo "$(date +%d.%m.%y_%H:%M:%S): create MiniSub DSM link" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
	if [ -d ${SYNOPKG_PKGDEST}/MiniSublink/ ]; then
		cp ${SYNOPKG_PKGDEST}/MiniSublink/* /usr/syno/synoman/webman/3rdparty/Subsonic/jetty/*/webapp/mini/
	fi
	rm -r ${SYNOPKG_PKGDEST}/MiniSublink
	####################################

	#delete symlink
	rm /usr/syno/synoman/webman/3rdparty/Subsonic
	#delete temp files
	if [ -d ${SYNOPKG_PKGDEST}/../../@tmp/subsonic ]; then
		rm -r ${SYNOPKG_PKGDEST}/../../@tmp/subsonic
	fi

	#check Podcast folder for right permissions
	if [ -d /volume1/music/Podcast ]; then
		echo "$(date +%d.%m.%y_%H:%M:%S): reset permissions of Podcast folder (subsonic user has new uid)" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
		chown -R admin:users /volume1/music/Podcast
		chmod -R 775 /volume1/music/Podcast
	fi

	#########################################
	#install user backup from public folder

	if [ ! -z ${install_restore} ]; then
		echo "$(date +%d.%m.%y_%H:%M:%S): restore previously made backup fron public folder" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
		#copy files
		cp -r ${PUBLIC_FOLDER}/Subsonic/* ${SYNOPKG_PKGDEST}/

		#new files might not be owned by subsonic user
		chown -R subsonic ${SYNOPKG_PKGDEST}/

		#make the Subsonic start script executable
		chmod +x ${SYNOPKG_PKGDEST}/subsonic.sh
	fi
	echo "$(date +%d.%m.%y_%H:%M:%S): ----installation complete----" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
	exit 0
}

preuninst ()
{
	##############################################
	stop Subsonic if it is running

	subsonic_get_pid
	if [ -z $PID ]; then
		sleep 1
	else
		echo "$(date +%d.%m.%y_%H:%M:%S): stopping Subsonic" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
		kill $PID
		sleep 2
		if [ -L /usr/syno/synoman/webman/3rdparty/Subsonic ]; then
			rm /usr/syno/synoman/webman/3rdparty/Subsonic
		fi

		if [ -d ${SYNOPKG_PKGDEST}/../../@tmp/subsonic ]; then
			rm -r ${SYNOPKG_PKGDEST}/../../@tmp/subsonic
		fi
	fi

	##############################################
	# create a backup in public folder in public folder
	if [ ! -z ${uninstall_backup} ]; then
		echo "$(date +%d.%m.%y_%H:%M:%S): Create a backup of Subsonic in public folder" >> ${SYNOPKG_PKGDEST}/subsonic_package.log

		if [ ! -d ${PUBLIC_FOLDER}/Subsonic ]; then
			mkdir ${PUBLIC_FOLDER}/Subsonic
		fi

		cp ${SYNOPKG_PKGDEST}/subsonic.properties *.index ${PUBLIC_FOLDER}/Subsonic
		cp -r ${SYNOPKG_PKGDEST}/db ${PUBLIC_FOLDER}/Subsonic
		cp -r ${SYNOPKG_PKGDEST}/lucene ${PUBLIC_FOLDER}/Subsonic
		cp -r ${SYNOPKG_PKGDEST}/thumbs ${PUBLIC_FOLDER}/Subsonic
	fi

	exit 0
}

postuninst ()
{
	synouser --del subsonic

	#remove DSM icon symlink
	if [ -L /usr/syno/synoman/webman/3rdparty/Subsonic ]; then
		rm /usr/syno/synoman/webman/3rdparty/Subsonic
	fi

	#remove temp symlink
	rm /tmp/subsonic

	exit 0
}

preupgrade ()
{
	###########################
	#stop Subsonic if it is runing

	subsonic_get_pid
	if [ ! -z $PID ]; then
		echo "$(date +%d.%m.%y_%H:%M:%S): stopping subsonic" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
		kill $PID
		sleep 2
	fi

	if [ -d ${SYNOPKG_PKGDEST}/../../@tmp/subsonic ]; then
		rm -r ${SYNOPKG_PKGDEST}/../../@tmp/subsonic
	fi

	###########################
	#backup subsonic.properties and db Folder

	if [ -z ${install_restore} ]; then
		echo "$(date +%d.%m.%y_%H:%M:%S): create backup of Subsonic db in temporary backup dir" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
		if [ ! -d ${SYNOPKG_PKGDEST}/../subsonic_update_backup ]; then
			mkdir ${SYNOPKG_PKGDEST}/../subsonic_update_backup
			cp ${SYNOPKG_PKGDEST}/subsonic.properties ${SYNOPKG_PKGDEST}*.index ${SYNOPKG_PKGDEST}/../subsonic_update_backup/
			cp -r ${SYNOPKG_PKGDEST}/db ${SYNOPKG_PKGDEST}/../subsonic_update_backup
			cp -r ${SYNOPKG_PKGDEST}/lucene ${SYNOPKG_PKGDEST}/../subsonic_update_backup
			cp -r ${SYNOPKG_PKGDEST}/thumbs ${SYNOPKG_PKGDEST}/../subsonic_update_backup
		fi
	fi

	exit 0
}

postupgrade ()
{

	###############################
	#restore subsonic db index and settings
	if [ ! -z ${install_update} ]; then
		echo "$(date +%d.%m.%y_%H:%M:%S): restore from temporary backup dir" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
		cp -r ${SYNOPKG_PKGDEST}/../subsonic_update_backup/* ${SYNOPKG_PKGDEST}/
	fi

	#remove backup folder
	#remove the next lines to keep a backup in the @appstore folder
	if [ -d ${SYNOPKG_PKGDEST}/../subsonic_update_backup ]; then
		echo "$(date +%d.%m.%y_%H:%M:%S): remove temporary backup dir" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
		rm -r ${SYNOPKG_PKGDEST}/../subsonic_update_backup
	fi

	#subsonic may not own all new files
	chown -R subsonic ${SYNOPKG_PKGDEST}/

	#make the Subsonic start script executable
	chmod +x ${SYNOPKG_PKGDEST}/subsonic.sh

	echo "$(date +%d.%m.%y_%H:%M:%S): ----update complete----" >> ${SYNOPKG_PKGDEST}/subsonic_package.log

	exit 0
}

start-stop-status

#!/bin/sh

#--------Subsonic start-stop-status script
#--------package maintained at eg-blog.de

##############################################
#function to get the process id of Subsonic
PID=""
subsonic_get_pid ()
{
	PID=`ps | grep java | grep subsonic | awk '{print $1}'`
}
get_time()
{
	TIME=$(date +%d.%m.%y_%H:%M:%S)
}

case "$1" in
   start)
	  ###---copied from patters start-stop-status.sh of his crashplan proe package---
	  DAEMON_ID="${SYNOPKG_PKGNAME} daemon user"
	  DAEMON_HOME="`cat /etc/passwd | grep "${DAEMON_ID}" | cut -f6 -d':'`"

	  #set the current timezone for Java so that log timestamps are accurate
	  #we need to use the modern timezone names so that Java can figure out DST
	  SYNO_TZ=`cat /etc/synoinfo.conf | grep timezone | cut -f2 -d'"'`
	  SYNO_TZ=`grep "^${SYNO_TZ}" /usr/share/zoneinfo/Timezone/tzname | sed -e "s/^.*= //"`
	  grep "^export TZ" ${DAEMON_HOME}/.profile > /dev/null \
	  && sed -i "s%^export TZ=.*$%export TZ='${SYNO_TZ}'%" ${DAEMON_HOME}/.profile \
	  ###---end of copy---------------------------------------------------------------

	  #set up symlinks for the DSM GUI icon
	  #Subsonic main
	  if [ -d /usr/syno/synoman/webman/3rdparty ]; then
		ln -s ${SYNOPKG_PKGDEST}/ /usr/syno/synoman/webman/3rdparty/Subsonic
		echo "$(date +%d.%m.%y_%H:%M:%S): Subsonic DSM link created" >> ${SYNOPKG_PKGDEST}/subsonic_package.log

		#MiniSub
		if [ -d ${SYNOPKG_PKGDEST}/jetty/*/webapp/mini ]; then
			ln -s ${SYNOPKG_PKGDEST}/jetty/*/webapp/mini /usr/syno/synoman/webman/3rdparty/Subsonic_MiniSub
			echo "$(date +%d.%m.%y_%H:%M:%S): MiniSub DSM link created" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
		fi
		#Subtunes
		if [ -d ${SYNOPKG_PKGDEST}/jetty/*/webapp/Subtunes ]; then
			ln -s ${SYNOPKG_PKGDEST}/jetty/*/webapp/Subtunes /usr/syno/synoman/webman/3rdparty/Subsonic_Subtunes
			echo "$(date +%d.%m.%y_%H:%M:%S): Subtunes DSM link created" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
		fi
	  else
		echo "$(date +%d.%m.%y_%H:%M:%S) : Error: Directory for Subsonic DSM link was not found" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
	  fi
      #create custom temp folder so temp files can be bigger
	  if [ ! -d ${SYNOPKG_PKGDEST}/../../@tmp/subsonic ]; then
		mkdir ${SYNOPKG_PKGDEST}/../../@tmp/subsonic
		chown -R subsonic ${SYNOPKG_PKGDEST}/../../@tmp/subsonic
		echo "$(date +%d.%m.%y_%H:%M:%S): Temp directory created" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
	  fi
	  #create symlink to the created directory
	  if [ ! -L /tmp/subsonic ]; then
		ln -s ${SYNOPKG_PKGDEST}/../../@tmp/subsonic /tmp/
		echo "$(date +%d.%m.%y_%H:%M:%S): Temp directory link created" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
	  fi
	  # starting subsonic as subsonic daemon user
	  echo "$(date +%d.%m.%y_%H:%M:%S): starting Subsonic as subsonic daemon user" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
      su - subsonic -s /bin/sh -c /usr/syno/synoman/webman/3rdparty/Subsonic/subsonic.sh
      sleep 10
	  echo "$(date +%d.%m.%y_%H:%M:%S): started Subsonic as subsonic daemon user" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
	  subsonic_get_pid
	  if [ ! -z $PID ]; then
		echo "$(date +%d.%m.%y_%H:%M:%S): started Subsonic successfully. PID is: $PID" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
		echo "$(date +%d.%m.%y_%H:%M:%S): ----subsonic is running----" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
	  else
		echo "$(date +%d.%m.%y_%H:%M:%S): Error: Can not start Subsonic" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
		exit 1
	  fi

	  exit 0
   ;;
   stop)
      #stop subsonic
	  subsonic_get_pid
      kill $PID
	  echo "$(date +%d.%m.%y_%H:%M:%S) : killed Subsonic PID: $PID" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
      sleep 2
	  #delete Symlinks and DSM icon
	  if [ -L /usr/syno/synoman/webman/3rdparty/Subsonic ]; then
		rm /usr/syno/synoman/webman/3rdparty/Subsonic
		echo "$(date +%d.%m.%y_%H:%M:%S): Subsonic DSM link deleted" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
	  fi
	  if [ -L /usr/syno/synoman/webman/3rdparty/Subsonic_MiniSub ]; then
		rm /usr/syno/synoman/webman/3rdparty/Subsonic_MiniSub
		echo "$(date +%d.%m.%y_%H:%M:%S): MiniSub DSM link deleted" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
	  fi
	  if [ -L /usr/syno/synoman/webman/3rdparty/Subsonic_Subtunes ]; then
		rm /usr/syno/synoman/webman/3rdparty/Subsonic_Subtunes
		echo "$(date +%d.%m.%y_%H:%M:%S): Subtunes DSM link deleted" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
	  fi
	  if [ -d ${SYNOPKG_PKGDEST}/../../@tmp/subsonic ]; then
		rm -r ${SYNOPKG_PKGDEST}/../../@tmp/subsonic
		echo "$(date +%d.%m.%y_%H:%M:%S): Temp files deleted" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
	  fi
	  if [ -L /tmp/subsonic ]; then
		rm /tmp/subsonic
		echo "$(date +%d.%m.%y_%H:%M:%S): Temp link deleted" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
	  fi
	  echo "$(date +%d.%m.%y_%H:%M:%S): ----subsonic is stopped----" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
	  exit 0
   ;;
   status)
      subsonic_get_pid
      if [ -z  $PID ]; then
	  #Subsonic is not running
		exit 1
	  else
	  #subsonic is running
		exit 0
      fi
   ;;
   log)
	  echo "${SYNOPKG_PKGDEST}/subsonic_package.log"
	  exit 0
   ;;
esac

Hi guys its an official Holiday today which means I’ve got a lot of time to take care of my Synology packages.

The first one is the owncloud package, which has been updated to 4.5.1. Nothing special so far, but then Synology-Version-Number-Counting strikes!

For some reason it detects the 4.5.1 to be lower than the previous 4.5 and quits the update process. This wouldn’t be a problem if at least one of the scripts in the package would be executed so I could change the number by running this script and you wouldn’t recognize anything, but it fails before anything is done to the package. It also means there will be no update button in the package center for the people who installed 4.5 because the installed version is detected to be newer.

There are a few workarounds to update from 4.5 to 4.5.1

1. Quick and dirty: Uninstall ownCloud and install the new one -> You will loose all your data and settings

2. owerwrite the INFO file which contains the version number

  1. Download my patched INFO file
  2. copy it into the public folder of your Disk Station
  3. connect to your DiskStation via SSH
  4. type
    cp /volumeX/public/INFO /var/packages/owncloud

    replace the X with the volume number that contains your public folder

  5. type exit, the editor closes
  6. Now the update button appears in the package center, you can update normally

3. DIY:  Edit the version in the INFO file (afterwards the update button appears)

  1. connect to your Disk Station using SSH (How do I do that?)
  2. type
    cd /var/packages/owncloud
  3. type 
    vi INFO

    the text editor vi should start

  4. in vi navigate to the third line which is: version=”4.5-012″
  5. hit <a>
  6. add .0 after 4.5 so the changed line is  version=”4.5.0-012″
  7. hit <Esc>
  8. type :wq and hit <Enter>
  9. type exit, the editor closes
  10. Now the update button appears in the package center, you can update normally

Another way is to backup the data and config folder in the /web folder, deinstall owncloud, install the new version and recover it. If you do this you have to take care of the folder permissions.

I apologize for the circumstances, if you know an easier way to update, let me know.

Manual Download link:

https://www.dropbox.com/sh/4i5mjlhlnoe1qg4/B-SLEOoZH2