forked from LibreSchool/doraemon
165 lines
5.0 KiB
RPMSpec
165 lines
5.0 KiB
RPMSpec
Summary: Helps client to join domain and maintain itself
|
|
Name: doraemon
|
|
Version: 1.3.0
|
|
Release: 1.ns6
|
|
URL: https://github.com/bglug-it/doraemon/
|
|
License: GPLv2+
|
|
Group: System Environment/Daemons
|
|
BuildRoot: %{_tmppath}/%{name}-root
|
|
BuildRequires: nethserver-devtools > 1.0.1
|
|
Requires: httpd, php, sudo, php-xml, php-mcrypt
|
|
Requires: nethserver-base, nethserver-php
|
|
Requires: upstart
|
|
Source0: doraemon-1.3.0.tar.gz
|
|
BuildArch: noarch
|
|
|
|
%description
|
|
Helps client on a domain network to get information for its maintenance.
|
|
|
|
%prep
|
|
%setup -q
|
|
|
|
%build
|
|
|
|
%install
|
|
(cd root ; find . -depth -print | cpio -dump %{buildroot})
|
|
rm -f %{name}-%{version}-%{release}-filelist
|
|
%{genfilelist} %{buildroot} > %{name}-%{version}-%{release}-filelist
|
|
mkdir -p %{buildroot}%{_localstatedir}/log/doraemon
|
|
mkdir -p %{buildroot}%{_localstatedir}/cache/doraemon
|
|
|
|
|
|
%pre
|
|
#if [ "$1" = 1 ]; then
|
|
# #installation
|
|
#fi
|
|
if [ "$1" = 2 ]; then
|
|
#upgrade
|
|
/sbin/stop %{name} >/dev/null 2>&1 || :
|
|
DATABASE=/var/lib/doraemon/doraemon.db
|
|
INI=/etc/doraemon.ini
|
|
if [ -f $INI ]; then
|
|
DATABASE=$(awk -F "=" '/Database/ {print $2}' $INI)
|
|
PORT=$(awk -F "=" '/Port/ {print $2}' $INI)
|
|
BASE=$(awk -F "=" '/Base/ {print $2}' $INI)
|
|
ROLE=$(awk -F "=" '/Role/ {print $2}' $INI)
|
|
DIGITS=$(awk -F "=" '/Digits/ {print $2}' $INI)
|
|
DOMAIN=$(awk -F "=" '/Domain/ {print $2}' $INI)
|
|
MGMTKEY=$(awk -F "=" '/MgmtKey/ {print $2}' $INI)
|
|
VAULTPASSFILE=$(awk -F "=" '/VaultPassFile/ {print $2}' $INI)
|
|
rm $INI
|
|
/sbin/e-smith/db configuration set %{name} service \
|
|
status enabled \
|
|
TCPPort $PORT \
|
|
access private \
|
|
DefaultRole $ROLE \
|
|
DomainFile $DOMAIN \
|
|
ManagementKeyFile $MGMTKEY \
|
|
NamingBase $BASE \
|
|
NamingDigits $DIGITS \
|
|
VaultPassFile $VAULTPASSFILE
|
|
else
|
|
/sbin/e-smith/db configuration set %{name} service \
|
|
status enabled \
|
|
TCPPort 3000 \
|
|
access private \
|
|
DefaultRole client \
|
|
DomainFile /etc/domain.yml \
|
|
ManagementKeyFile /home/amgmt/.ssh/id_rsa.pub \
|
|
NamingBase lab \
|
|
NamingDigits 2 \
|
|
VaultPassFile /home/amgmt/.ansible/vault.txt
|
|
fi
|
|
if [ -f $DATABASE ]; then
|
|
sqlite3 -separator " " $DATABASE \
|
|
"select * from client" | while read id hostname mac role; do
|
|
/sbin/e-smith/db hosts set $hostname remote \
|
|
MacAddress $mac Role $role
|
|
done
|
|
rm $DATABASE
|
|
fi
|
|
fi
|
|
|
|
%post
|
|
if [ "$1" = 1 ]; then
|
|
#installation
|
|
/sbin/e-smith/db configuration set %{name} service status enabled TCPPort 3000 access private DefaultRole client DomainFile /etc/domain.yml ManagementKeyFile /home/amgmt/.ssh/id_rsa.pub NamingBase lab NamingDigits 2 VaultPassFile /home/amgmt/.ansible/vault.txt
|
|
/sbin/e-smith/expand-template /etc/sudoers
|
|
/sbin/e-smith/expand-template /etc/httpd/doraemon/httpd.conf
|
|
/sbin/start %{name} >/dev/null 2>&1 || :
|
|
/sbin/e-smith/signal-event runlevel-adjust
|
|
/sbin/e-smith/signal-event firewall-adjust
|
|
fi
|
|
if [ "$1" = 2 ]; then
|
|
#upgrade
|
|
# TODO: this won't be needed in the next version
|
|
/sbin/e-smith/expand-template /etc/sudoers
|
|
/sbin/e-smith/expand-template /etc/httpd/doraemon/httpd.conf
|
|
/sbin/start %{name} >/dev/null 2>&1 || :
|
|
/sbin/e-smith/signal-event runlevel-adjust
|
|
/sbin/e-smith/signal-event firewall-adjust
|
|
fi
|
|
|
|
|
|
%preun
|
|
#if [ "$1" = 1 ]; then
|
|
# #upgrade
|
|
#fi
|
|
if [ "$1" = 0 ]; then
|
|
#uninstallation
|
|
/sbin/stop %{name} >/dev/null 2>&1 || :
|
|
fi
|
|
|
|
|
|
%postun
|
|
#if [ "$1" = 1 ]; then
|
|
# #upgrade
|
|
#fi
|
|
if [ "$1" = 0 ]; then
|
|
#uninstallation
|
|
/sbin/e-smith/db configuration delete %{name}
|
|
/sbin/e-smith/expand-template /etc/sudoers
|
|
/sbin/e-smith/signal-event runlevel-adjust
|
|
/sbin/e-smith/signal-event firewall-adjust
|
|
fi
|
|
|
|
|
|
%clean
|
|
rm -rf %{buildroot}
|
|
|
|
%files -f %{name}-%{version}-%{release}-filelist
|
|
%files
|
|
%defattr(644,root,root,755)
|
|
%doc README.md LICENSE.txt
|
|
%attr(0750,srvmgr,srvmgr) %dir %{_localstatedir}/cache/doraemon
|
|
%attr(0700,root,root) %dir %{_localstatedir}/log/doraemon
|
|
%attr(0644,root,root) %config %ghost %{_localstatedir}/log/doraemon/access_log
|
|
%attr(0644,root,root) %config %ghost %{_localstatedir}/log/doraemon/error_log
|
|
|
|
|
|
%changelog
|
|
* Mon Jul 18 2016 Paolo Asperti <paolo-AT-asperti.com> - 1.3.0-1.ns6
|
|
- PHP porting
|
|
- Added a basic UI
|
|
|
|
* Tue Oct 27 2015 Emiliano Vavassori <syntaxerrormmm-AT-gmail.com> - 1.2.1-2.ns6
|
|
- Packing corrections to rpm to fix upgrading issue
|
|
|
|
* Tue Oct 27 2015 Emiliano Vavassori <syntaxerrormmm-AT-gmail.com> - 1.2.1-1.ns6
|
|
- Packing new minor correction on how packages are extracted from db
|
|
|
|
* Mon Sep 11 2015 Emiliano Vavassori <syntaxerrormmm-AT-gmail.com> - 1.2.0-1.ns6
|
|
- Packing new version with ansible dynamic inventory support, epoptes server role support.
|
|
|
|
* Mon Sep 07 2015 Emiliano Vavassori <syntaxerrormmm-AT-gmail.com> - 1.1.1-1.ns6
|
|
- Packing new version with correct roles.
|
|
|
|
* Sun Sep 06 2015 Emiliano Vavassori <syntaxerrormmm-AT-gmail.com> - 1.1.0-1.ns6
|
|
- Packing new version with new functionalities.
|
|
|
|
* Wed Jul 15 2015 Emiliano Vavassori <syntaxerrormmm-AT-gmail.com> - 1.0.0-2.ns6
|
|
- Added logrotate file.
|
|
|
|
* Mon Jul 13 2015 Emiliano Vavassori <syntaxerrormmm-AT-gmail.com> - 1.0.0-1.ns6
|
|
- Unique binary for both ansiblehelper and mac2hostname.
|