3
# Set file permissions of Grid Engine distribution
6
##########################################################################
8
# The Contents of this file are made available subject to the terms of
9
# the Sun Industry Standards Source License Version 1.2
11
# Sun Microsystems Inc., March, 2001
14
# Sun Industry Standards Source License Version 1.2
15
# =================================================
16
# The contents of this file are subject to the Sun Industry Standards
17
# Source License Version 1.2 (the "License"); You may not use this file
18
# except in compliance with the License. You may obtain a copy of the
19
# License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
21
# Software provided under this License is provided on an "AS IS" basis,
22
# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
23
# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
24
# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
25
# See the License for the specific provisions governing your rights and
26
# obligations concerning the Software.
28
# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
30
# Copyright: 2001 by Sun Microsystems, Inc.
32
# All Rights Reserved.
34
##########################################################################
38
# The $OPTFILES are not mandatory for a distribution and will be set only if
41
# This script must be called by user root on a machine where user root has
42
# permissions to change the ownership of a file
44
# It is not necessary to run this script if the distribtuon has been
45
# installed with pkgadd, since pkgadd takes care about the correct
49
PATH=/bin:/usr/bin:/usr/sbin
51
FILELIST="3rd_party bin ckpt examples inst_sge install_execd install_qmaster \
52
lib mpi pvm qmon util utilbin"
54
OPTFILES="catman doc include man"
56
SUIDFILES="utilbin/*/rsh utilbin/*/rlogin utilbin/*/testsuidroot bin/*/sgepasswd utilbin/*/authuser"
60
#---------------------------------------------------
69
$ECHO "Verifying and setting file permissions and owner in >$f<"
72
find $f -type d -exec chmod 755 {} \;
73
find $f -type f -perm -100 -exec chmod go+x {} \;
78
#---------------------------------------------------------------------
84
if [ -z "$SGE_ROOT" -o ! -d "$SGE_ROOT" ]; then
86
echo ERROR: Please set your \$SGE_ROOT environment variable
87
echo and start this script again. Exit.
92
if [ ! -f "$SGE_ROOT/util/arch" ]; then
94
echo ERROR: The shell script \"$SGE_ROOT/util/arch\" does not exist.
95
echo Please verify your distribution and restart this script. Exit.
100
if [ ! -f $SGE_ROOT/util/arch_variables ]; then
102
echo ERROR: Missing shell script \"$SGE_ROOT/util/arch_variables\".
103
echo Please verify your distribution and restart this script. Exit.
108
. $SGE_ROOT/util/arch_variables
110
if [ $ARCH = "win32-x86" ]; then
112
echo "ERROR: Using this script on windows is not supported!"
113
echo "Please execute this script on a unix host"
118
if [ $# -lt 1 ]; then
120
echo Set file permissions and owner of Grid Engine distribution in \$SGE_ROOT
122
echo "usage: $0 [-auto] <sge_root>"
124
echo example: $0 \$SGE_ROOT
129
if [ $1 = -auto ]; then
134
if [ $1 = / -o $1 = /etc ]; then
136
echo ERROR: cannot set permissions in \"$1\" directory of your system.
141
if [ `echo $1 | env LC_ALL=C cut -c1` != / ]; then
143
echo ERROR: Please give an absolute path for the distribution.
149
if [ $instauto = true ]; then
153
$ECHO " WARNING WARNING WARNING"
154
$ECHO " -----------------------"
155
$ECHO "We will set the the file ownership and permission to"
159
$ECHO " In directory: $1"
161
$ECHO "We will also install the following binaries as SUID-root:"
163
$ECHO " \$SGE_ROOT/utilbin/<arch>/rlogin"
164
$ECHO " \$SGE_ROOT/utilbin/<arch>/rsh"
165
$ECHO " \$SGE_ROOT/utilbin/<arch>/testsuidroot"
166
$ECHO " \$SGE_ROOT/bin/<arch>/sgepasswd"
167
$ECHO " \$SGE_ROOT/bin/<arch>/authuser"
170
TEXT="Do you want to set the file permissions (yes/no) [NO] >> \c"
173
while [ $YesNo_done = false ]; do
176
if [ "$YesNo_INP" = "yes" -o "$YesNo_INP" = YES ]; then
178
elif [ "$YesNo_INP" = "NO" -o "$YesNo_INP" = no ]; then
180
$ECHO "We will NOT set the file permissions. Exiting."
188
$ECHO "ERROR: can't change to directory \"$1\". Exiting."
192
for f in $FILELIST; do
193
if [ ! -f $f -a ! -d $f ]; then
195
$ECHO "Obviously this is not a complete Grid Engine distribution or this"
196
$ECHO "is not your \$SGE_ROOT directory."
198
$ECHO "Missing file or directory: $f"
200
$ECHO "Your file permissions will not be set. Exit."
206
for f in $FILELIST $OPTFILES; do
207
if [ -d $f -o -f $f ]; then
212
for file in $SUIDFILES; do
213
# Windows NFS Server does not like suid files
214
if [ "`echo $file | grep win32-x86`" != "" ]; then
222
$ECHO "Your file permissions were set"