Skip to content

Commit 6b83070

Browse files
authored
Merge pull request #46 from chaen/master_exportX509
diracosrc: check if X509 directories are not empty
2 parents 3d2a953 + a1cb44f commit 6b83070

File tree

1 file changed

+36
-3
lines changed

1 file changed

+36
-3
lines changed

create_diracosrc.sh

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,42 @@
1616
echo 'export DAVIX_USE_LIBCURL=1'
1717
echo ''
1818
echo '# Set up the X509 variables'
19-
echo "export X509_CERT_DIR=\${X509_CERT_DIR-'$PREFIX/etc/grid-security/certificates'}"
20-
echo "export X509_VOMS_DIR=\${X509_VOMS_DIR-'$PREFIX/etc/grid-security/vomsdir'}"
21-
echo "export X509_VOMSES=\${X509_VOMSES-'$PREFIX/etc/grid-security/vomses'}"
19+
echo ''
20+
echo '# Function check if folder exist and contains files'
21+
echo 'function checkDir () {'
22+
echo ' if [ -z "${1}" ]; then'
23+
echo ' return 1'
24+
echo ' fi'
25+
echo ' if [ -n "$(ls -A "${1}" 2>/dev/null)" ]; then'
26+
echo ' return 0'
27+
echo ' fi'
28+
echo ' return 1'
29+
echo '}'
30+
echo ''
31+
echo '# Add sanity check for X509_CERT_DIR variable'
32+
echo 'if ! checkDir "$X509_CERT_DIR" ; then'
33+
echo ' export X509_CERT_DIR="/etc/grid-security/certificates"'
34+
echo ' if ! checkDir "$X509_CERT_DIR" ; then'
35+
echo " export X509_CERT_DIR='${PREFIX}/etc/grid-security/certificates'"
36+
echo ' fi'
37+
echo 'fi'
38+
echo ''
39+
echo '# Add sanity check for X509_VOMS_DIR variable'
40+
echo 'if ! checkDir "$X509_VOMS_DIR" ; then'
41+
echo ' export X509_VOMS_DIR="/etc/grid-security/vomsdir"'
42+
echo ' if ! checkDir "$X509_VOMS_DIR" ; then'
43+
echo " export X509_VOMS_DIR='${PREFIX}/etc/grid-security/vomsdir'"
44+
echo ' fi'
45+
echo 'fi'
46+
echo ''
47+
echo '# Add sanity check for X509_VOMSES variable'
48+
echo 'if ! checkDir "$X509_VOMSES" ; then'
49+
echo ' export X509_VOMSES="/etc/vomses"'
50+
echo ' if ! checkDir "$X509_VOMSES" ; then'
51+
echo " export X509_VOMSES='${PREFIX}/etc/grid-security/vomses'"
52+
echo ' fi'
53+
echo 'fi'
54+
echo ''
2255
} > "$PREFIX/diracosrc"
2356

2457
# Workaround for the incorrect etc directory in v7r2

0 commit comments

Comments
 (0)