| 1 | Summary: scripts.mit.edu AFS administration system |
|---|
| 2 | Group: Applications/System |
|---|
| 3 | Name: tokensys |
|---|
| 4 | Version: 0.%{scriptsversion} |
|---|
| 5 | Release: 0 |
|---|
| 6 | Vendor: The scripts.mit.edu Team (scripts@mit.edu) |
|---|
| 7 | URL: http://scripts.mit.edu |
|---|
| 8 | License: GPL |
|---|
| 9 | Source: %{name}.tar.gz |
|---|
| 10 | BuildRoot: %{_tmppath}/%(%{__id_u} -n)-%{name}-%{version}-root |
|---|
| 11 | %define debug_package %{nil} |
|---|
| 12 | Prereq: /usr/bin/kinit, /usr/bin/aklog |
|---|
| 13 | Requires(post): systemd-units |
|---|
| 14 | Requires(preun): systemd-units |
|---|
| 15 | Requires(postun): systemd-units |
|---|
| 16 | BuildRequires: systemd-units |
|---|
| 17 | |
|---|
| 18 | %description |
|---|
| 19 | |
|---|
| 20 | scripts.mit.edu AFS administration system |
|---|
| 21 | Contains: |
|---|
| 22 | - A shell script for renewing the scripts AFS credentials <renew> |
|---|
| 23 | - A shell script for configuring scripts AFS <scripts-afsagent-startup> |
|---|
| 24 | - systemd units for running the above |
|---|
| 25 | See http://scripts.mit.edu/wiki for more information. |
|---|
| 26 | |
|---|
| 27 | %prep |
|---|
| 28 | %setup -q -n %{name} |
|---|
| 29 | |
|---|
| 30 | %build |
|---|
| 31 | ./configure --with-kinit=/usr/bin/kinit --with-aklog=/usr/bin/aklog --with-fs=/usr/bin/fs |
|---|
| 32 | |
|---|
| 33 | %install |
|---|
| 34 | [ $RPM_BUILD_ROOT != / ] && rm -rf $RPM_BUILD_ROOT |
|---|
| 35 | install -D renew $RPM_BUILD_ROOT/home/afsagent/renew |
|---|
| 36 | install -D scripts-afsagent-startup $RPM_BUILD_ROOT/usr/local/libexec/scripts-afsagent-startup |
|---|
| 37 | install -D scripts-afsagent-startup.service $RPM_BUILD_ROOT%{_unitdir}/scripts-afsagent-startup.service |
|---|
| 38 | install -D scripts-afsagent.service $RPM_BUILD_ROOT%{_unitdir}/scripts-afsagent.service |
|---|
| 39 | install -D scripts-afsagent.timer $RPM_BUILD_ROOT%{_unitdir}/scripts-afsagent.timer |
|---|
| 40 | |
|---|
| 41 | %clean |
|---|
| 42 | [ $RPM_BUILD_ROOT != / ] && rm -rf $RPM_BUILD_ROOT |
|---|
| 43 | |
|---|
| 44 | %files |
|---|
| 45 | %defattr(0644,root,root) |
|---|
| 46 | %{_unitdir}/*.service |
|---|
| 47 | %{_unitdir}/*.timer |
|---|
| 48 | %defattr(0755, afsagent, afsagent) |
|---|
| 49 | /home/afsagent/renew |
|---|
| 50 | /usr/local/libexec/scripts-afsagent-startup |
|---|
| 51 | |
|---|
| 52 | %pre |
|---|
| 53 | groupadd -g 101 afsagent || [ $? -eq 9 ] |
|---|
| 54 | useradd -u 101 -g 101 afsagent || [ $? -eq 9 ] |
|---|
| 55 | |
|---|
| 56 | %post |
|---|
| 57 | /bin/systemctl enable scripts-afsagent-startup.service >/dev/null 2>&1 || : |
|---|
| 58 | /bin/systemctl enable scripts-afsagent.service >/dev/null 2>&1 || : |
|---|
| 59 | /bin/systemctl enable scripts-afsagent.timer >/dev/null 2>&1 || : |
|---|
| 60 | |
|---|
| 61 | if [ $1 -eq 1 ] ; then |
|---|
| 62 | # Initial installation |
|---|
| 63 | /bin/systemctl daemon-reload >/dev/null 2>&1 || : |
|---|
| 64 | fi |
|---|
| 65 | |
|---|
| 66 | %preun |
|---|
| 67 | if [ $1 -eq 0 ] ; then |
|---|
| 68 | # Package removal, not upgrade |
|---|
| 69 | /bin/systemctl --no-reload disable scripts-afsagent-startup.service > /dev/null 2>&1 || : |
|---|
| 70 | /bin/systemctl --no-reload disable scripts-afsagent.service > /dev/null 2>&1 || : |
|---|
| 71 | /bin/systemctl --no-reload disable scripts-afsagent.timer > /dev/null 2>&1 || : |
|---|
| 72 | /bin/systemctl stop scripts-afsagent-startup.service > /dev/null 2>&1 || : |
|---|
| 73 | /bin/systemctl stop scripts-afsagent.service > /dev/null 2>&1 || : |
|---|
| 74 | /bin/systemctl stop scripts-afsagent.timer > /dev/null 2>&1 || : |
|---|
| 75 | fi |
|---|
| 76 | |
|---|
| 77 | %postun |
|---|
| 78 | /bin/systemctl daemon-reload >/dev/null 2>&1 || : |
|---|
| 79 | if [ $1 -ge 1 ] ; then |
|---|
| 80 | # Package upgrade, not uninstall |
|---|
| 81 | /bin/systemctl try-restart scripts-afsagent.service >/dev/null 2>&1 || : |
|---|
| 82 | fi |
|---|
| 83 | |
|---|
| 84 | if [ "$1" = "0" ] ; then |
|---|
| 85 | userdel -r afsagent |
|---|
| 86 | fi |
|---|
| 87 | |
|---|
| 88 | %changelog |
|---|
| 89 | * Mon Nov 21 2011 Quentin Smith <quentin@mit.edu> |
|---|
| 90 | - add systemd units |
|---|
| 91 | - remove crontab |
|---|
| 92 | |
|---|
| 93 | * Tue Aug 17 2010 Geoffrey Thomas <geofft@mit.edu> |
|---|
| 94 | - aklog csail as well |
|---|
| 95 | |
|---|
| 96 | * Wed Dec 31 2008 Quentin Smith <quentin@mit.edu> |
|---|
| 97 | - only remove afsagent user on erase |
|---|
| 98 | - ignore preexisting user |
|---|
| 99 | |
|---|
| 100 | * Wed Apr 11 2007 Joe Presbrey <presbrey@mit.edu> |
|---|
| 101 | - crontab moved system-wide (/etc/cron.d) to isolate from fail-over cron service |
|---|
| 102 | |
|---|
| 103 | * Sat Sep 30 2006 Jeff Arnold <jbarnold@MIT.EDU> 0.00 |
|---|
| 104 | - initial prerelease version |
|---|