jhogarth pushed to sslh (el6). "Make changes required of spec fo el6 and fix libconfig issue on el6"

notifications at fedoraproject.org notifications at fedoraproject.org
Fri Apr 17 23:28:29 UTC 2015


>From 36cda77df7450fc6d25c706098befeb5fd025fa5 Mon Sep 17 00:00:00 2001
From: James Hogarth <james.hogarth at gmail.com>
Date: Sat, 18 Apr 2015 00:28:12 +0100
Subject: Make changes required of spec fo el6 and fix libconfig issue on el6


diff --git a/patch-el6.patch b/patch-el6.patch
new file mode 100644
index 0000000..77f5641
--- /dev/null
+++ b/patch-el6.patch
@@ -0,0 +1,29 @@
+diff --git a/scripts/etc.rc.d.init.d.sslh.centos b/scripts/etc.rc.d.init.d.sslh.centos
+index 6549545..934e32d 100755
+--- a/scripts/etc.rc.d.init.d.sslh.centos
++++ b/scripts/etc.rc.d.init.d.sslh.centos
+@@ -23,7 +23,7 @@ if [ -f /etc/sysconfig/sslh ]; then
+ fi
+ 
+ PROGNAME=sslh
+-SSLH=${SSLH:-/usr/sbin/sslh-select}
++SSLH=${SSLH:-/usr/sbin/sslh}
+ SSLH_LANG=${SSLH_LANG:-C}
+ CONFIG=${CONFIG:-/etc/sslh.cfg}
+ PIDFILE=${PIDFILE:-/var/run/sslh/sslh.pid}
+diff --git a/sslh-main.c b/sslh-main.c
+index 9cc8a06..607b44f 100644
+--- a/sslh-main.c
++++ b/sslh-main.c
+@@ -280,7 +280,10 @@ static int config_parse(char *filename, struct addrinfo **listen, struct proto *
+ 
+     config_init(&config);
+     if (config_read_file(&config, filename) == CONFIG_FALSE) {
+-        if (config_error_type(&config) == CONFIG_ERR_PARSE) {
++/* If it's a parse error then there will be a line number for the failure
++ * an I/O error (such as non-existent file) will have the error line as 0
++ */
++        if (config_error_line(&config) != 0) {
+             fprintf(stderr, "%s:%d:%s\n", 
+                     filename,
+                     config_error_line(&config),
diff --git a/patch0-sslh-sensible-fedora-defaults.patch b/patch0-sslh-sensible-fedora-defaults.patch
deleted file mode 100644
index 3f1115f..0000000
--- a/patch0-sslh-sensible-fedora-defaults.patch
+++ /dev/null
@@ -1,64 +0,0 @@
-diff --git a/basic.cfg b/basic.cfg
-index 526ffbf..fb274e2 100644
---- a/basic.cfg
-+++ b/basic.cfg
-@@ -2,13 +2,12 @@
- # sensible values for "standard" setup.
- 
- verbose: false;
--foreground: false;
-+foreground: true;
- inetd: false;
- numeric: false;
- transparent: false;
- timeout: "2";
--user: "nobody";
--pidfile: "/var/run/sslh.pid";
-+user: "sslh";
- 
- 
- # Change hostname with your external address name.
-diff --git a/scripts/systemd.sslh.service b/scripts/systemd.sslh.service
-index c2a69fd..c25f09e 100644
---- a/scripts/systemd.sslh.service
-+++ b/scripts/systemd.sslh.service
-@@ -1,11 +1,17 @@
- [Unit]
- Description=SSL/SSH multiplexer
-+Documentation=man:sslh(8)
- After=network.target
- 
- [Service]
--EnvironmentFile=/etc/conf.d/sslh
--ExecStart=/usr/bin/sslh --foreground $DAEMON_OPTS
-+EnvironmentFile=-/etc/sysconfig/sslh
-+ExecStart=/usr/sbin/sslh -F /etc/sslh.cfg ${DAEMON_OPTS}
- KillMode=process
-+CapabilityBoundingSet=CAP_NET_BIND_SERVICE CAP_NET_ADMIN CAP_SETGID CAP_SETUID
-+PrivateTmp=true
-+PrivateDevices=true
-+ProtectSystem=full
-+ProtectHome=true
- 
- [Install]
- WantedBy=multi-user.target
-diff --git a/sslh.pod b/sslh.pod
-index c0ce606..b4446b2 100644
---- a/sslh.pod
-+++ b/sslh.pod
-@@ -214,12 +214,11 @@ personality disorder).
- 
- =over 4
- 
--=item F</etc/init.d/sslh>
-+=item F</usr/lib/systemd/system/sslh.service>
- 
--Start-up script. The standard actions B<start>, B<stop> and
--B<restart> are supported.
-+Systemd unit to control the daemon.
- 
--=item F</etc/default/sslh>
-+=item F</etc/sysconfig/sslh>
- 
- Server configuration. These are environment variables
- loaded by the start-up script and passed to B<sslh> as
diff --git a/sslh.spec b/sslh.spec
index f755e33..5a2061d 100644
--- a/sslh.spec
+++ b/sslh.spec
@@ -1,4 +1,6 @@
 %global _hardened_build 1
+# Define pkgdocdir for releases that don't define it already
+%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}}
 
 Name:    sslh
 Version: 1.17
@@ -7,17 +9,16 @@ Summary: Applicative protocol(SSL/SSH) multiplexer
 License: GPLv2
 URL:     http://www.rutschle.net/tech/sslh.shtml
 Source0: http://www.rutschle.net/tech/%{name}-v%{version}.tar.gz
-Patch0:  patch0-sslh-sensible-fedora-defaults.patch
+Patch: patch-el6.patch
 
 BuildRequires: libconfig-devel
 BuildRequires: libcap-devel
 BuildRequires: tcp_wrappers-devel
-BuildRequires: systemd
 
 Requires(pre):    shadow-utils
-Requires(post):   systemd
-Requires(preun):  systemd
-Requires(postun): systemd
+Requires(post): chkconfig
+Requires(preun): chkconfig
+Requires(preun): initscripts
 
 %description
 sslh accepts connections on specified ports, and forwards them further
@@ -36,7 +37,7 @@ comes from its original function to serve SSH and HTTPS on the same port.
 
 %prep
 %setup -q -n %{name}-v%{version}
-%patch0 -p1
+%patch -p1
 
 %build
 ./genver.sh >version.h
@@ -52,13 +53,13 @@ mkdir -p %{buildroot}%{_sysconfdir}
 mkdir -p %{buildroot}%{_pkgdocdir}
 mkdir -p %{buildroot}%{_mandir}/man8
 mkdir -p %{buildroot}%{_unitdir}
+mkdir -p %{buildroot}%{_initddir}
 cp -p %{name}-fork %{buildroot}%{_sbindir}/%{name}
 cp -p %{name}-select %{buildroot}%{_sbindir}/%{name}-select
 cp -p basic.cfg %{buildroot}/etc/%{name}.cfg
 cp -p {README.md,COPYING,ChangeLog} %{buildroot}%{_pkgdocdir}/
 cp -p %{name}.8 %{buildroot}%{_mandir}/man8/
-cp -p scripts/systemd.sslh.service %{buildroot}%{_unitdir}/%{name}.service
-
+cp -p scripts/etc.rc.d.init.d.sslh.centos %{buildroot}%{_initddir}/sslh
 
 %pre
 getent group %{name} >/dev/null || groupadd -r %{name}
@@ -68,23 +69,28 @@ getent passwd %{name} >/dev/null || \
 exit 0
 
 %post
-%systemd_post sslh.service
+/sbin/chkconfig --add %{name}
 
 %preun
-%systemd_preun sslh.service
+if [ $1 -eq 0 ] ; then
+    /sbin/service %{name} stop >/dev/null 2>&1
+    /sbin/chkconfig --del %{name}
+fi
 
 %postun
-%systemd_postun_with_restart sslh.service 
+if [ "$1" -ge "1" ] ; then
+    /sbin/service %{name} condrestart >/dev/null 2>&1 || :
+fi
 
 %files
 %dir %{_pkgdocdir}
 %doc %{_pkgdocdir}/README.md
-%license %{_pkgdocdir}/COPYING
+%doc %{_pkgdocdir}/COPYING
 %doc %{_pkgdocdir}/ChangeLog
 %doc %{_mandir}/man8/%{name}.8*
 %attr(0755,root,root) %{_sbindir}/%{name}
 %attr(0755,root,root) %{_sbindir}/%{name}-select
-%{_unitdir}/%{name}.service
+%attr(0755,root,root) %{_initddir}/sslh
 %config(noreplace) %attr(0644,root,root) %{_sysconfdir}/%{name}.cfg
 
 
-- 
cgit v0.10.2


	http://pkgs.fedoraproject.org/cgit/sslh.git/commit/?h=el6&id=36cda77df7450fc6d25c706098befeb5fd025fa5


More information about the scm-commits mailing list