src/brand/common.ksh
changeset 1091 fc73bc2d78ce
parent 954 8614b0c63fb3
child 1111 26c3e2407c53
--- a/src/brand/common.ksh	Wed Apr 29 14:38:04 2009 -0700
+++ b/src/brand/common.ksh	Wed Apr 29 15:49:05 2009 -0700
@@ -130,3 +130,27 @@
 			;;
 	esac
 }
+
+#
+# Emits to stdout the entire incorporation for this image,
+# stripped of publisher name and other junk.
+#
+get_entire_incorp() {
+	typeset entire_fmri
+	entire_fmri=$($PKG list -Hv entire | nawk '{print $1}')
+	if [[ $? -ne 0 ]]; then
+		return 1
+	fi
+	entire_fmri=$(echo $entire_fmri | sed 's@^pkg://[^/]*/@@')
+	entire_fmri=$(echo $entire_fmri | sed 's@^pkg:/@@')
+	echo $entire_fmri
+	return 0
+}
+
+#
+# Emits to stdout the preferred publisher and its URL.
+#
+get_preferred_publisher() {
+	$PKG publisher -PH | nawk '$2 == "origin" && $3 == "online" \
+	    {printf "%s %s\n", $1, $4; exit 0;}'
+}