#!/bin/sh

################################################################################
# Run after installing the main package files. This script lays down any
# required folders, install notes and links that may be needed by the software.
#
# Code42 Software Inc, Minneapolis, MN
# http://www.code42.com/
# 
# Copyright (c) 2008 Code42 Software, All Rights Reserved
################################################################################

# standard install location
TARGETDIR=${PKG_INSTALL_ROOT}/opt/sfw/crashplan

echo "Attempting to remove application"
echo "directory and its log files. Paths:"
echo "  ${TARGETDIR}"
rm -rf ${TARGETDIR}

# strip out the keys
identityFile=/var/lib/crashplan/.identity
if [ -f "$identityFile" ] ; then
	sed -e '/dataKey/ d' -e '/secureDataKey/ d' -e '/privateKey/ d' -e '/publicKey/ d' -e '/securityKeyType/ d' "$identityFile" > "${identityFile}.tmp"
	mv "${identityFile}.tmp" "$identityFile"
	chmod 600 "$identityFile"
fi

exit 0
