This repository has been archived by the owner on Sep 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
/
Makefile.am
276 lines (272 loc) · 11.3 KB
/
Makefile.am
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
ACLOCAL_AMFLAGS=-I m4
abs_resin_home=@resin_home@
resin_home=$(DESTDIR)@resin_home@
resin_conf=$(DESTDIR)@resin_conf@
resin_root=$(DESTDIR)@resin_root@
resin_log=$(DESTDIR)@resin_log@
resin_init_d=$(DESTDIR)@resin_init_d@
initd_dir=$(DESTDIR)@initd_dir@
usr_share=$(DESTDIR)@usr_share@
abs_usr_share=@usr_share@
resin_version=@resin_version@
resin_pro=@resin_pro@
build_dir=@build_dir@
setuid_user=@setuid_user@
setuid_group=@setuid_group@
setuid_set=@setuid_set@
user_add=@user_add@
group_add=@group_add@
LIBEXEC=@LIBEXEC@
skip_check_resin_sh=@SKIP_CHECK_RESIN_SH@
root_subdirs_preserve=project-jars webapps webapp-jars endorsed resin-inf app-inf
root_subdirs_overwrite=doc
home_subdirs=@LIBEXEC@ bin lib
conf_files=resin.xml resin.properties app-default.xml cluster-default.xml health.xml
conf_subdirs=keys licenses
all :
@ (cd modules/c/src; $(MAKE))
@ if test $(resin_pro) != "." -a -r $(resin_pro)/modules/c/src/Makefile; then \
cd $(resin_pro)/modules/c/src; $(MAKE); \
fi
rpm-dist :
@ cp conf/resin.properties conf/resin.properties.orig
@ awk '/setuid_user/ { print "setuid_user : $(setuid_user)"; next; } \
/setuid_group/ { print "setuid_group : $(setuid_group)"; next; } \
{ print $0; }' \
conf/resin.properties.orig > conf/resin.properties
install :
@ if test "$(setuid_set)" = "true"; then \
cp conf/resin.properties conf/resin.properties.orig; \
awk '/setuid_user/ { print "setuid_user : $(setuid_user)"; next; } \
/setuid_group/ { print "setuid_group : $(setuid_group)"; next; } \
{ print $0; }' \
conf/resin.properties.orig > conf/resin.properties; \
fi
@ if test "$(resin_root)" != "$(build_dir)"; then \
echo "Installing Resin root $(resin_root)."; \
if test ! -e "$(resin_root)"; then \
mkdir -p $(resin_root); \
if test $$? != "0"; then \
echo "ABORT: Resin root install failed. Ensure $(resin_root) can be created by $$USER, or run 'make install' as root."; \
exit 42; \
fi; \
else \
if test ! -w "$(resin_root)"; then \
echo "ABORT: Resin root install failed. Ensure $(resin_root) is writable by $$USER, or run 'make install' as root."; \
exit 42; \
fi; \
fi; \
for subdir in $(root_subdirs_preserve); do \
if test -e "$(resin_root)/$$subdir"; then \
echo "Preserving existing Resin root subdir $(resin_root)/$$subdir.";\
else \
echo "Installing Resin root subdir $(resin_root)/$$subdir."; \
mkdir -p $(resin_root)/$$subdir; \
if test $$? != "0"; then \
echo "ABORT: Resin root subdir creation failed. Ensure $(resin_root)/$$subdir can be created by $$USER, or run 'make install' as root."; \
exit 42; \
elif cp -r $$subdir/* $(resin_root)/$$subdir; then \
echo "updated $(resin_root)/$$subdir"; \
else \
echo "skipped $$subdir"; \
fi; \
fi; \
done; \
for subdir in $(root_subdirs_overwrite); do \
if test -e "$(resin_root)/$$subdir"; then \
echo "Updating existing Resin root subdir $(resin_root)/$$subdir.";\
else \
echo "Installing Resin root subdir $(resin_root)/$$subdir."; \
mkdir -p $(resin_root)/$$subdir; \
if test $$? != "0"; then \
echo "ABORT: Resin root subdir creation failed. Ensure $(resin_root)/$$subdir can be created by $$USER, or run 'make install' as root."; \
exit 42; \
fi; \
fi; \
cp -r $$subdir/* $(resin_root)/$$subdir; \
done; \
fi
@ if test "$(resin_home)" != "$(build_dir)"; then \
echo "Installing Resin home $(resin_home)."; \
if test ! -e "$(resin_home)"; then \
mkdir -p $(resin_home); \
if test $$? != "0"; then \
echo "ABORT: Resin home install failed. Ensure $(resin_home) can be created by $$USER, or run 'make install' as root."; \
exit 42; \
fi; \
else \
if test ! -w "$(resin_home)"; then \
echo "ABORT: Resin home install failed. Ensure $(resin_home) is writable by $$USER, or run 'make install' as root."; \
exit 42; \
fi; \
fi; \
for subdir in $(home_subdirs); do \
if test -e "$(resin_home)/$$subdir"; then \
echo "Updating existing Resin home subdir $(resin_home)/$$subdir.";\
else \
echo "Installing Resin home subdir $(resin_home)/$$subdir."; \
mkdir -p $(resin_home)/$$subdir; \
if test $$? != "0"; then \
echo "ABORT: Resin home subdir creation failed. Ensure $(resin_home)/$$subdir can be created by $$USER, or run 'make install' as root."; \
exit 42; \
fi; \
fi; \
if cp -r $$subdir/* $(resin_home)/$$subdir; then \
echo "updated $(resin_home)/$$subdir"; \
else \
echo "skipped $$subdir"; \
fi; \
done; \
fi
@ if test -e "$(resin_log)"; then \
echo "Preserving existing Resin log $(resin_log)."; \
else \
echo "Installing Resin log $(resin_log)."; \
mkdir -p $(resin_log); \
if test $$? != "0"; then \
echo "ABORT: Resin log install failed. Ensure $(resin_log) can be created by $$USER, or run 'make install' as root."; \
exit 42; \
fi; \
fi
@ if test -n "$(abs_usr_share)"; then \
echo "Installing Resin home symlink $(abs_usr_share)/resin."; \
if test ! -w "$(usr_share)"; then \
echo "WARNING: Resin home symlink install failed. Ensure $(usr_share) is writable by $$USER, or run 'make install' as root."; \
else \
ln -sf $(abs_resin_home) $(usr_share)/resin; \
if test $$? != "0"; then \
echo "WARNING: Resin home symlink creation failed. Ensure $(usr_share) is writable by $$USER, or run 'make install' as root."; \
fi; \
fi; \
echo "Installing resinctl symlink $(DESTDIR)/usr/bin/resinctl."; \
mkdir -p $(DESTDIR)/usr/bin; \
ln -sf "$(abs_usr_share)/resin/bin/resinctl" "$(DESTDIR)/usr/bin/resinctl"; \
if test $$? != "0"; then \
echo "WARNING: resinctl symlink creation failed. Ensure $(DESTDIR)/usr/bin is writable by $$USER, or run 'make install' as root."; \
fi; \
fi
@ if test -e "$(resin_home)/bin/resinctl"; then \
echo "Setting $(resin_home)/bin/resinctl executable."; \
chmod +x $(resin_home)/bin/resinctl; \
if test $$? != "0"; then \
echo "WARNING: failed to set resinctl executable. Ensure $(resin_home)/bin/resinctl is writable by $$USER, or run 'make install' as root."; \
fi; \
else \
echo "ABORT: $(resin_home)/bin/resinctl does not exist. Resin home install may have failed."; \
exit 42; \
fi
@ if test -e "$(resin_home)/bin/resin.sh"; then \
echo "Setting $(resin_home)/bin/resin.sh executable."; \
chmod +x $(resin_home)/bin/resin.sh; \
if test $$? != "0"; then \
echo "WARNING: failed to set resin.sh executable. Ensure $(resin_home)/bin/resin.sh is writable by $$USER, or run 'make install' as root."; \
fi; \
elif test "$(skip_check_resin_sh)" = "false"; then \
echo "ABORT: $(resin_home)/bin/resin.sh does not exist. Resin home install may have failed."; \
exit 42; \
fi
@ if test "$(resin_conf)" != "$(build_dir)/conf"; then \
echo "Installing Resin conf $(resin_conf)."; \
if test ! -e "$(resin_conf)"; then \
mkdir -p $(resin_conf); \
if test $$? != "0"; then \
echo "ABORT: Resin conf install failed. Ensure $(resin_conf) can be created by $$USER, or run 'make install' as root."; \
exit 42; \
fi; \
fi; \
if test ! -w "$(resin_conf)"; then \
echo "ABORT: Resin conf install failed. Ensure $(resin_conf) is writable by $$USER, or run 'make install' as root."; \
exit 42; \
fi; \
for subdir in $(conf_subdirs); do \
if test -e "$(resin_conf)/$$subdir"; then \
echo "Preserving existing Resin conf subdir $(resin_conf)/$$subdir."; \
else \
echo "Installing Resin conf subdir $(resin_conf)/$$subdir."; \
mkdir -p $(resin_conf)/$$subdir; \
if test $$? != "0"; then \
echo "ABORT: Resin conf subdir creation failed. Ensure $(resin_conf)/$$subdir can be created by $$USER, or run 'make install' as root."; \
exit 42; \
elif cp -r $$subdir/* $(resin_conf)/$$subdir; then \
echo "updated $(resin_conf)/$$subdir"; \
else \
echo "skipped $$subdir"; \
fi; \
fi; \
done; \
for file in $(conf_files); do \
if test -f "$(resin_conf)/$$file"; then \
echo "Preserving existing Resin conf file $(resin_conf)/$$file.";\
else \
echo "Installing Resin conf file $(resin_conf)/$$file."; \
cp conf/$$file $(resin_conf)/$$file; \
fi; \
done; \
fi
@ if test -n "$(resin_init_d)"; then \
if test -f "$(resin_init_d)"; then \
echo "Preserving existing Resin init.d script $(resin_init_d) in $(initd_dir)."; \
else \
echo "Installing Resin init.d script $(resin_init_d)."; \
mkdir -p $(initd_dir); \
if test ! -w "$(initd_dir)"; then \
echo "WARNING: Resin init.d script install failed. Ensure $(init_dir) is writable by $$USER, or run 'make install' as root."; \
else \
cp init.d/resin $(resin_init_d); \
chmod +x "$(resin_init_d)"; \
if test $$? != "0"; then \
echo "WARNING: failed to set Resin init.d executable. Ensure $(resin_init_d) is writable by $$USER, or run 'make install' as root."; \
fi; \
fi; \
fi; \
fi
@ (cd modules/c/src; $(MAKE) install)
@ if test $(resin_pro) != "." -a -r $(resin_pro)/modules/c/src/Makefile; then \
(cd $(resin_pro)/modules/c/src; $(MAKE) install) \
fi
@ if test "$(setuid_set)" = "true"; then \
if test -n "$(group_add)"; then \
echo "Creating setuid group $(setuid_group)."; \
egrep '$$$(setuid_group):' /etc/group 1>/dev/null 2>/dev/null; \
if test $$? = "0"; then \
echo "setuid group $(setuid_group) already exists."; \
else \
groupadd $(setuid_group); \
if test $$? != "0"; then \
echo "WARNING: failed to create the $(setuid_group) group. The group may already exist, or run 'make install' as root."; \
fi; \
fi; \
fi; \
if test -n "$(user_add)"; then \
echo "Creating setuid user $(setuid_user)."; \
egrep '$$$(setuid_user):' /etc/passwd 1>/dev/null 2>/dev/null; \
if test $$? = "0"; then \
echo "setuid user $(setuid_user) already exists."; \
else \
useradd -d /nonexistent -s /bin/false -g $(setuid_group) $(setuid_user); \
if test $$? != "0"; then \
echo "WARNING: failed to create the $(setuid_user) user. The user may already exist, or run 'make install' as root."; \
fi; \
fi; \
fi; \
if test -n "$(user_add)"; then \
echo "Changing the owner of Resin root $(resin_root) to $(setuid_user):$(setuid_group)."; \
chown -R $(setuid_user):$(setuid_group) $(resin_root); \
if test $$? != "0"; then \
echo "WARNING: failed change owner of Resin root to $(setuid_user). Ensure $(resin_root) is writable by $$USER, or run 'make install' as root."; \
fi; \
fi; \
if test -n "$(group_add)"; then \
echo "Changing the owner of Resin log $(resin_log) to $(setuid_user):$(setuid_group)."; \
chown -R $(setuid_user):$(setuid_group) $(resin_log); \
if test $$? != "0"; then \
echo "WARNING: failed change owner of Resin log to $(setuid_user). Ensure $(resin_log) is writable by $$USER, or run 'make install' as root."; \
fi; \
fi; \
fi
clean :
(cd modules/c/src; $(MAKE) clean)
if test $(resin_pro) != "." -a -r $(resin_pro)/modules/c/src/Makefile; then \
cd $(resin_pro)/modules/c/src; $(MAKE) clean; \
fi
-rm -r $(LIBEXEC)