-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathleek-duck.spec
59 lines (45 loc) · 1.2 KB
/
leek-duck.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
Name: leek-duck
Version: 0.0.1
Release: 1%{?dist}
Summary: Simple web scraper that gets Pokemon go events and puts them into a mongodb server and
License: ISC
Source0: %{name}-%{version}.tar.gz
Requires: nodejs dos2unix
BuildArch: noarch
%description
LeekDuck scraper
%pre
useradd --system leek-duck
groupadd auto-services
usermod -a -G auto-services leek-duck
%prep
%setup -q
%build
find leek-duck.service -type f -exec dos2unix {} \;
%install
mkdir -p %{buildroot}/opt/auto/LeekDuck/node_modules/
mkdir -p %{buildroot}/etc/systemd/system/
cp -r * %{buildroot}/opt/auto/LeekDuck/
chmod -R -x+X %{buildroot}/opt/auto/LeekDuck/
cp leek-duck.service %{buildroot}/etc/systemd/system/
chmod -x %{buildroot}/etc/systemd/system/leek-duck.service
%files
%defattr(0664, leek-duck, auto-services)
/opt/auto/LeekDuck/
/etc/systemd/system/leek-duck.service
%post
systemctl daemon-reload
systemctl enable leek-duck
systemctl start leek-duck
npm install -g ts-node || :
%preun
systemctl stop leek-duck
systemctl disable leek-duck
%postun
userdel -r leek-duck
if [ "$1" = "0" ]; then
rm -rf /opt/auto/LeekDuck
rm -f /etc/systemd/system/leek-duck.service
fi
systemctl daemon-reload
userdel leek-duck