[gnokii] Migrate to systemd, latest upstream, fix build.

Jon Ciesla limb at fedoraproject.org
Tue Apr 17 18:46:19 UTC 2012


commit 27c682557c8d7500bfc08024bcb0a41068750b56
Author: Jon Ciesla <limburgher at gmail.com>
Date:   Tue Apr 17 13:45:59 2012 -0500

    Migrate to systemd, latest upstream, fix build.

 .gitignore          |    1 +
 gnokii-config.patch |   17 +++------------
 gnokii-smsd.service |   10 +++++++++
 gnokii.spec         |   55 ++++++++++++++++++++++++++++++++++++++------------
 sources             |    2 +-
 5 files changed, 58 insertions(+), 27 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 69c4253..d47f6ff 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
 gnokii-0.6.28.tar.bz2
 /gnokii-0.6.29.tar.bz2
 /gnokii-0.6.30.tar.bz2
+/gnokii-0.6.31.tar.bz2
diff --git a/gnokii-config.patch b/gnokii-config.patch
index a57d655..f986b69 100644
--- a/gnokii-config.patch
+++ b/gnokii-config.patch
@@ -1,18 +1,9 @@
---- Docs/sample/gnokiirc~	2005-07-24 22:16:22.000000000 +0300
-+++ Docs/sample/gnokiirc	2005-08-06 23:33:26.000000000 +0300
-@@ -59,7 +59,7 @@
- # port software (eg. minicom). If you have wrong permissions for the
- # directory, a warning will be generated. If you don't want a lockfile, set
- # it to 'no'.
--use_locking = yes
-+use_locking = no
- 
- # Baudrate to use on serial port connections.
- # Currently used only by models AT and BIP/CIMD. Defaults to 19200.
-@@ -115,7 +115,7 @@
+--- Docs/sample/gnokiirc~	2012-04-17 13:09:03.000000000 -0500
++++ Docs/sample/gnokiirc	2012-04-17 13:10:42.793893402 -0500
+@@ -238,7 +238,7 @@
+ # In particular ensure that mgnokiidev is in this location, with
  # permissions 4750, owned by root, group gnokii.  Ensure you
  # are in the gnokii group and that the group exists...
- [gnokiid]
 -bindir = /usr/local/sbin/
 +bindir = /usr/sbin/
  
diff --git a/gnokii-smsd.service b/gnokii-smsd.service
new file mode 100644
index 0000000..424ff82
--- /dev/null
+++ b/gnokii-smsd.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Gnokii SMS Daemon
+After=network.target 
+
+[Service]
+User=gnokii
+ExecStart=/usr/bin/gnokii-smsd -f /var/log/gnokii-smsd
+
+[Install]
+WantedBy=multi-user.target
diff --git a/gnokii.spec b/gnokii.spec
index 7ef7529..1f8ae06 100644
--- a/gnokii.spec
+++ b/gnokii.spec
@@ -1,15 +1,15 @@
 # TODO: merge patches upstream where applicable
 
 Name:           gnokii
-Version:        0.6.30
-Release:        2%{?dist}
+Version:        0.6.31
+Release:        1%{?dist}
 Summary:        Linux/Unix tool suite for various mobile phones
 
 Group:          Applications/Communications
 License:        GPLv2+
 URL:            http://www.gnokii.org/
 Source0:        http://www.gnokii.org/download/gnokii/%{name}-%{version}.tar.bz2
-Source2:        %{name}-smsd.init
+Source2:        %{name}-smsd.service
 Source3:        %{name}-smsd.sysconfig
 Source4:        %{name}-smsd.logrotate
 Source5:        %{name}-smsd2mail.sh
@@ -62,8 +62,9 @@ Summary:        Gnokii SMS daemon
 Group:          System Environment/Daemons
 Requires:       %{name}%{?_isa} = %{version}-%{release}
 Requires(pre):  %{_sbindir}/useradd
-Requires(post): /sbin/chkconfig
-Requires(preun): /sbin/chkconfig
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
 
 %description    smsd
 The Gnokii SMS daemon receives and sends SMS messages.
@@ -115,7 +116,9 @@ install -pm 644 %{SOURCE6} README.smsd2mail
 sed -e 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' -i libtool
 sed -e 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' -i libtool
 make %{?_smp_mflags}
-
+pushd xgnokii
+make %{?_smp_mflags}
+popd 
 
 %install
 make install DESTDIR=$RPM_BUILD_ROOT
@@ -136,7 +139,12 @@ desktop-file-install \
   --dir $RPM_BUILD_ROOT%{_datadir}/applications \
   --mode 644 \
   --add-category X-Fedora \
-  $RPM_BUILD_ROOT%{_datadir}/applications/xgnokii.desktop
+  xgnokii/xgnokii.desktop
+
+install -D -m 755 xgnokii/xgnokii $RPM_BUILD_ROOT%{_bindir}
+
+install -D -m 644 common/gnokii.pc $RPM_BUILD_ROOT%{_libdir}/pkgconfig/gnokii.pc
+install -D -m 644 xgnokii/xgnokii.pc $RPM_BUILD_ROOT%{_libdir}/pkgconfig/xgnokii.pc
 
 # Convert the default icons to PNG
 install -dm 755 $RPM_BUILD_ROOT%{_datadir}/pixmaps
@@ -145,7 +153,7 @@ convert Docs/sample/logo/gnokii.xpm \
 chmod 644 $RPM_BUILD_ROOT%{_datadir}/pixmaps/xgnokii.png
 
 # Install the configuration files
-install -Dpm 755 %{SOURCE2} $RPM_BUILD_ROOT%{_initrddir}/gnokii-smsd
+install -Dpm 644 %{SOURCE2} $RPM_BUILD_ROOT%{_unitdir}/gnokii-smsd.service
 install -Dpm 640 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/gnokii-smsd
 install -Dpm 644 %{SOURCE4} \
   $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/gnokii-smsd
@@ -173,19 +181,35 @@ rm -rf $RPM_BUILD_ROOT
 %postun -p /sbin/ldconfig
 
 %post smsd
-/sbin/chkconfig --add gnokii-smsd
+if [ $1 -eq 1 ] ; then 
+    # Initial installation 
+    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
 
 %preun smsd
 if [ $1 -eq 0 ] ; then
-  %{_initrddir}/gnokii-smsd stop >/dev/null 2>&1 || :
-  /sbin/chkconfig --del gnokii-smsd
+    # Package removal, not upgrade
+    /bin/systemctl --no-reload disable gnokii-smsd.service > /dev/null 2>&1 || :
+    /bin/systemctl stop gnokii-smsd.service > /dev/null 2>&1 || :
 fi
 
+
 %postun smsd
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
 if [ $1 -ge 1 ] ; then
-  %{_initrddir}/gnokii-smsd try-restart >/dev/null 2>&1 || :
+    # Package upgrade, not uninstall
+    /bin/systemctl try-restart gnokii-smsd.service >/dev/null 2>&1 || :
 fi
 
+%triggerun -- gnokii-smsd < 0.6.31-1
+# Save the current service runlevel info
+# User must manually run systemd-sysv-convert --apply gnokii-smsd
+# to migrate them to systemd targets
+/usr/bin/systemd-sysv-convert --save gnokii-smsd >/dev/null 2>&1 ||:
+
+# Run these because the SysV package being removed won't do them
+/sbin/chkconfig --del gnokii-smsd >/dev/null 2>&1 || :
+/bin/systemctl try-restart gnokii-smsd.service >/dev/null 2>&1 || :
 
 %files -f %{name}.lang
 %defattr(-,root,root,-)
@@ -214,7 +238,7 @@ fi
 %doc smsd/action smsd/ChangeLog smsd/README README.smsd2mail smsd2mail.sh
 %attr(-,gnokii,gnokii) %config(noreplace) %{_sysconfdir}/sysconfig/gnokii-smsd
 %config(noreplace) %{_sysconfdir}/logrotate.d/gnokii-smsd
-%{_initrddir}/gnokii-smsd
+%{_unitdir}/gnokii-smsd.service
 %{_bindir}/gnokii-smsd
 %{_mandir}/man8/gnokii-smsd.8*
 %dir %{_libdir}/smsd/
@@ -243,6 +267,11 @@ fi
 %{_libdir}/pkgconfig/xgnokii.pc
 
 %changelog
+* Tue Apr 17 2012 Jon Ciesla <limburgher at gmail.com> - 0.6.31-1
+- Migrate to systemd, BZ 781511.
+- Latest upstream.
+- Fixed up installation.
+
 * Fri Jan 13 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.6.30-2
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
 
diff --git a/sources b/sources
index 60b3fd1..e244789 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-c90137d403febbc16712d64f0eb196de  gnokii-0.6.30.tar.bz2
+d9627f4a1152d3ea7806df4532850d5f  gnokii-0.6.31.tar.bz2


More information about the scm-commits mailing list