102 lines
3.8 KiB
Bash
Executable File
102 lines
3.8 KiB
Bash
Executable File
#!/bin/sh
|
|
# postinst script for Logisim-evolution
|
|
#
|
|
# see: dh_installdeb(1)
|
|
|
|
set -e
|
|
|
|
# summary of how this script can be called:
|
|
# * <postinst> `configure' <most-recently-configured-version>
|
|
# * <old-postinst> `abort-upgrade' <new version>
|
|
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
|
|
# <new-version>
|
|
# * <postinst> `abort-remove'
|
|
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
|
|
# <failed-install-package> <version> `removing'
|
|
# <conflicting-package> <version>
|
|
# for details, see http://www.debian.org/doc/debian-policy/ or
|
|
# the debian-policy package
|
|
|
|
case "$1" in
|
|
configure)
|
|
echo "Adding shortcut to the menu"
|
|
xdg-desktop-menu install --novendor /opt/Logisim-evolution/Logisim-evolution.desktop
|
|
xdg-mime install /opt/Logisim-evolution/Logisim-evolutiondevelopmentteam-Logisim-evolution-MimeInfo.xml
|
|
|
|
echo "Installing command line tool logisim-evolution"
|
|
ln -s /opt/Logisim-evolution/Logisim-evolution /usr/bin/logisim-evolution
|
|
|
|
if [ "false" = "true" ]; then
|
|
echo Installing daemon
|
|
cp /opt/Logisim-evolution/logisim-evolution.init /etc/init.d/logisim-evolution
|
|
|
|
if [ -x "/etc/init.d/logisim-evolution" ]; then
|
|
update-rc.d logisim-evolution defaults
|
|
|
|
if [ "false" = "true" ]; then
|
|
if which invoke-rc.d >/dev/null 2>&1; then
|
|
invoke-rc.d logisim-evolution start
|
|
else
|
|
/etc/init.d/logisim-evolution start
|
|
fi
|
|
fi
|
|
fi
|
|
fi
|
|
if [ -f /etc/profile ]; then
|
|
# load special environment variables
|
|
. /etc/profile
|
|
|
|
# remove stored value in case of dpkg-reconfigure
|
|
RUNTIME_PATH_TO_SET=""
|
|
|
|
if [ -z "$JRE_HOME" ]; then
|
|
echo JRE_HOME is not set, checking for JAVA_HOME being set
|
|
if [ -z "$JAVA_HOME" ]; then
|
|
echo JAVA_HOME is not set, checking for known locations
|
|
|
|
# look for known locations
|
|
KNOWN_JDK_DIRS="/usr/lib/jvm/java-8-oracle /usr/lib/jvm/java-8-openjdk-amd64 /usr/lib/jvm/java-8-openjdk-i386"
|
|
FOUND_JAVA_HOME=""
|
|
|
|
# Look for the right JVM to use (use the first one)
|
|
for potentialjdkdir in $KNOWN_JDK_DIRS; do
|
|
if [ -r "$potentialjdkdir/bin/java" -a -z "$FOUND_JAVA_HOME" ]; then
|
|
FOUND_JAVA_HOME="$potentialjdkdir"
|
|
fi
|
|
done
|
|
|
|
if [ -z "$FOUND_JAVA_HOME" ]; then
|
|
# still nothing found :(
|
|
echo Please make sure to have Java installed and JRE_HOME variable set before running Logisim-evolution
|
|
else
|
|
echo Updating runtime-settings using known location
|
|
RUNTIME_PATH_TO_SET="$FOUND_JAVA_HOME"
|
|
fi
|
|
else
|
|
echo Updating runtime-settings using JAVA_HOME
|
|
# JAVA_HOME is set, use that value
|
|
RUNTIME_PATH_TO_SET="$JAVA_HOME"
|
|
fi
|
|
fi
|
|
|
|
# always write runtime-location, as it might get removed again when user calls dpkg-reconfigure
|
|
sed -i "s|app.runtime=.*|app.runtime=$RUNTIME_PATH_TO_SET|g" /opt/Logisim-evolution/app/Logisim-evolution.cfg
|
|
fi
|
|
;;
|
|
|
|
abort-upgrade|abort-remove|abort-deconfigure)
|
|
;;
|
|
|
|
*)
|
|
echo "postinst called with unknown argument \`$1'" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
# dh_installdeb will replace this with shell code automatically
|
|
# generated by other debhelper scripts.
|
|
|
|
#DEBHELPER#
|
|
|
|
exit 0
|