blob: fb7a15dd8bfd88f2cb76124e19a385aaadd655c6 (
plain) (
blame)
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
#!/bin/sh
#
# Under a BSDL license. Copyright by Mario S F Ferreira <lioux@FreeBSD.org>
# $FreeBSD$
export JAVA_VERSION
PREFIX="%%PREFIX%%"
# data
DATADIR="%%DATADIR%%"
DATA_FILES="%%DATA_FILES%%"
# java
JAVA_VERSION="%%JAVA_VERSION%%"
JAVAVM="%%JAVAVM%%"
JAR_DIR="%%JAR_DIR%%"
JAR_FILES="%%JAR_FILES%%"
JAR_FILE="%%JAR_FILE%%"
# home
HOME_DIR=${HOME}/.irpf
prepare_home_dir () {
# create home dir staging area
if [ ! -d ${HOME_DIR}/aplicacao/dados ]
then
mkdir -p ${HOME_DIR}/aplicacao/dados
fi
# create the lib dir
if [ ! -d ${HOME_DIR}/lib ]
then
mkdir -p ${HOME_DIR}/lib 2>/dev/null
fi
# link the data files
for data in ${DATA_FILES}
do
rm -f ${HOME_DIR}/${data} 2>/dev/null
cp -f ${DATADIR}/${data} ${HOME_DIR}/${data} 2>/dev/null
done
# link the jar file
rm -f ${HOME_DIR}/${JAR_FILE} 2>/dev/null
cp -f ${PREFIX}/${JAR_DIR}/${JAR_FILE} ${HOME_DIR}/${JAR_FILE} 2>/dev/null
# link the jar files
for jar in ${JAR_FILES}
do
rm -f ${HOME_DIR}/lib/${jar} 2>/dev/null
cp -f ${PREFIX}/${JAR_DIR}/${jar} ${HOME_DIR}/lib/${jar} 2>/dev/null
done
}
start_irpf () {
cd ${HOME_DIR} &&
${JAVAVM} -jar ./${JAR_FILE} "${@}"
}
clean_home_dir () {
# remove the data files
for data in ${DATA_FILES}
do
if [ -f ${HOME_DIR}/${data} ]
then
rm -f ${HOME_DIR}/${data} 2>/dev/null
fi
done
# remove the jar file
rm -f ${HOME_DIR}/${JAR_FILE} 2>/dev/null
# remove the jar files
for jar in ${JAR_FILES}
do
if [ -f ${HOME_DIR}/lib/${jar} ]
then
rm -f ${HOME_DIR}/lib/${jar} 2>/dev/null
fi
done
# remove the lib dir
if [ -d ${HOME_DIR}/lib ]
then
rmdir ${HOME_DIR}/lib 2>/dev/null
fi
}
# always verify that home dir staging area is pristine
prepare_home_dir
start_irpf
# remove jars
clean_home_dir
|