summarylogtreecommitdiffstats
path: root/lbe.sh
diff options
context:
space:
mode:
Diffstat (limited to 'lbe.sh')
-rwxr-xr-xlbe.sh45
1 files changed, 21 insertions, 24 deletions
diff --git a/lbe.sh b/lbe.sh
index b7be2664c746..336ddaf158e9 100755
--- a/lbe.sh
+++ b/lbe.sh
@@ -1,35 +1,32 @@
#!/bin/sh -e
-: ${XDG_CONFIG_HOME:=~/.config}
-
-appdir="/opt/lbe"
-
-if [ -d "$HOME/.lbe" ]; then
- confdir="$HOME/.lbe"
+if [ -d ~/.lbe ]; then
+ confdir=~/.lbe
else
- confdir="$XDG_CONFIG_HOME/lbe"
+ confdir=${XDG_CONFIG_HOME:-~/.config}/lbe
fi
+# LBE tries to find everything in the current working directory (it pretty much
+# expects the user to double-click lbe.jar in their ~/Downloads/lbe), so for a
+# system-wide /usr installation we must manually set up a config directory and
+# chdir() into it.
if [ ! -d "$confdir" ]; then
- mkdir -pm0700 "$confdir"
-
- cat > "$confdir/lbe.properties" <<-EOF
- base=$confdir/
- session.dir=$confdir/
- cacert.file=$confdir/lbecacerts
- EOF
-
- cp -a "$appdir/help/uofmichigan.cfg.sample" "$confdir/U of Michigan.cfg"
-
- cp -a "$appdir/templates" "$confdir/"
+ mkdir -p -m 0700 "$confdir"
+ cp -a /usr/share/lbe/skel/. "$confdir"/
fi
-
-if [ ! -t "$appdir/attributes.config" ]; then
- cp -a "$appdir/attributes.config" "$confdir/"
+if [ ! -e "$confdir"/help ]; then
+ ln -nsf /usr/share/doc/lbe/help "$confdir"/help
fi
+cd "$confdir"
-cd "$confdir" # FIXME: if we do this, we can ditch lbe.properties; any disadvantages?
+# Protect session configuration files.
+umask 077
-umask 077 # protect session files
+for jvm in /usr/lib/jvm/java-{11-{openjdk,jdk},8-{openjdk,jre}/jre}; do
+ if [ -d "$jvm" ]; then
+ exec "$jvm"/bin/java -jar /usr/lib/lbe/lbe.jar "$@"
+ fi
+done
-exec java -jar "$appdir/lbe.jar" "$@"
+echo "error: could not find a compatible JRE" >&2
+exit 1