[mw-devel] MW3 r1311 - in trunk: . debian-template

welshbyte at sucs.org welshbyte at sucs.org
Sat Dec 8 17:49:46 GMT 2012


Author: welshbyte
Date: 2012-12-08 17:49:45 +0000 (Sat, 08 Dec 2012)
New Revision: 1311

Added:
   trunk/mw.service
Modified:
   trunk/Makefile
   trunk/Makefile.common
   trunk/debian-template/postinst
   trunk/mw.spec
Log:
Add a systemd unit for mwserv and update the spec file to fix 'make rpm' to build and install on Fedora.


Modified: trunk/Makefile
===================================================================
--- trunk/Makefile	2012-12-08 05:30:38 UTC (rev 1310)
+++ trunk/Makefile	2012-12-08 17:49:45 UTC (rev 1311)
@@ -12,8 +12,8 @@
 install:
 	install -d $(DESTDIR)$(libdir)/mw
 	cp -a $(INSTALLFILES) $(DESTDIR)$(libdir)/mw/
-	install -d $(DESTDIR)/etc/init.d
-	install mwserv.init $(DESTDIR)/etc/init.d/mwserv
+	install -d $(DESTDIR)$(initddir)
+	install mwserv.init $(DESTDIR)$(initddir)/mwserv
 	$(MAKE) -C src $@
 	$(MAKE) -C po $@
 	$(MAKE) -C src/webclient $@

Modified: trunk/Makefile.common
===================================================================
--- trunk/Makefile.common	2012-12-08 05:30:38 UTC (rev 1310)
+++ trunk/Makefile.common	2012-12-08 17:49:45 UTC (rev 1311)
@@ -1,4 +1,4 @@
-SVNVER = $(shell ( svnversion -c . 2>/dev/null || echo 0:0 ) | cut -d : -f 2)
+SVNVER = $(shell ( svnversion -c . 2>/dev/null | sed 's/Unversioned directory/exported/' || echo 0:0 ) | cut -d : -f 2)
 
 VERSION_MAJOR = 2
 VERSION_MINOR = 17
@@ -24,6 +24,7 @@
 bindir ?= $(prefix)/bin
 datadir ?= $(prefix)/share
 localstatedir ?= /var
+initddir ?= /etc/init.d
 
 # The non source files that should get installed
 INSTALLFILES = colour help login.banner scripthelp talkhelp wizhelp COPYING INSTALL LICENSE README

Modified: trunk/debian-template/postinst
===================================================================
--- trunk/debian-template/postinst	2012-12-08 05:30:38 UTC (rev 1310)
+++ trunk/debian-template/postinst	2012-12-08 17:49:45 UTC (rev 1311)
@@ -24,7 +24,6 @@
 
 chown -R mw:mw /usr/lib/mw
 chown mw:mw /usr/bin/mw
-chown mw:mw /usr/lib/mw/mwpoll
 chown mw:mw /var/log/mw
 chown mw:mw /var/lib/mw
 chown mw:mw /var/run/mw

Added: trunk/mw.service
===================================================================
--- trunk/mw.service	                        (rev 0)
+++ trunk/mw.service	2012-12-08 17:49:45 UTC (rev 1311)
@@ -0,0 +1,9 @@
+[Unit]
+Description=Milliways server
+After=network.target
+
+[Service]
+ExecStart=/usr/bin/mwserv --foreground --port 9999
+
+[Install]
+WantedBy=multi-user.target

Modified: trunk/mw.spec
===================================================================
--- trunk/mw.spec	2012-12-08 05:30:38 UTC (rev 1310)
+++ trunk/mw.spec	2012-12-08 17:49:45 UTC (rev 1311)
@@ -1,16 +1,18 @@
 %{expand: %%global changeset %(cat mw.rev)}
 Summary: Milliways III talker and BBS
 Name: mw3
-Version: 2.16.%{changeset}
+Version: 2.17.%{changeset}
 Release: 1
-License: GPL
+License: GPLv2
 Group: Applications/Communications
 Source: %{name}-%{version}.tar.gz
 BuildRoot: %{_tmppath}/%{name}-root
-Requires: libtermcap readline sqlite js curl
-BuildRequires: libtermcap-devel readline-devel glibc-devel sqlite-devel js-devel curl-devel openssl-devel
-Packager: Peter Berry <pwb at sucs.org>
-URL: http://sucs.org/wiki/milliways
+Requires: readline sqlite js curl
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
+BuildRequires: libtermcap-devel readline-devel glibc-devel sqlite-devel js-devel curl-devel openssl-devel jansson-devel
+URL: http://projects.sucs.org/projects/mw/
 
 %description
 An integrated talker and BBS (bulletin board system) with a peer-to-peer
@@ -24,6 +26,10 @@
 
 %install
 make DESTDIR=$RPM_BUILD_ROOT prefix=/usr libdir="%{_libdir}" install
+# We have a systemd unit file for mwserv so remove the sysv initscript
+rm -rf $RPM_BUILD_ROOT/etc/init.d
+install -Dm 0644 mw.service $RPM_BUILD_ROOT/%{_unitdir}/mw.service
+mv $RPM_BUILD_ROOT%{_libdir}/mw/mwserv $RPM_BUILD_ROOT%{_bindir}
 %find_lang mw
 
 %clean
@@ -34,6 +40,27 @@
 /usr/sbin/useradd -c "mw system" \
     -s /sbin/nologin -r -d %{_libdir}/mw mw 2> /dev/null || :
 
+%post
+if [ $1 -eq 1 ] ; then 
+    # Initial installation (disabled by default)
+    # To enable after installation, do systemctl enable mw.service
+    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
+
+%preun
+if [ $1 -eq 0 ] ; then
+    # Package removal, not upgrade
+    /bin/systemctl --no-reload disable mw.service > /dev/null 2>&1 || :
+    /bin/systemctl stop mw.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 mw.service >/dev/null 2>&1 || :
+fi
+
 %files -f mw.lang
 %defattr (755,mw,mw)
 %dir %{_libdir}/mw
@@ -46,13 +73,19 @@
 %{_libdir}/mw/scripthelp
 %{_libdir}/mw/talkhelp
 %{_libdir}/mw/wizhelp
+%{_unitdir}/mw.service
 %attr (4711,mw,mw) %{_bindir}/mw
+%attr (755,mw,mw) %{_bindir}/mwserv
+%attr (4711,mw,mw) %{_libdir}/mw/mwpoll
 %doc %{_libdir}/mw/COPYING
 %doc %{_libdir}/mw/INSTALL
 %doc %{_libdir}/mw/LICENSE
 %doc %{_libdir}/mw/README
 
 %changelog
+* Sat Dec 08 2012 Andrew Price <welshbyte at sucs.org>
+- Bump to 2.17.* and add mwserv-related files
+
 * Sat Apr 12 2008 Andrew Price <welshbyte at sucs.org>
 - release 2.16.1033 including file layout changes
 
@@ -88,7 +121,7 @@
 - Initial release of version 2.14.1 with !locale and !charset commands
 
 * Thu Sep 22 2005 Peter Berry <pwb at sucs.org>
-- Fixed export of _bindir to make in %build
+- Fixed export of _bindir to make in build
 
 * Wed Jan 19 2005 Peter Berry <pwb at sucs.org>
 - Initial RPM release.




More information about the mw-devel mailing list