#!/bin/sh

# MythTV installer support, preinstall script
# Note that all the preinstall scripts are run (as root), then the payload is 'shove'd into place
# After that, all the postinstall scripts are run.  
# Script also runs in a sandbox with no access to /Private and other directories
# note that launchctl requires sudo

echo mythtv.28 preinstall script starting

echo if backend loaded, unload before continuing install
if /bin/launchctl list "org.mythtv.mythbackend" &> /dev/null; then
    /bin/launchctl unload "/Library/LaunchDaemons/org.mythtv.mythbackend.plist"
    echo ...backend now unloaded
fi

echo mythtv.28 preinstall script finished
