# This runs before upgrade or uninstall.
# Use this file to do things like stop services prior to upgrade or uninstall.
# NOTE: It is an anti-pattern to call chocolateyUninstall.ps1 from here. If you
#  need to uninstall an MSI prior to upgrade, put the functionality in this
#  file without calling the uninstall script. Make it idempotent in the
#  uninstall script so that it doesn't fail when it is already uninstalled.
# NOTE: For upgrades - like the uninstall script, this script always runs from
#  the currently installed version, not from the new upgraded package version.

# Chocolatey package arguments
$installPath = Join-Path $env:LOCALAPPDATA "com.toki-labs.oto"
$otoExePath = Join-Path $installPath "oto.exe"

# Step 1: Execute 'oto scheduler -t cli'
Write-Host "Executing 'oto scheduler -t'..."
& $otoExePath scheduler -t