#!/bin/bash
_package="smart-languagesetup"
_version="1.0.514.1-1"
_function="pre"
_install_dir="Language Setup"
_install_prefix="/opt/SMART Technologies"
export INSTALL_DIR="$_install_prefix"/"$_install_dir"


##AUTOPACKAGE_IMPORT_BEGIN##
##############################################
# Inserted: autopackage specific script

function all_action ()
{



##########################################################################################################

if [[ -n "${SHORTNAME:-""}" ]] && [[ -f "/tmp/debug_${SHORTNAME}" ]]; then set -x; fi
if [[ -n "${_package:-""}" ]] && [[ -f "/tmp/debug_${_package}" ]]; then set -x; fi

export SMARTTECHCONFNAME="/etc/xdg/SMART Technologies.conf"
export OLD_SMARTTECHCONFNAME="/etc/xdg/smarttech.conf"
export LANGUAGE_SETUP_CONFIG="/etc/xdg/SMART Technologies/Language Setup.conf"
export NOTEBOOK_CONFIG="/etc/xdg/SMART Technologies/SMART Notebook.conf"
export PREFIX="/opt/SMART Technologies"
export INSTALL_DIR="${PREFIX}/Language Setup"

export _store_dir="${PREFIX}/.store/SMARTLanguageSetup"

##########################################################################################################

########################################################################
# Substituted: debian marker

export SOFTWAREVERSION="1.0.514.1"
export package_name="smart-languagesetup"
export autopackage_short_name="SMARTLanguageSetup"
export debian_script="true"
export _store_dir="${PREFIX}/.store/${package_name}"
export _install_log_file="${_store_dir}/install/installlog"
export _install_log_file2="${_store_dir}/install/installlog2"
export _install_log_file3="${_store_dir}/install/installlog3"
export NO_GUI="1"

##CUSTOMIZATION_START##
##CUSTOMIZATION_END##

# /Substituted
########################################################################

########################################################################
# Substituted: pre install marker

if [[ -f "${PREFIX}/.${autopackage_short_name}" ]] && [[ "$( /usr/bin/head -1 "${PREFIX}/.${autopackage_short_name}" )" != "debian" ]]
then
	echo "This package (${package_name}) is already installed with autopackage (${autopackage_short_name}) or by other means."
	echo "Uninstall ${autopackage_short_name} before installing this package."
	false
fi

# /Substituted
########################################################################

}

# /Inserted autopackage specific script
##############################################
##AUTOPACKAGE_IMPORT_END##


##############################################
# Inserted: event handler framework 

###############################################################
# framework for rpm

# This line is a debugging aid to just copy files w/o doing any scripting
[ ${RPM_MAINTAINER_NOSCRIPTS:-null} != null ] && exit 0

# This line is a debugging aid to set tracing
[ ${RPM_DEBUG_SCRIPTS:-null} != null ] && echo rpmdebugging  &&  set -x


#set -e
# The function name gets set by the generator, so the framework is unique
#_function=postun

_logfile=smart_rpm_install.log
[ ${RPM_MAINTAINER_LOGPATH:-null} != null ] && _logfile=${RPM_MAINTAINER_LOGPATH}/$_logfile || _logfile=/root/$_logfile

# know thyself 
_self="$_package.$_version.$_function"
[ -z "$_self" ] && _self="$0"

# state thy business
if [ ${RPM_MAINTAINER_LOG:-null} != null ]; then
    	echo "$(date) $_self $*" >> $_logfile 
fi

#=========================================================================
#
# find out the will of the gods
#
#
#case $_function in
#pre|post)
#	nr_after=$1
#	nr_before=(( $nr_after - 1 ))
#	[ $nr_before -eq 0 ] && FIRST_INSTANCE= true && UPGRADING= 0
#	[ $nr_before -gt 0 ] && FIRST_INSTANCE= false && UPGRADING= 1
#	;;
#preun|postun)
#	nr_after=$1
#	nr_before=(( $nr_after + 1 ))
#	[ $nr_after -eq 0 ] && LAST_INSTANCE= true
#	[ $nr_after -gt 0 ] && FIRST_INSTANCE= false
#	UPGRADING=0
#	;;
#esac
#
#INSTALL_RUNNING=$UPGRADING

all_action
_status=$?
exit $_status



#
###########
#
# END OF SCRIPT
#
###############################################################
# /Inserted event handler framework 
##############################################
