#!/usr/bin/env bash

SYSTEMCTL=$(command -v systemctl)

# Check if systemctl is present on the system
[[ -z $SYSTEMCTL ]] && exit 0

# Check if system is running init
[[ ! -d /run/systemd/system ]] && exit 0

# Check if this is an upgrade or remove
if [[ "$1" != "upgrade" ]]; then
  systemctl stop qbee-agent
fi
