blob: 600ae5170b14babf3dc3c9347d4336191b3f7fdb (
plain)
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
|
#!/bin/bash
user_vm="${HOME}/.gentoo/java-config-2/current-user-vm"
system_vm="/etc/java-config-2/current-system-vm"
# Try GENTOO_VM
if [[ -n ${GENTOO_VM} ]]; then
vmpath="/usr/lib/jvm/${GENTOO_VM}/"
# Then user VM
elif [[ -h ${user_vm} ]]; then
vmpath=$(readlink ${user_vm})
# And fall back to the system VM
else
vmpath=$(readlink ${system_vm})
fi
tool=$(basename $0)
bin=${vmpath}/bin/${tool}
jrebin=${vmpath}/jre/bin/${tool}
vm_handle=$(basename ${vmpath})
if [[ -x ${bin} ]]; then
exec ${bin} "${@}"
elif [[ -x ${jrebin} ]]; then
exec ${jrebin} "${@}"
else
if [[ ! -d ${vmpath} ]]; then
echo "Home for VM '${vm_handle}' does not exist: ${vmpath}" >&2
if [[ -n ${GENTOO_VM} ]]; then
echo "Invalid value for GENTOO_VM: ${GENTOO_VM}"
elif [[ -h ${user_vm} ]]; then
echo "Invalid User VM: ${vm_handle}" >&2
else
echo "Invalid System VM: ${vm_handle}" >&2
fi
else
echo "Tried to execute ${bin} and ${jrebin}, but neither exist." >&2
echo "Perhaps there is something wrong with the install of ${vm_handle}?" >&2
fi
exit 1
fi
|