xref: /titanic_52/usr/src/cmd/vt/vtxlock.sh (revision aecfc01d1bad84e66649703f7fc2926ef70b34ba)
1*aecfc01dSrui zang - Sun Microsystems - Beijing China#!/sbin/sh
2*aecfc01dSrui zang - Sun Microsystems - Beijing China#
3*aecfc01dSrui zang - Sun Microsystems - Beijing China# CDDL HEADER START
4*aecfc01dSrui zang - Sun Microsystems - Beijing China#
5*aecfc01dSrui zang - Sun Microsystems - Beijing China# The contents of this file are subject to the terms of the
6*aecfc01dSrui zang - Sun Microsystems - Beijing China# Common Development and Distribution License (the "License").
7*aecfc01dSrui zang - Sun Microsystems - Beijing China# You may not use this file except in compliance with the License.
8*aecfc01dSrui zang - Sun Microsystems - Beijing China#
9*aecfc01dSrui zang - Sun Microsystems - Beijing China# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*aecfc01dSrui zang - Sun Microsystems - Beijing China# or http://www.opensolaris.org/os/licensing.
11*aecfc01dSrui zang - Sun Microsystems - Beijing China# See the License for the specific language governing permissions
12*aecfc01dSrui zang - Sun Microsystems - Beijing China# and limitations under the License.
13*aecfc01dSrui zang - Sun Microsystems - Beijing China#
14*aecfc01dSrui zang - Sun Microsystems - Beijing China# When distributing Covered Code, include this CDDL HEADER in each
15*aecfc01dSrui zang - Sun Microsystems - Beijing China# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*aecfc01dSrui zang - Sun Microsystems - Beijing China# If applicable, add the following below this CDDL HEADER, with the
17*aecfc01dSrui zang - Sun Microsystems - Beijing China# fields enclosed by brackets "[]" replaced with your own identifying
18*aecfc01dSrui zang - Sun Microsystems - Beijing China# information: Portions Copyright [yyyy] [name of copyright owner]
19*aecfc01dSrui zang - Sun Microsystems - Beijing China#
20*aecfc01dSrui zang - Sun Microsystems - Beijing China# CDDL HEADER END
21*aecfc01dSrui zang - Sun Microsystems - Beijing China#
22*aecfc01dSrui zang - Sun Microsystems - Beijing China#
23*aecfc01dSrui zang - Sun Microsystems - Beijing China# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24*aecfc01dSrui zang - Sun Microsystems - Beijing China# Use is subject to license terms.
25*aecfc01dSrui zang - Sun Microsystems - Beijing China#
26*aecfc01dSrui zang - Sun Microsystems - Beijing China
27*aecfc01dSrui zang - Sun Microsystems - Beijing China#
28*aecfc01dSrui zang - Sun Microsystems - Beijing China# $1 is the display to be locked.
29*aecfc01dSrui zang - Sun Microsystems - Beijing China# /var/xauth/$1 is a symbolic link to the actual xauth file.
30*aecfc01dSrui zang - Sun Microsystems - Beijing China#
31*aecfc01dSrui zang - Sun Microsystems - Beijing China
32*aecfc01dSrui zang - Sun Microsystems - Beijing ChinaXSCREENSAVER_LOCK=/usr/openwin/bin/xscreensaver-command
33*aecfc01dSrui zang - Sun Microsystems - Beijing ChinaXSCREENSAVER_LOCKARGS="-lock"
34*aecfc01dSrui zang - Sun Microsystems - Beijing ChinaXSCREENSAVER_CHECKARGS="-time"
35*aecfc01dSrui zang - Sun Microsystems - Beijing ChinaXSCREENSAVER_LOCKED="locked"
36*aecfc01dSrui zang - Sun Microsystems - Beijing China
37*aecfc01dSrui zang - Sun Microsystems - Beijing ChinaOTHER_LOCK=/usr/openwin/bin/xlock
38*aecfc01dSrui zang - Sun Microsystems - Beijing ChinaOTHER_LOCKARGS="-mode blank"
39*aecfc01dSrui zang - Sun Microsystems - Beijing China
40*aecfc01dSrui zang - Sun Microsystems - Beijing ChinaXLSATOMS="/usr/openwin/bin/xlsatoms"
41*aecfc01dSrui zang - Sun Microsystems - Beijing ChinaXLSATOMS_ARGS="-name"
42*aecfc01dSrui zang - Sun Microsystems - Beijing ChinaCDE_ATOM=_DT_SM_PREFERENCES
43*aecfc01dSrui zang - Sun Microsystems - Beijing ChinaGNOME_ATOM=GNOME_SM_DESKTOP
44*aecfc01dSrui zang - Sun Microsystems - Beijing ChinaXSCREENSAVER_ATOM=SCREENSAVER
45*aecfc01dSrui zang - Sun Microsystems - Beijing China
46*aecfc01dSrui zang - Sun Microsystems - Beijing ChinaDISPLAY=:$1; export DISPLAY
47*aecfc01dSrui zang - Sun Microsystems - Beijing ChinaXAUTHORITY=/var/xauth/$1; export XAUTHORITY
48*aecfc01dSrui zang - Sun Microsystems - Beijing China
49*aecfc01dSrui zang - Sun Microsystems - Beijing China#
50*aecfc01dSrui zang - Sun Microsystems - Beijing China# Note that these text strings we're greping are not localized.
51*aecfc01dSrui zang - Sun Microsystems - Beijing China#
52*aecfc01dSrui zang - Sun Microsystems - Beijing China
53*aecfc01dSrui zang - Sun Microsystems - Beijing China#
54*aecfc01dSrui zang - Sun Microsystems - Beijing China# Is it GNOME?
55*aecfc01dSrui zang - Sun Microsystems - Beijing China#
56*aecfc01dSrui zang - Sun Microsystems - Beijing Chinaif ${XLSATOMS} ${XLSATOMS_ARGS} ${GNOME_ATOM} 2>/dev/null \
57*aecfc01dSrui zang - Sun Microsystems - Beijing China    | grep -w ${GNOME_ATOM} >/dev/null; then
58*aecfc01dSrui zang - Sun Microsystems - Beijing China	#
59*aecfc01dSrui zang - Sun Microsystems - Beijing China	# Is it xscreensaver?
60*aecfc01dSrui zang - Sun Microsystems - Beijing China	#
61*aecfc01dSrui zang - Sun Microsystems - Beijing China	# xscreensaver
62*aecfc01dSrui zang - Sun Microsystems - Beijing China	if [ -x ${XSCREENSAVER_LOCK} ]; then
63*aecfc01dSrui zang - Sun Microsystems - Beijing China		${XSCREENSAVER_LOCK} ${XSCREENSAVER_CHECKARGS} 2>/dev/null \
64*aecfc01dSrui zang - Sun Microsystems - Beijing China		    | grep -w ${XSCREENSAVER_LOCKED} >/dev/null && exit 0
65*aecfc01dSrui zang - Sun Microsystems - Beijing China
66*aecfc01dSrui zang - Sun Microsystems - Beijing China		${XSCREENSAVER_LOCK} ${XSCREENSAVER_LOCKARGS} >/dev/null 2>&1 &
67*aecfc01dSrui zang - Sun Microsystems - Beijing China		exit 0
68*aecfc01dSrui zang - Sun Microsystems - Beijing China	fi
69*aecfc01dSrui zang - Sun Microsystems - Beijing Chinafi
70*aecfc01dSrui zang - Sun Microsystems - Beijing China
71*aecfc01dSrui zang - Sun Microsystems - Beijing China#
72*aecfc01dSrui zang - Sun Microsystems - Beijing China# Is it CDE?
73*aecfc01dSrui zang - Sun Microsystems - Beijing China#
74*aecfc01dSrui zang - Sun Microsystems - Beijing Chinaif ${XLSATOMS} ${XLSATOMS_ARGS} ${CDE_ATOM} 2>/dev/null \
75*aecfc01dSrui zang - Sun Microsystems - Beijing China    | grep -w ${CDE_ATOM} >/dev/null; then
76*aecfc01dSrui zang - Sun Microsystems - Beijing China	exit 0
77*aecfc01dSrui zang - Sun Microsystems - Beijing Chinafi
78*aecfc01dSrui zang - Sun Microsystems - Beijing China
79*aecfc01dSrui zang - Sun Microsystems - Beijing China# In other situations, use xlock as default.
80*aecfc01dSrui zang - Sun Microsystems - Beijing Chinaif [ -x ${OTHER_LOCK} ]; then
81*aecfc01dSrui zang - Sun Microsystems - Beijing China	${OTHER_LOCK} ${OTHER_LOCKARGS} &
82*aecfc01dSrui zang - Sun Microsystems - Beijing China	exit 0
83*aecfc01dSrui zang - Sun Microsystems - Beijing Chinafi
84*aecfc01dSrui zang - Sun Microsystems - Beijing China
85*aecfc01dSrui zang - Sun Microsystems - Beijing Chinaexit 0
86