#!/bin/bash

set -euo pipefail

# PackageKit overlays payloads without removing paths that disappeared between
# versions. Replace only this product's onedir so stale modules and
# runlayer-<old>.dist-info cannot survive an upgrade or rollback.
TARGET_VOLUME="${3:?missing installer target volume}"
AIWATCH_BUNDLE="${TARGET_VOLUME%/}/usr/local/lib/runlayer/aiwatch"

rm -rf "$AIWATCH_BUNDLE"
