-
Notifications
You must be signed in to change notification settings - Fork 0
/
.envrc
69 lines (63 loc) · 1.66 KB
/
.envrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
trap "touch .javaTrustStore; exit" SIGINT SIGTERM
FEDORA_TRUST_STORE="/etc/pki/ca-trust/extracted/java/cacerts"
{ DEFAULT_TRUST_STORE=$(readlink -e $(dirname $(readlink -e $(which keytool)))/../lib/security/cacerts) ; } >/dev/null 2>&1 || :
function enterTrustStorePath() {
echo "Enter the path to the Java trust store to be used"
read TRUST_STORE
}
if [ ! -e .javaTrustStore ]
then
echo "Do you want to use a trust store of a local Java installation?"
echo "(If you are behind a corporate firewall, chances are you want to say 'yes')"
select USE_LOCAL in "Yes" "No"
do
case $USE_LOCAL in
Yes)
if [ -e "$FEDORA_TRUST_STORE" ]
then
TRUST_STORE="$FEDORA_TRUST_STORE"
else
if [ -e "$DEFAULT_TRUST_STORE" ]
then
TRUST_STORE="$DEFAULT_TRUST_STORE"
else
TRUST_STORE=""
fi
fi
if [ ! -z "$TRUST_STORE" ]
then
echo "I tried to guess your Java trust store location. Does this look right?"
echo " $TRUST_STORE"
select USE_DEFAULT in "Yes" "No"
do
case $USE_DEFAULT in
No)
enterTrustStorePath
break
;;
Yes)
break
;;
esac
done
else
enterTrustStorePath
fi
if [ ! -z "$TRUST_STORE" ]
then
echo "export _JAVA_OPTIONS=\"-Djavax.net.ssl.trustStore=$TRUST_STORE \$_JAVA_OPTIONS\"" > .javaTrustStore
fi
break
;;
No)
break
;;
esac
done
touch .javaTrustStore
echo "Saved to file '.javaTrustStore'. Please DO NOT put this file under version control."
echo "Should you change your mind, simply delete that file, and say 'direnv reload' for a do-over."
fi
source .javaTrustStore
use_nix