forked from WebThingsIO/gateway-rpm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebthings-gateway.spec
82 lines (70 loc) · 2.34 KB
/
webthings-gateway.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
Name: webthings-gateway
Version: 0.12.0
Release: 1%{?dist}
Summary: WebThings Gateway by Mozilla
License: MPL-2.0
URL: https://iot.mozilla.org/gateway/
BuildRequires: autoconf automake nodejs npm git python python3 python3-pip python3-setuptools libffi-devel python3-devel gcc gcc-c++ systemd make zlib-devel libpng-devel
Requires: {{nodejs}} {{python3}} python3-pip libffi python2-six
Requires(pre): shadow-utils
Source0: %{name}_0.12.0.orig.tar.gz
Source1: %{name}.service
Patch0: fix-config.patch
Patch1: add-launcher.patch
Patch2: add-env.patch
%description
Web of Things gateway, created by Mozilla, which can bridge existing
Internet of Things (IoT) devices to the web.
%define debug_package %{nil}
%prep
%autosetup -n %{name} -p1
%build
NPM_CACHE=$(mktemp -dq)
CPPFLAGS="-DPNG_ARM_NEON_OPT=0" npm --cache "${NPM_CACHE}" ci
./node_modules/.bin/webpack
npm --cache "${NPM_CACHE}" prune --production
rm -rf "${NPM_CACHE}"
# clean up node modules to prevent broken and unnecessary dependencies
rm -rf ./node_modules/performance-now/test/
chmod a+x %{name}
mkdir python
python3 -m pip install \
--install-option="--prefix=" \
--no-binary=:all: \
-t ./python \
./gateway-addon-python
%install
rm -rf %{buildroot}
mkdir -p %{buildroot}/etc/profile.d
mkdir -p %{buildroot}/opt/%{name}
mkdir -p %{buildroot}/opt/%{name}/config
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_unitdir}
cp -r build %{buildroot}/opt/%{name}
cp config/default.js %{buildroot}/opt/%{name}/config
cp -r node_modules %{buildroot}/opt/%{name}
cp package-lock.json %{buildroot}/opt/%{name}
cp package.json %{buildroot}/opt/%{name}
cp -r python %{buildroot}/opt/%{name}
cp -r src %{buildroot}/opt/%{name}
cp -r static %{buildroot}/opt/%{name}
cp %{name} %{buildroot}%{_bindir}
cp %{SOURCE1} %{buildroot}%{_unitdir}
cp %{name}.sh %{buildroot}/etc/profile.d
%pre
getent group webthings >/dev/null || groupadd -f -r webthings
if ! getent passwd webthings > /dev/null ; then
useradd -r -l -g webthings -d /var/run/%{name} -s /sbin/nologin -c "Mozilla WebThings Gateway" webthings
fi
%files
%license LICENSE
%dir /opt/%{name}/
/opt/%{name}/*
%{_bindir}/%{name}
%{_unitdir}/%{name}.service
/etc/profile.d/%{name}.sh
%changelog
* Tue Feb 18 2020 Michael Stegeman <[email protected]>
- Update to 0.12.
* Mon Dec 16 2019 Michael Stegeman <[email protected]>
- First webthings-gateway package.