author | phh |
Fri, 28 Dec 2018 15:19:14 -0800 | |
changeset 53106 | 6c3407eee455 |
parent 50861 | 2b7d0e9405cf |
child 54987 | 2ffbc00d87ae |
permissions | -rw-r--r-- |
2 | 1 |
# |
50861
2b7d0e9405cf
8192953: sun/management/jmxremote/bootstrap/*.sh tests fail with error : revokeall.exe: Permission denied
hb
parents:
47216
diff
changeset
|
2 |
# Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
# |
|
5 |
# This code is free software; you can redistribute it and/or modify it |
|
6 |
# under the terms of the GNU General Public License version 2 only, as |
|
7 |
# published by the Free Software Foundation. |
|
8 |
# |
|
9 |
# This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
# version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
# accompanied this code). |
|
14 |
# |
|
15 |
# You should have received a copy of the GNU General Public License version |
|
16 |
# 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
# |
|
5506 | 19 |
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
20 |
# or visit www.oracle.com if you need additional information or have any |
|
21 |
# questions. |
|
2 | 22 |
# |
23 |
||
24 |
# |
|
25 |
# Utility Shell Script for generating .properties files or .password files |
|
26 |
# or .access files from a list of input .in files. |
|
27 |
# |
|
28 |
# Source in this GeneratePropertyPassword.sh and call the function |
|
12047
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
11988
diff
changeset
|
29 |
# generatePropertyPasswordFiles. |
2 | 30 |
# Call restoreFilePermissions to restore file permissions after the test completes |
31 |
# |
|
32 |
||
33 |
||
34 |
OS=`uname -s` |
|
35 |
UMASK=`umask` |
|
36 |
||
53106
6c3407eee455
8215966: GeneratePropertyPassword.sh uses bash syntax
phh
parents:
50861
diff
changeset
|
37 |
case $OS in |
6c3407eee455
8215966: GeneratePropertyPassword.sh uses bash syntax
phh
parents:
50861
diff
changeset
|
38 |
CYGWIN_NT*) |
11988
eeee0e3f1e91
7073626: RmiBootstrapTest.sh and RmiSslBootstrapTest.sh fail under Cygwin
sla
parents:
7668
diff
changeset
|
39 |
OS="Windows_NT" |
eeee0e3f1e91
7073626: RmiBootstrapTest.sh and RmiSslBootstrapTest.sh fail under Cygwin
sla
parents:
7668
diff
changeset
|
40 |
if [ -z "$SystemRoot" ] ; then |
50861
2b7d0e9405cf
8192953: sun/management/jmxremote/bootstrap/*.sh tests fail with error : revokeall.exe: Permission denied
hb
parents:
47216
diff
changeset
|
41 |
SystemRoot=`cygpath $SYSTEMROOT` |
11988
eeee0e3f1e91
7073626: RmiBootstrapTest.sh and RmiSslBootstrapTest.sh fail under Cygwin
sla
parents:
7668
diff
changeset
|
42 |
fi |
53106
6c3407eee455
8215966: GeneratePropertyPassword.sh uses bash syntax
phh
parents:
50861
diff
changeset
|
43 |
esac |
11988
eeee0e3f1e91
7073626: RmiBootstrapTest.sh and RmiSslBootstrapTest.sh fail under Cygwin
sla
parents:
7668
diff
changeset
|
44 |
|
2 | 45 |
case $OS in |
22602
0d9a07b0d7e9
8028537: PPC64: Updated the JDK regression tests to run on AIX
simonis
parents:
12047
diff
changeset
|
46 |
SunOS | Linux | Darwin | AIX ) |
2 | 47 |
PATHSEP=":" |
48 |
FILESEP="/" |
|
49 |
DFILESEP=$FILESEP |
|
50 |
TMP_FILE=${TESTCLASSES}${FILESEP}${TESTCLASS}.sed.tmpfile |
|
51 |
||
52 |
cat <<EOF > ${TMP_FILE} |
|
53 |
s^@TEST-SRC@/^${TESTCLASSES}${DFILESEP}^g |
|
54 |
EOF |
|
55 |
;; |
|
4659
3ef31fe2879b
6911131: Test does not work with CYGWIN: sun/management/jmxremote/bootstrap/RmiSslNoKeyStoreTest.sh
ohair
parents:
2
diff
changeset
|
56 |
Windows_95 | Windows_98 | Windows_NT | Windows_ME | CYGWIN*) |
2 | 57 |
PATHSEP=";" |
58 |
FILESEP="\\" |
|
59 |
DFILESEP=$FILESEP$FILESEP |
|
60 |
TMP_FILE=${TESTCLASSES}${FILESEP}${TESTCLASS}.sed.tmpfile |
|
61 |
||
62 |
cat <<EOF > ${TMP_FILE}0 |
|
63 |
s^@TEST-SRC@/^${TESTCLASSES}${DFILESEP}^g |
|
64 |
EOF |
|
65 |
# Need to put double backslash in the .properties files |
|
66 |
cat ${TMP_FILE}0 | sed -e 's^\\\\^ZZZZ^g' | \ |
|
67 |
sed -e 's^\\^ZZZZ^g' | \ |
|
68 |
sed -e 's^ZZZZ^\\\\\\\\^g' > ${TMP_FILE} |
|
69 |
||
70 |
if [ "$OS" = "Windows_NT" ]; then |
|
12047
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
11988
diff
changeset
|
71 |
USER=`id -u -n` |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
11988
diff
changeset
|
72 |
CACLS="$SystemRoot/system32/cacls.exe" |
50861
2b7d0e9405cf
8192953: sun/management/jmxremote/bootstrap/*.sh tests fail with error : revokeall.exe: Permission denied
hb
parents:
47216
diff
changeset
|
73 |
TEST_SRC=`cygpath ${TESTSRC}` |
2b7d0e9405cf
8192953: sun/management/jmxremote/bootstrap/*.sh tests fail with error : revokeall.exe: Permission denied
hb
parents:
47216
diff
changeset
|
74 |
REVOKEALL="$TEST_SRC/../../windows/revokeall.exe" |
12047
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
11988
diff
changeset
|
75 |
if [ ! -f "$REVOKEALL" ] ; then |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
11988
diff
changeset
|
76 |
echo "$REVOKEALL missing" |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
11988
diff
changeset
|
77 |
exit 1 |
2 | 78 |
fi |
50861
2b7d0e9405cf
8192953: sun/management/jmxremote/bootstrap/*.sh tests fail with error : revokeall.exe: Permission denied
hb
parents:
47216
diff
changeset
|
79 |
chmod ug+x $REVOKEALL |
2 | 80 |
fi |
81 |
;; |
|
82 |
*) |
|
50861
2b7d0e9405cf
8192953: sun/management/jmxremote/bootstrap/*.sh tests fail with error : revokeall.exe: Permission denied
hb
parents:
47216
diff
changeset
|
83 |
echo "Unrecognized system! $OS" |
2 | 84 |
exit 1 |
85 |
;; |
|
86 |
esac |
|
87 |
||
12047
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
11988
diff
changeset
|
88 |
generatePropertyPasswordFiles() |
2 | 89 |
{ |
90 |
for f in $@ |
|
91 |
do |
|
92 |
echo processing $f |
|
12047
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
11988
diff
changeset
|
93 |
suffix=`basename $f .in` |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
11988
diff
changeset
|
94 |
f2="${TESTCLASSES}${FILESEP}${suffix}" |
2 | 95 |
|
12047
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
11988
diff
changeset
|
96 |
if [ -f "$f2" ] ; then |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
11988
diff
changeset
|
97 |
rm -f $f2 || echo WARNING: $f2 already exits - unable to remove old copy |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
11988
diff
changeset
|
98 |
fi |
2 | 99 |
|
12047
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
11988
diff
changeset
|
100 |
echo creating $f2 |
2 | 101 |
sed -f $TMP_FILE $f > $f2 |
102 |
||
12047
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
11988
diff
changeset
|
103 |
if [ "$OS" = "Windows_NT" ]; then |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
11988
diff
changeset
|
104 |
chown $USER $f2 |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
11988
diff
changeset
|
105 |
# Grant this user full access |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
11988
diff
changeset
|
106 |
echo Y|$CACLS $f2 \/E \/G $USER:F |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
11988
diff
changeset
|
107 |
# Revoke everyone else |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
11988
diff
changeset
|
108 |
$REVOKEALL $f2 |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
11988
diff
changeset
|
109 |
# Display ACLs |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
11988
diff
changeset
|
110 |
$CACLS $f2 |
2 | 111 |
else |
12047
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
11988
diff
changeset
|
112 |
chmod 600 $f2 |
2 | 113 |
fi |
114 |
done |
|
115 |
} |
|
116 |
||
12047
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
11988
diff
changeset
|
117 |
restoreFilePermissions() |
2 | 118 |
{ |
119 |
for f in $@ |
|
120 |
do |
|
12047
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
11988
diff
changeset
|
121 |
suffix=`basename $f .in` |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
11988
diff
changeset
|
122 |
f2="${TESTCLASSES}${FILESEP}${suffix}" |
2 | 123 |
|
12047
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
11988
diff
changeset
|
124 |
if [ "$OS" = "Windows_NT" ]; then |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
11988
diff
changeset
|
125 |
# Grant everyone full control |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
11988
diff
changeset
|
126 |
$CACLS $f2 \/E \/G Everyone:F |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
11988
diff
changeset
|
127 |
else |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
11988
diff
changeset
|
128 |
chmod 777 $f2 |
2 | 129 |
fi |
130 |
||
131 |
done |
|
132 |
} |
|
133 |