#! /bin/sh
# vim:sts=4 sw=4 ts=4 et ai foldmethod=marker

. ${dn0}/.installer/plugin

FindPreviousInstall_Override #{{{
{
    # Oracle plugin uses defaults by default (stops asking the user for the install directory)
    use_defaults=1
} #}}}

InstallPlugin() #{{{
{
    # If there was a previous install, we have some legacy files that need removing. Let's remove those
    # files if they exist before moving on to install new files
    for old_file in "${install_dir}/libclntsh."*; do
        rm -f "${old_file}"
    done

    for old_file in "${install_dir}/libnnz"*; do
        rm -f "${old_file}"
    done

    for old_file in "${install_dir}/libociei"*; do
        rm -f "${old_file}"
    done

    for new_file in "${source_dir}/${distro}/"*; do
        InstallFile "${new_file}"
    done
} #}}}

InstallName() #{{{
{
    echo "Agent Oracle Plugin"
} #}}}

RegisterPlugin() #{{{
{
    current=`pwd`

    if [ -f "${install_dir}/oracle8i.so" ]; then
        LogMessage "Removing old `InstallName` registration..."
        "${install_dir}/RegPlugins" -U ORACLE_8I_SOLARIS "${install_dir}" "${install_dir}/tmp" OraclePlugin.XLOG
        rm -f "${install_dir}/oracle8i.so" "${install_dir}/uninstallOra.sh"
    fi

    LogMessage "Registering `InstallName`..."
    "${install_dir}/RegPlugins" -R ORACLE "${install_dir}" "${install_dir}/tmp" OraclePlugin.XLOG
} #}}}

oracle=1
