-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathpackage.sh
More file actions
144 lines (124 loc) · 2.35 KB
/
package.sh
File metadata and controls
144 lines (124 loc) · 2.35 KB
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#!/bin/bash
# build and package everything for Linux
# recommend running as : package.sh > build.log
# then search build.log for "error" or "fail"
ABORT=false
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
#script executed directly
EXIT=exit
else
#script sourced
EXIT=return
fi
function detectos {
if [ ! -f /etc/os-release ]; then
echo Unable to detect os
echo /etc/os-release not found!
ABORT=true
return
fi
. /etc/os-release
case $ID in
debian)
pkg=deb
PKG=DEB
OS=debian
#need to remove quotes from VERSION_ID
RELEASE=${VERSION_ID//\"/}
case $HOSTTYPE in
x86_64)
ARCH=amd64
;;
aarch64)
ARCH=arm64
;;
*)
echo Invalid HOSTTYPE!
ABORT=true
return
;;
esac
;;
fedora)
pkg=rpm
PKG=RPM
OS=fedora
RELEASE=$VERSION_ID
ARCH=$HOSTTYPE
;;
arch)
pkg=pac
PKG=PAC
OS=arch
RELEASE=latest
ARCH=$HOSTTYPE
;;
ubuntu)
#VERSION_CODENAME varies
echo Ubuntu not supported for packaging, please use Debian!
echo Debian repo can be used in Ubuntu.
ABORT=true
return
;;
*)
echo Unknown os detected!
echo ID=%ID
ABORT=true
return
;;
esac
}
function package {
#clean repo
echo cleaning repo/$OS/$RELEASE/$ARCH/
cd repo/$OS/$RELEASE/$ARCH
chmod +x clean.sh
./clean.sh
cd ../../../..
#force rebuild everything
find -name "*.class" | xargs rm 2>/dev/null
echo Packaging for : $OS/$RELEASE on $ARCH
echo Packaging for : $OS/$RELEASE on $ARCH 1>&2
#package javaforce
echo Packaging javaforce
echo Packaging javaforce 1>&2
ant $pkg
#package utils
echo Packaging jfutils
echo Packaging jfutils 1>&2
cd utils
ant $pkg
cd ..
#package projects
cd projects
chmod +x package.sh
./package.sh
cd ..
#package libs
cd lib
chmod +x package.sh
./package.sh
cd ..
echo Build Complete!
}
detectos
if [[ "$ABORT" == "true" ]]; then
$EXIT
fi
if [[ "$RELEASE" == "" ]]; then
echo OS version not detected!
$EXIT
fi
if [ ! -f javaforce.jar ]; then
echo Please build javaforce first!
$EXIT
fi
if [ ! -f ~/bin/linux64.bin ]; then
echo Please build native first!
$EXIT
fi
#install repo
if [ ! -f repo/readme.txt ]; then
ant repo
fi
package