-
Notifications
You must be signed in to change notification settings - Fork 0
/
SPECFILE
69 lines (51 loc) · 1.82 KB
/
SPECFILE
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
%define name badgr-ui
%define app_user web
%define install_dir /opt/site
%define base_dir %{_builddir}/%{version}
Summary: Badgr UI
Name: %{name}
Version: %{version}
Release: %{release}
Source0: ./%{name}.tar.gz
License: Proprietary
Group: Development/Libraries
Prefix: %{_prefix}
BuildArch: x86_64
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
Vendor: Concentric Sky, Inc.
Requires(pre): /usr/sbin/useradd, /usr/bin/getent
Requires(postun): /usr/sbin/userdel
%description
RPM Representation of Code tarball.
%prep
%setup -n %{version}
%clean
%{__rm} -rf $RPM_BUILD_ROOT
%pre
/usr/bin/getent group %{app_user} || /usr/sbin/groupadd -r %{app_user}
/usr/bin/getent passwd %{app_user} || /usr/sbin/useradd -r -d %{install_dir} -s /bin/bash %{app_user} -g %{app_user} -k /etc/skel -m
%preun
%post
%{__rm} -f %{install_dir}/code
%{__ln_s} -f %{install_dir}/builds/%{version}/code %{install_dir}/code
/bin/chown %{app_user}:%{app_user} -R %{install_dir}
%postun
%{__rm} -rf %{install_dir}/builds/%{version}
if [ "$1" = "0" ]; then
# If the first argument to %preun and %postun is 0, the action is uninstallation.
%{__rm} -f %{install_dir}/code
fi
%build
yarn
npm run build:prod
%install
%{__mkdir_p} %{buildroot}%{install_dir}/builds/%{version}/code
%{__cp} -Rp ./dist/* %{buildroot}%{install_dir}/builds/%{version}/code/
echo "%{version}-%{release}" > %{buildroot}%{install_dir}/builds/%{version}/code/version.txt
echo '{"version": '"\"%{version}\""', "release": '"\"%{release}\""', "commit_sha": '"\"%{git_sha}\""', "build_date": '"\"%{build_date}\""'}' > %{buildroot}%{install_dir}/builds/%{version}/code/buildInfo.json
%files
%defattr(0750,%{app_user},%{app_user},0750)
%{install_dir}/builds/%{version}
%changelog
* Fri Oct 6 2017 Francisco Gray <[email protected]> - %{version}-%{release}
- First packaging of badgr-ui