#!/bin/sh
#
# Copyright (c) Citrix Systems 2008. All rights reserved.
#

# Runs on the George master when performing a rolling upgrade from Orlando

set -e

. /etc/xensource-inventory
XE="/opt/xensource/bin/xe"

# Clean all unreferenced patches out of the db now that the upgrade is complete.
# When upgrading to 5.0, this should clean out all 4.1 patches at the end.
function clean_patches {
    IFS=,
    for pool_patch in $(xe patch-list --minimal params=uuid hosts=) ; do
        xe patch-destroy uuid=${pool_patch}
    done
}

case "$1" in
  start)
    
  ;;
  stop)
    # Clean up patches
    clean_patches
  ;;
esac
