-if [ ! -f /etc/xensource-inventory ]; then
- printf "XenSource inventory not present in /etc/xensource-inventory"
- exit 1
-fi
-
-if [ "$1" = "1" ]; then
- if md5sum -c --status <<EOF
-ca141d60061dcfdade73e75abc6529b5 /usr/sbin/brctl
-b8e9835862ef1a9cec2a3f477d26c989 /etc/xensource/scripts/vif
-51970ad613a3996d5997e18e44db47da /opt/xensource/libexec/interface-reconfigure
-5654c8c36699fcc8744ca9cd5b855414 /usr/sbin/xen-bugtool
-EOF
- then
- printf "\nVerified host scripts from XenServer 5.5.0.\n\n"
- elif md5sum -c --status <<EOF
-ca141d60061dcfdade73e75abc6529b5 /usr/sbin/brctl
-b8e9835862ef1a9cec2a3f477d26c989 /etc/xensource/scripts/vif
-51970ad613a3996d5997e18e44db47da /opt/xensource/libexec/interface-reconfigure
-f6519085c2fc5f7bc4eccc294ed62000 /usr/sbin/xen-bugtool
-EOF
- then
- printf "\nVerified host scripts from XenServer 5.5.0-24648p (Update 1)\n"
- printf "or 5.5.0-25727p (Update 2).\n\n"
- elif md5sum -c --status <<EOF
-ca141d60061dcfdade73e75abc6529b5 /usr/sbin/brctl
-02cf136237ed85fcbcc1efc15ce0591c /opt/xensource/libexec/interface-reconfigure
-3a192ee70ebf2153c90051b3af95f331 /opt/xensource/libexec/InterfaceReconfigureBridge.py
-f71cadf1464caefa7943de0ab47fdd8a /opt/xensource/libexec/InterfaceReconfigure.py
-d70f08f235fb1bfd49a0580e440f15a0 /opt/xensource/libexec/InterfaceReconfigureVswitch.py
-f5c85ca825b1e6f5a0845530981cd836 /etc/xensource/scripts/vif
-facb851606f82ca2bcc760a4d91bbe33 /usr/sbin/xen-bugtool
-EOF
- then
- printf "\nVerified host scripts from XenServer 5.5.900-29381p.\n\n"
+# A list of Citrix XenServer scripts that we might need to replace
+# with our own versions.
+scripts="
+ /etc/xensource/scripts/vif
+ /opt/xensource/libexec/InterfaceReconfigure.py
+ /opt/xensource/libexec/InterfaceReconfigureBridge.py
+ /opt/xensource/libexec/InterfaceReconfigureVswitch.py
+ /opt/xensource/libexec/interface-reconfigure"
+
+# Calculate into $md5sums a comma-separated set of md5sums of the
+# Citrix XenServer scripts that we might need to replace. We might be
+# upgrading an older version of the package that moved the files out
+# of the way, so we need to look for the files in those out-of-the-way
+# locations first.
+md5sums=
+for script in $scripts; do
+ b=$(basename "$script")
+ if test -e /usr/lib/openvswitch/xs-saved/"$b"; then
+ f=/usr/lib/openvswitch/xs-saved/"$b"
+ elif test -e /usr/lib/openvswitch/xs-original/"$b"; then
+ f=/usr/lib/openvswitch/xs-original/"$b"
+ elif test -e "$script" && test ! -h "$script"; then
+ f=$script