open-src/data/smf-rbac/sun_vendor_select
changeset 851 d428083dbbdd
child 907 3c35d611cdaa
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/data/smf-rbac/sun_vendor_select	Sat Dec 05 22:13:03 2009 -0800
@@ -0,0 +1,102 @@
+#!/bin/ksh93
+#
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, and/or sell copies of the Software, and to permit persons
+# to whom the Software is furnished to do so, provided that the above
+# copyright notice(s) and this permission notice appear in all copies of
+# the Software and that both the above copyright notice(s) and this
+# permission notice appear in supporting documentation.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+# Except as contained in this notice, the name of a copyright holder
+# shall not be used in advertising or otherwise to promote the sale, use
+# or other dealings in this Software without prior written authorization
+# of the copyright holder.
+#
+# ident	"@(#)sun_vendor_select	1.1	09/12/05 SMI"
+#
+
+LINKDIR=/var/run/opengl
+
+PATH=/usr/bin:/usr/sbin
+
+# Do nothing if SUNWglrt is not present
+if [[ ! -d /usr/lib/SUNWgl ]] ; then
+    return 0
+fi
+
+ARCH="$(uname -p)"
+
+case "${ARCH}" in
+    sparc)	DIR64="sparcv9" ;;
+    *)		return 0	;; # Unsupported architecture
+esac
+
+# If this is just a probe, identify ourself and leave.
+if [[ $# -eq 1 ]]; then
+	if [[ $1 = "identify" ]]; then
+		# Claim to support whatever the console fb is
+		print "$(constype) sun"
+		return 0
+	fi
+fi
+
+# Make a directory. $1 is the pathname.
+function make_dir {
+	if [[ $# != 1 ]]; then
+		return
+	fi
+	if [[ ! -d $1 ]]; then
+		mkdir -p $1
+	fi	
+	chmod 755 $1
+}
+
+# Make a file link. $1 is the source path, $2 is the target path
+function make_link {
+	if [[ $# != 2 ]]; then
+		return
+	fi
+	if [[ -h $2 ]]; then
+		rm -f $2
+	fi
+	ln -sf $1 $2
+}
+
+# Create directories
+make_dir ${LINKDIR}
+make_dir ${LINKDIR}/lib
+make_dir ${LINKDIR}/lib/${DIR64}
+make_link ${DIR64} ${LINKDIR}/lib/64
+make_dir ${LINKDIR}/include
+make_dir ${LINKDIR}/server
+
+# User libraries
+make_link /usr/lib/SUNWgl/libGL.so.1 ${LINKDIR}/lib/libGL.so.1
+make_link /usr/lib/SUNWgl/${DIR64}/libGL.so.1 ${LINKDIR}/lib/${DIR64}/libGL.so.1
+
+# Server libraries
+make_link /usr/lib/xorg/modules/extensions/SUNWgl/libglx.so ${LINKDIR}/server/libglx.so
+
+# Includes
+make_link /usr/include/SUNWgl/gl.h	${LINKDIR}/include/gl.h
+make_link /usr/include/SUNWgl/glext.h	${LINKDIR}/include/glext.h
+make_link /usr/include/SUNWgl/glx.h	${LINKDIR}/include/glx.h
+make_link /usr/include/SUNWgl/glxext.h	${LINKDIR}/include/glxext.h
+
+return 0