--- set-publisher.sh.old	2012-09-18 19:41:03.539454179 -0500
+++ set-publisher.sh	2012-09-18 23:06:23.159210653 -0500
@@ -21,6 +21,10 @@
 #
 
 #
+# Copyright (c) 2012 Prominic.NET, Inc. All rights reserved.
+#
+
+#
 # Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
 #
 
@@ -29,7 +33,7 @@
 # in set-publisher.transforms to change the consolidation-specific
 # publisher names to that specified by the transforms file.
 #
-# There are 3 options:
+# There are 5 options:
 #   -b <build>
 #     e.g. -b 136, to make sure to publish only packages from the
 #     specified build.  Packages from any other builds contained in the
@@ -57,22 +61,33 @@
 #     specified this way and those packages will not be republished.  This
 #     option is optional and mutually exclusive with -j.
 #
+#   -t <transform_file>
+#     The file containing the transforms to make on the packages. If not present,
+#     defaults to "./set-publisher.tranforms" 
 
 recv_dir=
 publish_repo=
 only_this_build=
 just_these_pkgs=
 exclude_these_pkgs=
+transform_file="./set-publisher.transforms"
+
+if [[ -x './pkgmorgrify.py' ]];then
+	pkgmogrify='./pkgmogrify.py'
+else
+	pkgmogrify='pkgmogrify'
+fi
 
-while getopts b:d:j:p:x: opt; do
+while getopts b:d:j:p:x:t: opt; do
 	case $opt in
 	b)	only_this_build="$OPTARG";;
 	d)	recv_dir="$OPTARG";;
 	j)	just_these_pkgs="$just_these_pkgs $OPTARG";;
 	p)	publish_repo="$OPTARG";;
 	x)	exclude_these_pkgs="$exclude_these_pkg $OPTARG";;
+	t)	transform_file="$OPTARG";;
 	?)	print "Usage: $0: [-b build] -d directory [-j package ...]" \
-		    "-p publish_repo [-x package ...] input_repos"
+		    "-p publish_repo [-x package ...] [-t transforms_file] input_repos"
 		exit 2;;
 	esac
 done
@@ -140,9 +155,8 @@
 		rm -fr ${recv_dir}/${quoted}
 	done
 	for pkg in $(echo $recv_dir/*/*); do
-		./pkgmogrify.py -O $pkg/manifest $pkg/manifest \
-		    ./set-publisher.transforms
-		./pkg_publish $pkg $publish_repo
+		$pkgmogrify -O $pkg/manifest $pkg/manifest $transform_file 
+		pkgsend -s $publish_repo publish --fmri-in-manifest --no-catalog --no-index -d $pkg $pkg/manifest
 	done
 else
 	for unquoted in $just_these_pkgs; do
@@ -154,9 +168,8 @@
 			continue
 		fi
 		for pkg in $(echo $recv_dir/${quoted}/*); do
-			./pkgmogrify.py -O $pkg/manifest $pkg/manifest \
-			    ./set-publisher.transforms
-			./pkg_publish $pkg $publish_repo
+			$pkgmogrify -O $pkg/manifest $pkg/manifest $transform_file 
+			pkgsend -s $publish_repo publish --fmri-in-manifest --no-catalog --no-index -d $pkg $pkg/manifest
 		done
 	done
 fi
