rpms/smstools/devel smstools3-3.1.5-loglocation.patch, NONE, 1.1 smsd.logrotate, 1.2, 1.3 smstools.spec, 1.10, 1.11

Patrick Charles François Ernzer pcfe at fedoraproject.org
Fri Oct 30 20:49:29 UTC 2009


Author: pcfe

Update of /cvs/pkgs/rpms/smstools/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv26692

Modified Files:
	smsd.logrotate smstools.spec 
Added Files:
	smstools3-3.1.5-loglocation.patch 
Log Message:
- Major changes, now running as non-root
- corrected typo in my name in previous changelog entry
- log files now go to /var/log/smsd (copied that bit from the uucp RPM)
- creating smstools user if it does not exist
- will run as user smstools now, did not manage to make it work as system user without login though
- after deliberation, decided on having system user (mysql user also has shell, so this should be OK)
- added flag -m to useradd


smstools3-3.1.5-loglocation.patch:
 smsd.conf.easy     |    6 +++++-
 smsd.conf.full     |    9 ++++++---
 smsd.conf.non-root |    5 ++++-
 3 files changed, 15 insertions(+), 5 deletions(-)

--- NEW FILE smstools3-3.1.5-loglocation.patch ---
diff -up smstools3/examples/smsd.conf.easy.loglocation smstools3/examples/smsd.conf.easy
--- smstools3/examples/smsd.conf.easy.loglocation	2006-02-04 21:52:06.000000000 +0200
+++ smstools3/examples/smsd.conf.easy	2009-10-11 02:21:26.000000000 +0300
@@ -1,8 +1,12 @@
 # Example smsd.conf. Read the manual for a description
 
 devices = GSM1
-logfile = /var/log/smsd.log
+logfile = /var/log/smsd/smsd.log
 loglevel = 7
+user = smstools
+# 3.1.5 introduced smart logging
+# once your configuration is OK, set log level lower (5 is good in most cases)
+smart_logging = yes
 
 [GSM1]
 device = /dev/ttyS0
diff -up smstools3/examples/smsd.conf.full.loglocation smstools3/examples/smsd.conf.full
--- smstools3/examples/smsd.conf.full.loglocation	2007-05-20 11:58:28.000000000 +0300
+++ smstools3/examples/smsd.conf.full	2009-10-11 02:21:56.000000000 +0300
@@ -10,8 +10,11 @@ incoming = /var/spool/sms/incoming
 #report = /var/spool/sms/report
 #sent = /var/spool/sms/sent
 #mypath = /usr/local/bin
-#logfile = /var/log/smsd.log
+#logfile = /var/log/smsd/smsd.log
 loglevel = 7
+# 3.1.5 introduced smart logging
+# once your configuration is OK, set log level lower (5 is good in most cases)
+smart_logging = yes
 #alarmhandler = /usr/local/bin/alarmevent
 alarmlevel = 4
 delaytime = 10
@@ -19,7 +22,7 @@ errorsleeptime = 10
 blocktime = 3600
 #blockafter = 3
 #eventhandler = /usr/local/bin/smsevent
-#stats = /var/log/smsd_stats
+#stats = /var/log/smsd/smsd_stats
 #stats_interval = 3600
 #stats_no_zeroes = no
 #blacklist = /etc/smsd.black
@@ -33,7 +36,7 @@ autosplit = 3
 #validity = 255
 #decode_unicode_text = no
 #internal_combine = no
-#user = smsd
+#user = smstools
 #group = dialout
 #infofile = /var/run/sms/smsd.working
 #pidfile = /var/run/sms/smsd.pid
diff -up smstools3/examples/smsd.conf.non-root.loglocation smstools3/examples/smsd.conf.non-root
--- smstools3/examples/smsd.conf.non-root.loglocation	2006-11-23 15:28:27.000000000 +0200
+++ smstools3/examples/smsd.conf.non-root	2009-10-11 02:22:13.000000000 +0300
@@ -1,8 +1,11 @@
 # Example smsd.conf. Read the manual for a description
 
 devices = GSM1
-#logfile = /var/log/smsd.log
+#logfile = /var/log/smsd/smsd.log
 loglevel = 7
+# 3.1.5 introduced smart logging
+# once your configuration is OK, set log level lower (5 is good in most cases)
+smart_logging = yes
 
 # Settings to run smsd without root priviledges:
 user = user


Index: smsd.logrotate
===================================================================
RCS file: /cvs/pkgs/rpms/smstools/devel/smsd.logrotate,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -p -r1.2 -r1.3
--- smsd.logrotate	20 Dec 2008 12:36:50 -0000	1.2
+++ smsd.logrotate	30 Oct 2009 20:49:28 -0000	1.3
@@ -1,8 +1,13 @@
 #
 # Rotate smstools log files.
 #
-/var/log/smsd.log {
+/var/log/smsd/smsd_trouble.log {
 	missingok
+	create 640 smstools smstools
+}
+/var/log/smsd/smsd.log {
+	missingok
+	create 640 smstools smstools
 	postrotate
 		/sbin/service smsd condrestart 2> /dev/null > /dev/null || true
 	endscript


Index: smstools.spec
===================================================================
RCS file: /cvs/pkgs/rpms/smstools/devel/smstools.spec,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -p -r1.10 -r1.11
--- smstools.spec	7 Oct 2009 15:04:36 -0000	1.10
+++ smstools.spec	30 Oct 2009 20:49:29 -0000	1.11
@@ -1,6 +1,8 @@
+%define _varlogdir      %{_localstatedir}/log/smsd
+
 Name:           smstools
 Version:        3.1.5
-Release:        1%{?dist}
+Release:        4%{?dist}
 Summary:        Tools to send and receive short messages through GSM modems or mobile phones
 
 License:        GPLv2+
@@ -9,6 +11,7 @@ URL:            http://smstools3.kekekas
 Source0:        http://smstools3.kekekasvi.com/packages/smstools3-%{version}.tar.gz
 Source1 :       smsd.init
 Source2:        smsd.logrotate
+Patch0:		smstools3-3.1.5-loglocation.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 Requires(post): /sbin/chkconfig
 Requires(preun): /sbin/chkconfig
@@ -23,6 +26,7 @@ programs for automatic actions. 
 
 %prep
 %setup -q -n smstools3
+%patch0 -p1 -b .loglocation
 mv doc manual
 mv examples/.procmailrc examples/procmailrc
 mv examples/.qmailrc examples/qmailrc
@@ -47,18 +51,33 @@ install -dm 750 $RPM_BUILD_ROOT%{_locals
 install -dm 750 $RPM_BUILD_ROOT%{_localstatedir}/spool/sms/incoming
 install -dm 770 $RPM_BUILD_ROOT%{_localstatedir}/spool/sms/outgoing
 install -dm 750 $RPM_BUILD_ROOT%{_localstatedir}/spool/sms/sent
+mkdir -p ${RPM_BUILD_ROOT}%{_varlogdir}
+mkdir -p ${RPM_BUILD_ROOT}%{_varlogdir}/smsd_stats
+
+# Create ghost files
+for n in smsd.log smsd_trouble.log; do
+    touch ${RPM_BUILD_ROOT}%{_varlogdir}/$n
+done
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
 %pre
 getent group smstools >/dev/null || groupadd -r smstools
+getent passwd smstools >/dev/null || useradd -r -d /var/lib/smstools -m -g smstools -G uucp smstools
 
 %post
 if [ $1 -eq 0 ]; then
         /sbin/chkconfig --add smsd
 fi
 
+# Create initial log files so that logrotate doesn't complain
+for n in smsd.log smsd_trouble.log; do
+        [ -f %{_varlogdir}/$n ] || touch %{_varlogdir}/$n
+        chown smstools:smstools %{_varlogdir}/$n
+        chmod 640 %{_varlogdir}/$n
+done
+
 %preun
 if [ $1 -eq 0 ]; then
         /sbin/service smsd stop >/dev/null 2>&1
@@ -79,16 +98,31 @@ fi
 %{_initrddir}/smsd
 %config(noreplace) %{_sysconfdir}/logrotate.d/smstools
 %config(noreplace) %{_sysconfdir}/smsd.conf
-%dir %{_localstatedir}/spool/sms/
-%dir %{_localstatedir}/spool/sms/checked
-%dir %{_localstatedir}/spool/sms/failed
-%dir %{_localstatedir}/spool/sms/incoming
-%attr(-,root,smstools) %dir %{_localstatedir}/spool/sms/outgoing
-%dir %{_localstatedir}/spool/sms/sent
-
+%attr(-,smstools,smstools) %dir %{_localstatedir}/spool/sms/
+%attr(-,smstools,smstools) %dir %{_localstatedir}/spool/sms/checked
+%attr(-,smstools,smstools) %dir %{_localstatedir}/spool/sms/failed
+%attr(-,smstools,smstools) %dir %{_localstatedir}/spool/sms/incoming
+%attr(-,smstools,smstools) %dir %{_localstatedir}/spool/sms/outgoing
+%attr(-,smstools,smstools) %dir %{_localstatedir}/spool/sms/sent
+%attr(0750,smstools,smstools) %dir %{_varlogdir}
+%attr(0640,smstools,smstools) %ghost %{_varlogdir}/smsd.log
+%attr(0640,smstools,smstools) %ghost %{_varlogdir}/smsd_trouble.log
+%attr(0750,smstools,smstools) %dir %{_varlogdir}/smsd_stats
 
 %changelog
-* Sun Sep 6 2009 Ptrick C. F. Ernzer <smstools.spec at pcfe.net> 3.1.5-1
+* Thu Oct 15 2009 Patrick C. F. Ernzer <smstools.spec at pcfe.net> 3.1.5-4
+- added flag -m to useradd
+
+* Tue Oct 13 2009 Patrick C. F. Ernzer <smstools.spec at pcfe.net> 3.1.5-3
+- after deliberation, decided on having system user (mysql user also has shell, so this should be OK)
+
+* Sun Oct 11 2009 Patrick C. F. Ernzer <smstools.spec at pcfe.net> 3.1.5-2
+- corrected typo in my name in previous changelog entry
+- log files now go to /var/log/smsd (copied that bit from the uucp RPM)
+- creating smstools user if it does not exist
+- will run as user smstools now, did not manage to make it work as system user without login though
+
+* Sun Sep 6 2009 Patrick C. F. Ernzer <smstools.spec at pcfe.net> 3.1.5-1
 - bump to 3.1.5
 - removed perm patch
 - added -D NUMBER_OF_MODEMS=64 to make line




More information about the scm-commits mailing list