#!/bin/sh

set -e

VM_VERSION=`find /usr/lib/squeak/ -name "squeakvm" -type f|cut -f5 -d"/"`
SQ_DIR=/usr/lib/squeak/$VM_VERSION

# register the plugin:
#/usr/lib/squeak/npsqueakregister

#Create empty directory for Squeak images
mkdir -p /usr/share/squeak

#If there is a squeak sources file, do the needed link:
if [ -f /usr/share/squeak/SqueakV3.sources ]; then
	ln -sf /usr/share/squeak/SqueakV3.sources $SQ_DIR/SqueakV3.sources
fi

#Prepare Squeaklets directory needed for the plugin

if [ ! -h /usr/share/squeak/Squeaklets ]; then
	#ln -s /var/cache/squeak/squeaklets /usr/share/squeak/Squeaklets
	#chmod 777 /var/cache/squeak/squeaklets
	ln -sf /tmp /usr/share/squeak/Squeaklets
fi

#DEBHELPER#

exit 0
