#!/bin/bash
# Last Modified: 2008-26-06 02:56:33
# Tornado Online Backup Version: 5.2.6.0 (Build:8)

# $1 is the PKG path
PKG_HOME=$1

TIMESTAMP_LOG=`date "+%y%m%d%H%M%S"`
CONFIG_LOG=/Applications/obm.pkg-config-${TIMESTAMP_LOG}.log

# Config Applicaiton Home: /Applications/Tornado Online Backup
sh "${PKG_HOME}/Contents/Resources/custom-config" "${TIMESTAMP_LOG}" > "${CONFIG_LOG}"

# Startup Services
# Scheduler Service Path:  /Library/StartupItems/TornadoOnlineBackup
# AutoUpdate Service Path: /Library/StartupItems/TornadoOnlineBackup-AutoUpdate
# Startup Backup Manager
# Backup Manager Path:  /Applications/Tornado Online Backup/BackupManager.app

sh "${PKG_HOME}/Contents/Resources/custom-startup" >> "${CONFIG_LOG}"

if [ ! -e "/Applications/Tornado Online Backup/log" ]; then
	mkdir "/Applications/Tornado Online Backup/log"
fi

if [ ! -e "/Applications/Tornado Online Backup/log/installer" ]; then
	mkdir "/Applications/Tornado Online Backup/log/installer"
fi

cd /Applications

mv ./obm.pkg-*.log "/Applications/Tornado Online Backup/log/installer/"