1387 Create hooks for Visual Panels
authorDavid Powell <David.Powell@sun.com>
Mon, 21 Apr 2008 15:56:52 -0700
changeset 345 98b9538bfe3f
parent 344 4c887185d780
child 346 5464a914fbb8
1387 Create hooks for Visual Panels
src/util/distro-import/86/SUNWfixes.prototype
src/util/distro-import/86/coreadm.xml
src/util/distro-import/86/svc-coreadm
src/util/distro-import/86/vp-services
src/util/distro-import/86/vp-shares
src/util/distro-import/Makefile
src/util/distro-import/common/SUNWcs.86
src/util/distro-import/common/SUNWgnome-system-tools
src/util/distro-import/desktop_exec.sh
--- a/src/util/distro-import/86/SUNWfixes.prototype	Mon Apr 21 14:19:31 2008 -0700
+++ b/src/util/distro-import/86/SUNWfixes.prototype	Mon Apr 21 15:56:52 2008 -0700
@@ -29,6 +29,7 @@
 f none etc/zones/SUNWdefault.xml 0444 root bin
 f none lib/svc/method/fs-usr 0555 root bin
 f none lib/svc/method/sshd 0555 root bin
+f none lib/svc/method/svc-coreadm 0555 root bin
 f none lib/svc/method/svc-dlmgmtd 0555 root bin
 d none root 0700 root root
 f none usr/bin/ksh 0755 root bin
@@ -40,7 +41,12 @@
 f none usr/jdk/instances/jdk1.6.0/README.html 0644 root bin
 f none usr/jdk/instances/jdk1.6.0/jre/LICENSE 0644 root bin
 f none usr/jdk/instances/jdk1.6.0/jre/README 0644 root bin
+f none usr/lib/vp-services 0555 root bin
+f none usr/lib/vp-shares 0555 root bin
+f none usr/share/applications/services.desktop 0644 root bin
+f none usr/share/applications/shares.desktop 0644 root bin
 f none usr/share/man/man.cf 0644 root bin
 f none usr/share/man/missing.man 0444 root bin
 f none var/svc/profile/generic_limited_net.xml 0444 root sys
 f none var/svc/profile/generic_open.xml 0444 root sys
+f manifest var/svc/manifest/system/coreadm.xml 444 root sys
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/util/distro-import/86/coreadm.xml	Mon Apr 21 15:56:52 2008 -0700
@@ -0,0 +1,141 @@
+<?xml version="1.0"?>
+<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
+<!--
+ Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ Use is subject to license terms.
+
+ CDDL HEADER START
+
+ The contents of this file are subject to the terms of the
+ Common Development and Distribution License (the "License").
+ You may not use this file except in compliance with the License.
+
+ You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ or http://www.opensolaris.org/os/licensing.
+ See the License for the specific language governing permissions
+ and limitations under the License.
+
+ When distributing Covered Code, include this CDDL HEADER in each
+ file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ If applicable, add the following below this CDDL HEADER, with the
+ fields enclosed by brackets "[]" replaced with your own identifying
+ information: Portions Copyright [yyyy] [name of copyright owner]
+
+ CDDL HEADER END
+
+	ident	"@(#)coreadm.xml	1.1	08/04/04 SMI"
+
+	NOTE:  This service manifest is not editable; its contents will
+	be overwritten by package or patch operations, including
+	operating system upgrade.  Make customizations in a different
+	file.
+
+	Service manifest for coreadm.
+-->
+
+<service_bundle type='manifest' name='SUNWcsr:coreadm'>
+
+<service
+	name='system/coreadm'
+	type='service'
+	version='1'>
+
+	<single_instance />
+
+	<dependency
+		name='usr'
+		type='service'
+		grouping='require_all'
+		restart_on='none'>
+		<service_fmri value='svc:/system/filesystem/minimal' />
+	</dependency>
+
+	<dependency
+		name='coreadm_manifest-import'
+		type='service'
+		grouping='require_all'
+		restart_on='none'>
+		<service_fmri value='svc:/system/manifest-import:default' />
+	</dependency>
+
+	<instance name='default' enabled='false'>
+		<exec_method
+			type='method'
+			name='start'
+			exec='/lib/svc/method/svc-coreadm %m'
+			timeout_seconds='60' />
+
+		<exec_method
+			type='method'
+			name='refresh'
+			exec='/lib/svc/method/svc-coreadm %m'
+			timeout_seconds='60' />
+
+		<exec_method
+			type='method'
+			name='stop'
+			exec=':true'
+			timeout_seconds='60' />
+
+		<property_group name='startd' type='framework'>
+			<propval name='duration' type='astring'
+				value='transient' />
+		</property_group>
+
+		<property_group name='config_params' type='application'>
+			<propval
+				name='global_pattern'
+				type='astring'
+				value='' />
+			<propval
+				name='global_content'
+				type='astring'
+				value='default' />
+			<propval
+				name='init_pattern'
+				type='astring'
+				value='core' />
+			<propval
+				name='init_content'
+				type='astring'
+				value='default' />
+			<propval
+				name='global_enabled'
+				type='boolean'
+				value='false' />
+			<propval
+				name='process_enabled'
+				type='boolean'
+				value='true' />
+			<propval
+				name='global_setid_enabled'
+				type='boolean'
+				value='false' />
+			<propval
+				name='process_setid_enabled'
+				type='boolean'
+				value='false' />
+			<propval
+				name='global_log_enabled'
+				type='boolean'
+				value='false' />
+		</property_group>
+	</instance>
+	<stability value='Unstable' />
+	<template>
+		<common_name>
+			<loctext xml:lang='C'>
+				system-wide core file configuration
+			</loctext>
+		</common_name>
+
+		<documentation>
+			<manpage
+				title='coreadm'
+				section='1M'
+				manpath='/usr/share/man' />
+		</documentation>
+	</template>
+</service>
+
+</service_bundle>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/util/distro-import/86/svc-coreadm	Mon Apr 21 15:56:52 2008 -0700
@@ -0,0 +1,128 @@
+#!/sbin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"@(#)svc-coreadm	1.3	08/04/04 SMI"
+#
+# Start/refresh method script for the coreadm service.
+#
+
+. /lib/svc/share/smf_include.sh
+
+FMRI=${SMF_FMRI:-svc:/system/coreadm:default}
+
+read_conf() {
+	preamble="svccfg -s $FMRI setprop config_params/"
+
+	< /etc/coreadm.conf sed -n -e "
+	/^COREADM/!d
+	s/^\([^=]*_ENABLED=\)yes/\1true/
+	s/^\([^=]*_ENABLED=\)no/\1false/
+	s,^,$preamble,
+	s/COREADM_GLOB_PATTERN=\(.*\)$/global_pattern = astring: \"\1\"/p
+	s/COREADM_GLOB_CONTENT=\(.*\)$/global_content = astring: \"\1\"/p
+	s/COREADM_INIT_PATTERN=\(.*\)$/init_pattern = astring: \"\1\"/p
+	s/COREADM_INIT_CONTENT=\(.*\)$/init_content = astring: \"\1\"/p
+	s/COREADM_GLOB_ENABLED=/global_enabled = boolean: /p
+	s/COREADM_PROC_ENABLED=/process_enabled = boolean: /p
+	s/COREADM_GLOB_SETID_ENABLED=/global_setid_enabled = boolean: /p
+	s/COREADM_PROC_SETID_ENABLED=/process_setid_enabled = boolean: /p
+	s/COREADM_GLOB_LOG_ENABLED=/global_log_enabled = boolean: /p" | sh
+	svcadm refresh $FMRI
+}
+
+getprop() {
+	svcprop -p config_params/$1 $FMRI
+}
+
+error() {
+	echo "Error reading property \"$1\"" 1>&2
+	exit $SMF_EXIT_ERR_CONFIG
+}
+
+set_string() {
+	value="`getprop $1`"
+	[ $? -ne 0 ] && error $1
+	[ "$value" = "\"\"" ] && value=""
+	coreadm $2 "$value"
+}
+
+set_boolean() {
+	enabled="`getprop $1`"
+	[ $? -ne 0 ] && error $1
+	if [ "$enabled" = "true" ]; then
+		coreadm -e $2
+	else
+		coreadm -d $2
+	fi
+}
+
+apply_conf() {
+	set_string global_content -G
+	set_string init_content -I
+	set_string global_pattern -g
+	set_string init_pattern -i
+
+	set_boolean global_log_enabled log
+	set_boolean global_enabled global
+	set_boolean global_setid_enabled global-setid
+	set_boolean process_enabled process
+	set_boolean process_setid_enabled proc-setid
+}
+
+case $1 in
+"start")
+	# By virtue of using coreadm to effect coreadm changes,
+	# coreadm.conf should always be up-to-date.  Treat it as
+	# authoritative on boot to a) handle upgrade, and b)
+	# handle the situation where administrators are using
+	# the command to make customizations.
+	#
+	# In the off chance there is no coreadm.conf, apply the
+	# the SMF configuration.
+
+	if [ -f /etc/coreadm.conf ]; then
+		read_conf
+		coreadm -u
+	else
+		apply_conf
+	fi
+	;;
+"refresh")
+	# Refresh implies someone wants to apply the configuration
+	# stored in the service.  Do so.
+	#
+	# It is possible for someone to use coreadm directly and
+	# subsequently issue a refresh, resulting in the initial
+	# changes being lost.  Given that a refresh will either be
+	# issued explicitly by the administrator or by a
+	# configuration activity that has made changes to the SMF
+	# configuration and expects those changes to be applied,
+	# this shouldn't be a big problem.
+
+	apply_conf
+	;;
+esac
+
+exit $SMF_EXIT_OK
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/util/distro-import/86/vp-services	Mon Apr 21 15:56:52 2008 -0700
@@ -0,0 +1,35 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"@(#)vp-services	1.1	08/04/04 SMI"
+#
+
+JAVALIB=/usr/share/lib/java
+if [[ -f $JAVALIB/vpanels-panels-smf.jar ]]; then
+	exec java -client -jar $JAVALIB/vpanels-client.jar system/smf
+else
+	exec services-admin
+fi
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/util/distro-import/86/vp-shares	Mon Apr 21 15:56:52 2008 -0700
@@ -0,0 +1,35 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"@(#)vp-shares	1.1	08/04/04 SMI"
+#
+
+JAVALIB=/usr/share/lib/java
+if [[ -f $JAVALIB/vpanels-panels-sharemgr.jar ]]; then
+	exec java -client -jar $JAVALIB/vpanels-client.jar filesystem/sharemgr
+else
+	exec shares-admin
+fi
--- a/src/util/distro-import/Makefile	Mon Apr 21 14:19:31 2008 -0700
+++ b/src/util/distro-import/Makefile	Mon Apr 21 15:56:52 2008 -0700
@@ -73,7 +73,11 @@
 	etc/zones/SUNWdefault.xml		\
 	lib/svc/method/fs-usr			\
 	lib/svc/method/sshd			\
+	lib/svc/method/svc-coreadm		\
 	lib/svc/method/svc-dlmgmtd		\
+	usr/lib/vp-services			\
+	usr/lib/vp-shares			\
+	var/svc/manifest/system/coreadm.xml	\
 	var/svc/profile/generic_limited_net.xml \
 	var/svc/profile/generic_open.xml
 
@@ -101,6 +105,8 @@
 	usr/jdk/instances/jdk1.6.0/jre/README	\
 	usr/share/man/man.cf			\
 	usr/share/man/missing.man		\
+	usr/share/applications/services.desktop	\
+	usr/share/applications/shares.desktop	\
 	$(CACHED_FILES)
 
 JDKFILES = LICENSE README.html
@@ -213,6 +219,16 @@
 proto/usr/bin/ksh:	proto $(PROG)
 	cp $(PROG) $@
 
+proto/usr/share/applications/shares.desktop: proto
+	./get_file_from_pkg.py $(WOS_PKGS)/SUNWgnome-system-tools \
+	usr/share/applications/shares.desktop | \
+	./desktop_exec.sh /usr/lib/vp-shares > $@
+
+proto/usr/share/applications/services.desktop: proto
+	./get_file_from_pkg.py $(WOS_PKGS)/SUNWgnome-system-tools \
+	usr/share/applications/services.desktop | \
+	./desktop_exec.sh /usr/lib/vp-services > $@
+
 #
 # change root's default shell, homedir and add jack user
 #
@@ -253,8 +269,11 @@
 	mkdir -p proto/usr/bin
 	mkdir -p proto/usr/jdk/instances/jdk1.6.0/jre
 	mkdir -p proto/usr/share/man
+	mkdir -p proto/var/svc/manifest/system
 	mkdir -p proto/var/svc/profile
 	mkdir -p proto/usr/has/bin
+	mkdir -p proto/usr/lib
+	mkdir -p proto/usr/share/applications
 
 %/$(TMPPKGS):
 	$(MAKE) BUILDID=$(@D) $(@F)
--- a/src/util/distro-import/common/SUNWcs.86	Mon Apr 21 14:19:31 2008 -0700
+++ b/src/util/distro-import/common/SUNWcs.86	Mon Apr 21 15:56:52 2008 -0700
@@ -32,6 +32,7 @@
 drop etc/inet/hosts
 drop etc/nsswitch.conf
 drop lib/svc/method/fs-usr
+drop var/svc/manifest/system/coreadm.xml
 drop var/svc/profile/generic_limited_net.xml
 drop var/svc/profile/generic_open.xml
 # Use the 32-bit ksh93 as a replacement /bin/sh
@@ -40,6 +41,8 @@
 add link path=sbin/pfsh target=../usr/has/bin/sh
 add link path=sbin/sh target=../usr/bin/i86/ksh93
 from ./SUNWfixes import
+lib/svc/method/svc-coreadm
+var/svc/manifest/system/coreadm.xml
 # until the necessary actions are available
 etc/inet/services
 etc/security/auth_attr
--- a/src/util/distro-import/common/SUNWgnome-system-tools	Mon Apr 21 14:19:31 2008 -0700
+++ b/src/util/distro-import/common/SUNWgnome-system-tools	Mon Apr 21 15:56:52 2008 -0700
@@ -1,5 +1,14 @@
 package SUNWgnome-system-tools
 import SUNWgnome-system-tools
+drop usr/share/applications/services.desktop
+drop usr/share/applications/shares.desktop
+from ./SUNWfixes import
+# Insert hooks for Visual Panels
+usr/lib/vp-services
+usr/lib/vp-shares
+usr/share/applications/services.desktop
+usr/share/applications/shares.desktop
+end import
 import SUNWgnome-system-tools-devel
 import SUNWgnome-system-tools-root
 end package
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/util/distro-import/desktop_exec.sh	Mon Apr 21 15:56:52 2008 -0700
@@ -0,0 +1,26 @@
+#!/bin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+sed -e "s,^Exec=.*$,Exec=$1,"