[jetty] Drop init script, resolves #814788
Mikolaj Izdebski
mizdebsk at fedoraproject.org
Mon Apr 23 12:54:40 UTC 2012
commit c0d6d44e654349fddc936437e39d8113bdd757f7
Author: Mikolaj Izdebski <mizdebsk at redhat.com>
Date: Mon Apr 23 14:53:49 2012 +0200
Drop init script, resolves #814788
- Remove jetty.script from SCM
- Reload systemd on package install/upgrade/remove
jetty.init | 153 ----------------------------------------------------------
jetty.script | 49 -------------------
jetty.spec | 39 +++++++++------
3 files changed, 23 insertions(+), 218 deletions(-)
---
diff --git a/jetty.spec b/jetty.spec
index 215a03c..6dbca89 100644
--- a/jetty.spec
+++ b/jetty.spec
@@ -52,7 +52,6 @@ License: ASL 2.0
URL: http://jetty.mortbay.org/jetty/
Source0: http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/snapshot/jetty-%{version}.%{addver}.tar.bz2
Source1: djetty.script
-Source2: jetty.init
Source3: jetty.logrotate
Source4: %{name}-depmap.xml
Source5: %{name}.service
@@ -117,7 +116,9 @@ Requires: xerces-j2 >= 0:2.7
Requires: xml-commons-apis
%{?FE_USERADD_REQ}
-Requires(post): systemd-sysv
+Requires(post): systemd-units, systemd-sysv
+Requires(preun): systemd-units
+Requires(postun): systemd-units
Provides: group(%username) = %jtuid
Provides: user(%username) = %jtuid
@@ -182,7 +183,6 @@ mvn-rpmbuild -X \
%install
# dirs
install -dm 755 %{buildroot}%{_bindir}
-install -dm 755 %{buildroot}%{_initrddir}
install -dm 755 %{buildroot}%{_sysconfdir}/logrotate.d
install -dm 755 %{buildroot}%{_javadir}/%{name}
@@ -208,7 +208,6 @@ chmod +x %{buildroot}%{homedir}/bin/jetty-xinetd.sh
chmod +x djetty
mv djetty %{buildroot}%{_bindir}/djetty
ln -s %{homedir}/bin/jetty.sh %{buildroot}%{_bindir}/%{name}
-install -pm 755 %{SOURCE2} %{buildroot}%{_initrddir}/%{name}
install -pm 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
echo '# Placeholder configuration file. No default is provided.' > \
%{buildroot}%{confdir}/jetty.conf
@@ -345,14 +344,28 @@ cp -pr target/site/api*/* %{buildroot}%{_javadocdir}/%{name}/
%pre
# Add the "jetty" user and group
%__fe_groupadd %jtuid -r %username &>/dev/null || :
-# Use /bin/sh so init script will start properly.
-%__fe_useradd %jtuid -r -s /bin/sh -d %homedir -M \
+%__fe_useradd %jtuid -r -s /sbin/nologin -d %homedir -M \
-g %username %username &>/dev/null || :
%post
-[ -x /sbin/chkconfig ] && /sbin/chkconfig --add %{name}
+if [ $1 -eq 1 ] ; then
+ # Initial installation
+ /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
+
+%preun
+if [ $1 -eq 0 ] ; then
+ # Package removal, not upgrade
+ /bin/systemctl --no-reload disable %{name}.service >/dev/null 2>&1 || :
+ /bin/systemctl stop %{name}.service >/dev/null 2>&1 || :
+fi
%postun
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ] ; then
+ # Package upgrade, not uninstall
+ /bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || :
+fi
%__fe_userdel %username &>/dev/null || :
%__fe_groupdel %username &>/dev/null || :
@@ -370,13 +383,6 @@ cp -pr target/site/api*/* %{buildroot}%{_javadocdir}/%{name}/
/sbin/chkconfig --del jetty >/dev/null 2>&1 || :
/bin/systemctl try-restart jetty.service >/dev/null 2>&1 || :
-%preun
-if [ $1 = 0 ]; then
- [ -f /var/lock/subsys/%{name} ] && %{_initrddir}/%{name} stop
- [ -f %{_initrddir}/%{name} -a -x /sbin/chkconfig ] && /sbin/chkconfig --del %{name}
-
- %{_sbindir}/fedora-userdel %{name} >> /dev/null 2>&1 || :
-fi
%files
%doc NOTICE.txt README.txt VERSION.txt LICENSE*
@@ -404,8 +410,9 @@ fi
%changelog
* Mon Apr 23 2012 Mikolaj Izdebski <mizdebsk at redhat.com> - 8.1.0-6
-- Fix incorrect init script return value
-- Resolves #814788
+- Drop init script, resolves #814788
+- Remove jetty.script from SCM
+- Reload systemd on package install/upgrade/remove
* Wed Apr 18 2012 Mikolaj Izdebski <mizdebsk at redhat.com> - 8.1.0-5
- Replace eclipse-rcp BR with felix-framework
More information about the scm-commits
mailing list