summarylogtreecommitdiffstats
path: root/lbe.sh
diff options
context:
space:
mode:
authorMantas Mikul─Śnas2015-08-08 18:23:21 +0300
committerMantas Mikul─Śnas2015-08-08 18:23:21 +0300
commit674bea4081cadd0b960666bb9d70465cca5c60a0 (patch)
treea23c9b22eadeebc3be6d86fc843589c8a98c61ec /lbe.sh
downloadaur-674bea4081cadd0b960666bb9d70465cca5c60a0.tar.gz
initial import
Diffstat (limited to 'lbe.sh')
-rwxr-xr-xlbe.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/lbe.sh b/lbe.sh
new file mode 100755
index 00000000000..cb174ab9291
--- /dev/null
+++ b/lbe.sh
@@ -0,0 +1,33 @@
+#!/bin/sh -e
+
+: ${XDG_CONFIG_HOME:=~/.config}
+
+appdir="/opt/lbe"
+
+if [ -d "$HOME/.lbe" ]; then
+ confdir="$HOME/.lbe"
+else
+ confdir="$XDG_CONFIG_HOME/lbe"
+fi
+
+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/attributes.config" "$confdir/"
+
+ cp -a "$appdir/templates" "$confdir/"
+fi
+
+cd "$confdir" # FIXME: if we do this, we can ditch lbe.properties; any disadvantages?
+
+umask 077 # protect session files
+
+exec java -jar "$appdir/lbe.jar" "$@"