3 ## This script wraps GNOME About, which is called by GNOME Session the first
4 ## time that a user logs in, and does some other iniital login tasks:
5 ## - Creates a launcher on the user's Desktop to open the Solaris Developer
7 ## - Launchs Firefox with the start page.
8 ## - For first logon by root launches users-admin tool
14 # The contents of this file are subject to the terms of the
15 # Common Development and Distribution License, Version 1.0 only
16 # (the "License"). You may not use this file except in compliance
19 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
20 # or http://www.opensolaris.org/os/licensing.
21 # See the License for the specific language governing permissions
22 # and limitations under the License.
24 # When distributing Covered Code, include this CDDL HEADER in each
25 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
26 # If applicable, add the following below this CDDL HEADER, with the
27 # fields enclosed by brackets "[]" replaced with your own identifying
28 # information: Portions Copyright [yyyy] [name of copyright owner]
33 # Copyright 2006 Sun Microsystems, Inc. All rights reserved.
34 # Use is subject to license terms.
38 ## Figure out the base installdir
41 if [ -z "$BASEDIR" ]; then
42 # /bin tends to be a symbolic link, so follow it and do calc basedir off
45 BASEDIR
=`cd "$DIRNAME"; sh -c pwd`
46 BASEDIR
="${BASEDIR%%/bin*}"
52 GNOME_ABOUT_BIN
="${BASEDIR}/lib/gnome-about"
53 GCONFTOOL
="${BASEDIR}/bin/gconftool-2"
54 FIREFOX
="${BASEDIR}/bin/firefox"
55 USERS_ADMIN
="${BASEDIR}/bin/users-admin"
56 XPG4_ID
="/usr/xpg4/bin/id"
59 GCONF_DEVGUIDE_PROMPT_KEY
="/apps/gnome-session/options/sun_extensions/viewed_dev_guide_jds_solaris"
60 SOLDEVEX_ROOT
="${BASEDIR}/share/doc/soldevex/html"
61 SOLDEVEX_FILE
="developer_guide.html"
62 XDG_APPLICATIONS_DIR
="${BASEDIR}/share/applications"
63 SOLDEVEX_DESKTOP_FILE
="devguide.desktop"
64 USER_DESKTOP_DIR
="${HOME}/Desktop"
67 ## Define some utility functions
71 # Checks if it's the first time the user is running gnome-about
75 if [ -x "${GCONFTOOL}" ]; then
76 value
=`${GCONFTOOL} -g "${GCONF_DEVGUIDE_PROMPT_KEY}" 2>/dev/null`
78 test "${value}" != "true"
83 if [ -x "${GCONFTOOL}" ]; then
84 ${GCONFTOOL} -s -t bool
"${GCONF_DEVGUIDE_PROMPT_KEY}" true
2>/dev
/null
91 # Looks for the developer guide HTML file.
93 # NOTE: First checks if a localised version exists, otherwise picks the
97 typeset LANG_FILE
="${SOLDEVEX_ROOT}/${LANG}/${SOLDEVEX_FILE}"
98 typeset DEFAULT_FILE
="${SOLDEVEX_ROOT}/${SOLDEVEX_FILE}"
99 if [ -r "${LANG_FILE}" ]; then
101 elif [ -r "${DEFAULT_FILE}" ]; then
102 echo "${DEFAULT_FILE}"
111 # Attempts to create an launcher on the user's desktop for a pointer to the
115 typeset XDG_DESKTOP_FILE
="${XDG_APPLICATIONS_DIR}/${SOLDEVEX_DESKTOP_FILE}"
116 typeset USER_DESKTOP_FILE
="${USER_DESKTOP_DIR}/${SOLDEVEX_DESKTOP_FILE}"
118 if [ -r "${XDG_DESKTOP_FILE}" ]; then
119 if [ ! -w "${USER_DESKTOP_DIR}" ]; then
120 mkdir
"${USER_DESKTOP_DIR}" ||
return 1 # If fails return
122 if [ ! -e "${USER_DESKTOP_FILE}" ]; then
123 cp "${XDG_DESKTOP_FILE}" "${USER_DESKTOP_FILE}" ||
return 1 # If fails return
132 # Launch firefox for the given HTML File
135 if [ -x "${FIREFOX}" -a -n "${1}" ]; then
136 ${FIREFOX} "${1}" & # Needs to be run in the background
144 if [ -x "${USERS_ADMIN}" ]; then
145 ${USERS_ADMIN} & # Needs to be run in the background
150 # Check if the user is NOT root.
154 if [ -x "$XPG4_ID" ]; then
155 USER_ID
=`${XPG4_ID} -u`
157 # Needs a little more work to get the UID.
159 USER_ID
=`expr "${USER_ID}" : "uid=\([0-9]*\)(.*" 2>/dev/null`
161 if [ -n "${USER_ID}" -a "${USER_ID}" -ne 0 ]; then
174 # See if we have the Solaris Developers Guide somewhere.
175 HTML_FILE
=`locateHTMLFile`
176 if [ $?
-eq 0 ]; then
177 # Try copy the Desktop entry over to users Desktop dir.
180 # Now try to launch Firefox with Dev Guide, but not for root
181 if isNotRootUser
; then
182 launchFirefox
"${HTML_FILE}"
188 # Now that we've finished, don't forget to remember this.
192 # Finally, just run the GNOME About application, with params, if any.
193 exec ${GNOME_ABOUT_BIN} ${1+"$@"}