forked from GrowControl/GrowControl-mirror
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GrowControl.spec
153 lines (112 loc) · 3.39 KB
/
GrowControl.spec
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
145
146
147
148
149
150
151
152
Name : GrowControl
Summary : Automation software for home and garden, or hobby projects
Version : 3.5.%{BUILD_NUMBER}
Release : 1
BuildArch : noarch
Prefix : %{_javadir}/gc
Requires : java >= 1.8
Provides : gcServer = %{version}
Provides : gcClient = %{version}
%define _rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm
%define serverjar "%{SOURCE_ROOT}/server/target/gcServer-%{version}.jar"
%define clientjar "%{SOURCE_ROOT}/client/target/gcClient-%{version}.jar"
Group : Development/Electronic Lab
License : (c) PoiXson
Packager : PoiXson <[email protected]>
URL : http://growcontrol.com/
%description
GrowControl is a computer automation system for your home and garden, or hobby projects. It's expandable with plugins, fully multi-threaded makes it fast, and your ideas make it powerful.
# avoid jar repack
%define __jar_repack %{nil}
# avoid centos 5/6 extras processes on contents (especially brp-java-repack-jars)
%define __os_install_post %{nil}
# disable debug info
# % define debug_package %{nil}
### Prep ###
%prep
echo
echo "Prep.."
# check for existing workspace
if [ -d "%{SOURCE_ROOT}/server/target/" ]; then
echo "Found source workspace: %{SOURCE_ROOT}/server/target/"
else
echo "Source workspace not found: %{SOURCE_ROOT}/server/target/"
exit 1
fi
if [ -d "%{SOURCE_ROOT}/client/target/" ]; then
echo "Found source workspace: %{SOURCE_ROOT}/client/target/"
else
echo "Source workspace not found: %{SOURCE_ROOT}/client/target/"
exit 1
fi
# check for pre-built jar files
if [ ! -f "%{serverjar}" ]; then
echo "%{serverjar} file is missing"
exit 1
fi
if [ ! -f "%{clientjar}" ]; then
echo "%{clientjar} file is missing"
exit 1
fi
echo
echo
### Build ###
%build
### Install ###
%install
echo
echo "Install.."
# delete existing rpm
if [[ -f "%{_rpmdir}/%{name}-%{version}-%{release}.noarch.rpm" ]]; then
%{__rm} -f "%{_rpmdir}/%{name}-%{version}-%{release}.noarch.rpm" \
|| exit 1
fi
# create directories
%{__install} -d -m 0755 \
"${RPM_BUILD_ROOT}%{prefix}" \
"${RPM_BUILD_ROOT}%{_sysconfdir}/gc" \
"${RPM_BUILD_ROOT}/var/log/gc" \
|| exit 1
# copy jar files
%{__install} -m 0555 \
"%{serverjar}" \
"${RPM_BUILD_ROOT}%{prefix}/gcServer-%{version}_%{release}.jar" \
|| exit 1
%{__install} -m 0555 \
"%{clientjar}" \
"${RPM_BUILD_ROOT}%{prefix}/gcClient-%{version}_%{release}.jar" \
|| exit 1
%{__install} -d -m 0755 \
"${RPM_BUILD_ROOT}/usr/share/applications/" \
|| exit 1
%{__install} -m 0644 \
"%{SOURCE_ROOT}/growcontrol.desktop" \
"${RPM_BUILD_ROOT}/usr/share/applications/growcontrol.desktop" \
|| exit 1
# default config file
touch "${RPM_BUILD_ROOT}%{_sysconfdir}/gc/config.yml"
# create empty log files
touch "${RPM_BUILD_ROOT}/var/log/gc/server.log"
touch "${RPM_BUILD_ROOT}/var/log/gc/client.log"
%check
%clean
# %{__rm} -rf ${RPM_BUILD_ROOT} || exit 1
### Files ###
%files
%defattr(-,root,root,-)
%{prefix}/gcServer-%{version}_%{release}.jar
%{prefix}/gcClient-%{version}_%{release}.jar
/usr/share/applications/growcontrol.desktop
%config(noreplace) %{_sysconfdir}/gc/config.yml
%ghost
/var/log/gc/server.log
/var/log/gc/client.log
### Install ###
# %pre -n gcServer
# echo "Pre-install server.."
# %pre -n gcClient
# echo "Pre-install client.."
### Uninstall ###
# %preun -n gcServer
# echo "Pre-uninstall.."
# service -n gcserver stop