--- a/scripts/OMakefile
+++ b/scripts/OMakefile
@@ -50,7 +50,8 @@
 	$(IPROG) sysconfig-xapi $(DESTDIR)/etc/sysconfig/xapi
 	mkdir -p $(DESTDIR)/etc/udev
 	$(IPROG) xen-backend.rules $(DESTDIR)/etc/udev
-	$(IPROG) xen-frontend.rules $(DESTDIR)/etc/udev
+	mkdir -p $(DESTDIR)/lib/udev/rules.d
+	$(IPROG) xen-frontend.rules $(DESTDIR)/lib/udev/rules.d/
 	$(IPROG) generate_ssl_cert $(LIBEXEC)
 	$(IPROG) fix_firewall.sh $(BIN_PATH)
 	mkdir -p $(BASE_PATH)/debug
--- a/scripts/vif
+++ b/scripts/vif
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # Copyright (C) 2008,2009 Citrix Systems, Inc.
 #
@@ -20,7 +20,7 @@
 
 # Keep other-config/ keys in sync with device.ml:vif_udev_keys
 
-BRCTL="/usr/sbin/brctl"
+BRCTL="/sbin/brctl"
 IP="/sbin/ip"
 
 vsctl="/usr/bin/ovs-vsctl"
@@ -185,7 +185,7 @@
 if [[ $# -lt 2 ]]; then
     TYPE=vif
 else
-    TYPE=$2
+    TYPE=`echo $2 | cut -d= -f2`
 fi
 
 case $NETWORK_MODE in
--- a/scripts/block-frontend
+++ b/scripts/block-frontend
@@ -9,7 +9,7 @@
 # If we block-attach a partition directly then events are generated
 # with DEVPATHs of the form /block/xvde1 -- we act on these.
 
-PARTITION=`echo ${DEVPATH} | cut -f 4 -d '/'`
+PARTITION=`echo ${DEVPATH} | cut -f 6 -d '/'`
 if [ ! -z ${PARTITION} ]; then
         # the bad kind of partition
 	exit
@@ -19,8 +19,8 @@
 
 # Extract the device type and ID from the PHYSDEVPATH eg
 # PHYSDEVPATH=/devices/xen/vbd-51728
-TYPE=`echo ${PHYSDEVPATH} | cut -f 4 -d '/' | cut -f 1 -d '-'`
-DEVID=`echo ${PHYSDEVPATH} | cut -f 2 -d '-'`
+TYPE=`echo ${DEVPATH} | cut -f 3 -d '/' | cut -f 1 -d '-'`
+DEVID=`echo ${DEVPATH} | cut -f 3 -d '/' | cut -f 2 -d '-'`
 
 XAPI=/xapi/${DOMID}/frontend/${TYPE}/${DEVID}
 
