Add SMF service on Sun
authorMatthew R. Trower <dev@blackshard.net>
Mon, 18 Jun 2018 09:20:43 +0000 (04:20 -0500)
committerJon Trulson <jon@radscan.com>
Mon, 18 Jun 2018 18:18:17 +0000 (12:18 -0600)
cde/databases/CDE-RUN.udb
cde/programs/dtconfig/sun/dtconfig.src
cde/programs/dtconfig/sun/dtlogin.xml [new file with mode: 0644]

index af4e2fc76f0f4708e552703bebe6a846ce5a1d81..ffb43d8e4dde31ba170b68367f1bb242007452d9 100644 (file)
@@ -268,6 +268,12 @@ programs/dtconfig/sun/dtlogin.rc
        mode = 0555
 }
 #
+programs/dtconfig/sun/dtlogin.xml
+{ sun
+       install_target = /usr/dt/config/dtlogin.xml
+       mode = 0555
+}
+#
 programs/dtconfig/sun/dtconfig
 { sun 
        install_target = /usr/dt/bin/dtconfig
index 7e07b6f8745d970c8bd4d0420cffff1e5038dd6b..8956951a7e2d1c0164ca25ae9f9e786cdcd8953f 100644 (file)
@@ -69,6 +69,20 @@ fi
 
 RC_COPY=/etc/init.d/dtlogin
 
+XCOMM
+XCOMM Allow for configured and factory versions of dtlogin.xml
+XCOMM
+
+if [ -f CDE_CONFIGURATION_TOP/config/dtlogin.xml ]
+then
+  SVC_MASTER=CDE_CONFIGURATION_TOP/config/dtlogin.xml
+elif [ -f CDE_INSTALLATION_TOP/config/dtlogin.xml ]
+then
+  SVC_MASTER=CDE_INSTALLATION_TOP/config/dtlogin.xml
+fi
+
+SVC_COPY=application/graphical-login/dtlogin
+
 LEVEL_0_KILL=/etc/rc0.d/K10dtlogin
 LEVEL_1_KILL=/etc/rc1.d/K10dtlogin
 LEVEL_2_START=/etc/rc2.d/S99dtlogin
@@ -399,12 +413,23 @@ XCOMM
 
 case "$mode" in
 '-d')
-       /usr/bin/rm -f $LEVEL_2_START
+       if [ -f /usr/sbin/svcadm ]; then
+         if svcs $SVC_COPY >/dev/null 2>&1; then
+           if ! svcadm disable $SVC_COPY >/dev/null; then
+             Message 12 "disable failed"
+             Message 13 "could not disable dtlogin service" "svc-dtlogin"
+             exit 1
+           fi
+         fi
+       else
 
-       if [ -f $LEVEL_2_START ]; then
-          Message 12 "disable failed"
-          Message 13 "could not remove $LEVEL_2_START" $LEVEL_2_START
-          exit 1
+         /usr/bin/rm -f $LEVEL_2_START
+
+         if [ -f $LEVEL_2_START ]; then
+           Message 12 "disable failed"
+           Message 13 "could not remove $LEVEL_2_START" $LEVEL_2_START
+           exit 1
+         fi
        fi
 
        Message 14 "done"
@@ -412,42 +437,56 @@ case "$mode" in
        ;;
 
 '-e')
-       if [ -f $RC_MASTER ]; then
+       if [ -f /usr/sbin/svcadm ]; then
+         if ! svcs $SVC_COPY >/dev/null 2>&1; then
+           if ! svccfg import $SVC_MASTER; then
+             Message 16 "Enable Failed"
+             Message 17 "could not import $SVC_MASTER" $SVC_MASTER
+             exit 1
+           fi
+         elif ! svcadm enable $SVC_COPY >/dev/null; then
+           Message 16 "enable failed"
+           Message 17 "could not enable dtlogin service" svc-dtlogin
+           exit 1
+         fi
+       else
+         if [ -f $RC_MASTER ]; then
            /usr/bin/rm -f $RC_COPY
-       fi
+         fi
 
-       if [ ! -x $RC_COPY ]; then
-          if [ ! -f $RC_MASTER ]; then
+         if [ ! -x $RC_COPY ]; then
+           if [ ! -f $RC_MASTER ]; then
              Message 16 "enable failed"
              Message 17 "could not find $RC_MASTER" $RC_MASTER
              exit 1
-          fi
+           fi
 
-          /usr/bin/cp $RC_MASTER $RC_COPY      
-          /usr/bin/chmod 0555 $RC_COPY
+           /usr/bin/cp $RC_MASTER $RC_COPY
+           /usr/bin/chmod 0555 $RC_COPY
        
-          if [ ! -x $RC_COPY ]; then
+           if [ ! -x $RC_COPY ]; then
              Message 16 "enable failed"
              Message 18 "could not create $RC_COPY" $RC_COPY
              exit 1
-          fi
-       fi
+           fi
+         fi
 
-       /usr/bin/rm -f $LEVEL_0_KILL
-       /usr/bin/ln $RC_COPY $LEVEL_0_KILL 
+         /usr/bin/rm -f $LEVEL_0_KILL
+         /usr/bin/ln $RC_COPY $LEVEL_0_KILL
 
-       /usr/bin/rm -f $LEVEL_1_KILL
-       /usr/bin/ln $RC_COPY $LEVEL_1_KILL 
+         /usr/bin/rm -f $LEVEL_1_KILL
+         /usr/bin/ln $RC_COPY $LEVEL_1_KILL
 
-       /usr/bin/rm -f $LEVEL_2_START
-       /usr/bin/ln $RC_COPY $LEVEL_2_START
+         /usr/bin/rm -f $LEVEL_2_START
+         /usr/bin/ln $RC_COPY $LEVEL_2_START
 
-       if [ ! -f $LEVEL_2_START ]; then
-          Message 16 "enable failed"
-          Message 19 "could not create $LEVEL_2_START" $LEVEL_2_START
-          exit 1
-       fi
+         if [ ! -f $LEVEL_2_START ]; then
+           Message 16 "enable failed"
+           Message 19 "could not create $LEVEL_2_START" $LEVEL_2_START
+           exit 1
+         fi
 
+       fi
        Message 14 "done"
        Message 20 "desktop auto-start enabled."
        ;;
@@ -475,6 +514,10 @@ case "$mode" in
     ;;
 
 '-kill')
+       if [ -f /usr/sbin/svcadm ]; then
+          svcadm disable -t $SVC_COPY
+       fi
+
        rc_master_check
 
        $RC_MASTER stop
diff --git a/cde/programs/dtconfig/sun/dtlogin.xml b/cde/programs/dtconfig/sun/dtlogin.xml
new file mode 100644 (file)
index 0000000..621a809
--- /dev/null
@@ -0,0 +1,54 @@
+<?xml version='1.0'?>
+<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
+<service_bundle type='manifest' name='export'>
+  <service name='application/graphical-login/dtlogin' type='service' version='0'>
+    <dependency name='filesystem' grouping='require_all' restart_on='none' type='service'>
+      <service_fmri value='svc:/system/filesystem/local'/>
+    </dependency>
+    <dependency name='multi-user' grouping='require_all' restart_on='error' type='service'>
+      <service_fmri value='svc:/milestone/multi-user:default'/>
+    </dependency>
+    <dependency name='sysconfig' grouping='require_all' restart_on='none' type='service'>
+      <service_fmri value='svc:/milestone/sysconfig'/>
+    </dependency>
+    <dependency name='fc-cache' grouping='require_all' restart_on='none' type='service'>
+      <service_fmri value='svc:/application/font/fc-cache'/>
+    </dependency>
+    <dependency name='utmpx' grouping='require_all' restart_on='none' type='service'>
+      <service_fmri value='svc:/system/utmp'/>
+    </dependency>
+    <dependency name='hal' grouping='require_all' restart_on='none' type='service'>
+      <service_fmri value='svc:/system/hal'/>
+    </dependency>
+    <dependency name='dbus' grouping='require_all' restart_on='none' type='service'>
+      <service_fmri value='svc:/system/dbus'/>
+    </dependency>
+    <dependency name='graphical-login' grouping='exclude_all' restart_on='none' type='service'>
+      <service_fmri value='svc:/application/graphical-login/lightdm'/>
+      <service_fmri value='svc:/application/graphical-login/gdm'/>
+      <service_fmri value='svc:/application/graphical-login/xdm'/>
+    </dependency>
+    <instance name='default' enabled='true'>
+      <exec_method name='start' type='method' exec='/usr/dt/bin/dtlogin -daemon' timeout_seconds='60'/>
+      <exec_method name='stop' type='method' exec='/usr/dt/bin/dtconfig -kill' timeout_seconds='60'/>
+      <exec_method name='refresh' type='method' exec='/usr/dt/bin/dtconfig -reset' timeout_seconds='60'/>
+      <property_group name='dtlogin' type='application'>
+        <propval name='args' type='astring' value=''/>
+      </property_group>
+      <property_group name='general' type='framework'>
+        <propval name='action_authorization' type='astring' value='solaris.smf.manage.dt.login'/>
+      </property_group>
+    </instance>
+    <template>
+      <common_name>
+        <loctext xml:lang='C'>Desktop Login Manager</loctext>
+      </common_name>
+      <description>
+        <loctext xml:lang='C'>Desktop Login Manager</loctext>
+      </description>
+      <documentation>
+        <manpage title='dtlogin' section='1' manpath='/usr/dt/man'/>
+      </documentation>
+    </template>
+  </service>
+</service_bundle>