-
Notifications
You must be signed in to change notification settings - Fork 20
/
makeJar
61 lines (56 loc) · 1.71 KB
/
makeJar
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
#!/bin/sh
set -e
################################################################################
#
# Author: Bob Fisch
#
# Description: create jar to be used in conjunction with additional jars
#
################################################################################
#
# Revision List
#
# Author Date Description
# ------ ---- -----------
# Bob Fisch 2008-10-04 First Issue
# Bob Fisch & Philipp Hübner 2009-07-08 Scripting ameliorations
# Simon Sobisch 2017-03-06 Check for jar
# Simon Sobisch 2020-01-20 added handling for nostart argument,
# default to detached start
#
################################################################################
# check for jar in PATH
jar 2>/dev/null 1>&2 || \
(rc=$? && if test $rc -gt 1; then
(echo 'jar not found in $PATH' && exit $rc)
fi)
# delete the old archive (if present)
[ -f structorizer.jar ] && rm structorizer.jar
start_compiled="x"
case "$1" in
nostart | no-start | no_start)
start_compiled=""
shift
;;
start | no-sync | no_sync | detached)
start_compiled="x"
shift
;;
start-sync | sync | start_sync )
start_compiled="s"
shift
;;
esac
# create a new archive
echo "Create archive..."
jar cmf structorizer.manifest structorizer.jar -C bin/ .
echo "Done"
if test -n "$start_compiled"; then
# execute the archive
echo; echo "Running Structorizer from jar"
if test "$start_compiled" = "s"; then
java -jar structorizer.jar
else
java -jar structorizer.jar &
fi
fi # start block end