1Name:		amtc
2Version:	#AMTCV#
3Release:	1%{?dist}
4Summary:	Threaded remote power management commandline tool for intel vPro/AMT&DASH hosts
5
6Group:		Applications/System
7License:	CC BY 3.0
8URL:		https://github.com/schnoddelbotz/amtc
9Source0:	https://github.com/schnoddelbotz/amtc/archive/amtc-#AMTCV#.tar.gz
10BuildRoot:	%(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
11
12BuildRequires:  libcurl-devel,gnutls-devel
13Requires: libcurl,gnutls
14
15################################################################################
16# binary RPM: amtc
17
18%description
19amtc is a simple command line tool, implemented in C, that can quickly
20control PCs that have out-of-band remote power management capabilities
21in the form of intel vPro/AMT or AMD DASH. amtc's key focus is not
22to support all SOAP operations AMT/DASH is aware of -- instead
23it concentrates only on vital OOB operations (on/off/reset/...).
24amtc can be combined with amtc-web to have a fluffy web GUI
25for power management tasks and power state logging/graphing.
26Combining amtc (or amtc-web) with cron makes scheduled power management.
27
28%prep
29%setup -q
30
31%build
32make
33
34%install
35rm -rf %{buildroot}
36make install DESTDIR=%{buildroot}
37make rpmfixup DESTDIR=%{buildroot}
38
39%clean
40rm -rf %{buildroot}
41
42%files
43%defattr(-,root,root,-)
44%doc
45/usr/bin/amtc
46
47%changelog
48
49################################################################################
50# binary RPM: amtc-web
51
52%package web
53Summary:	Remote power management Web-GUI for intel vPro/AMT&DASH hosts, using amtc
54Group:		Applications/Internet
55BuildArch:  noarch
56Requires: httpd,php,php-pdo
57
58%description web
59amtc-web is not only a fluffy web-GUI for amtc, brewed in PHP --
60its basic duty of managing lists of hosts to control via amtc-web
61can also be used to effectively power control these hosts using the CLI.
62It uses jQuery client-side and supports PHP PDO databases server-side.
63
64%files web
65%defattr(-,root,root,-)
66/etc/httpd/conf.d
67/usr/share/amtc-web
68%dir %attr(0770,apache,amtc-web) /etc/amtc-web
69%dir %attr(2770,apache,amtc-web) /var/lib/amtc-web
70%config(noreplace) %attr(0644,root,root) %{_sysconfdir}/cron.d/amtc-web
71%config(noreplace) %{_sysconfdir}/amtc-web/.htpasswd
72%config(noreplace) %{_sysconfdir}/amtc-web/amtc-web_httpd.conf
73%attr(0755,root,root) /var/lib/amtc-web/.htaccess
74
75%pre web
76/usr/bin/getent group amtc-web >/dev/null || \
77  /usr/sbin/groupadd -r amtc-web
78/usr/bin/getent passwd amtc-web >/dev/null || \
79  /usr/sbin/useradd -r -g amtc-web -d /var/lib/amtc-web -s /sbin/nologin \
80    -c "amtc-web user" amtc-web
81exit 0
82
83%post web
84chcon -R -t httpd_sys_rw_content_t /etc/amtc-web
85service httpd reload || service httpd start
86exit 0
87