#!/bin/sh

#
# location of installation log
#

NI_LOG="/tmp/NeatImage Install.log"

#
# start of log writing
#

echo "starting postflight stage" > $NI_LOG 

umask 0

#
# execute ps_loc utility
#

if `"$2/NeatImage/ps_loc" "$1" "$2" "$3" "$4"`; then

#
# Photoshop located successfuly
#
    echo "Photoshop located successfuly" >> $NI_LOG
else

#
# Failed to determine location of Photoshop
#
    echo "Failed to determine location of Photoshop" >> $NI_LOG
fi

# prevent deleting files in Profiles and Presets folders

cp -Rf "$2/NeatImage/Update/" "$2/NeatImage/"
rm -Rf "$2/NeatImage/Update"

# kill ps_loc setup utility

rm -f "$2/NeatImage/ps_loc"

# set permissions

chmod -R 0777 "$2/NeatImage"

#
# end of log writing
#

echo "ending postflight stage" >> $NI_LOG
