# Change references to the binary from stunnel to stunnel4
Index: stunnel4/src/stunnel3.in
===================================================================
--- stunnel4.orig/src/stunnel3.in
+++ stunnel4/src/stunnel3.in
@@ -22,7 +22,7 @@
 use Getopt::Std;
 
 # Configuration - path to stunnel (version >=4.05)
-$stunnel_bin='@prefix@/bin/stunnel';
+$stunnel_bin='@prefix@/bin/stunnel4';
 
 # stunnel3 script body begins here
 ($read_fd, $write_fd)=POSIX::pipe();
Index: stunnel4/doc/stunnel.8
===================================================================
--- stunnel4.orig/doc/stunnel.8
+++ stunnel4/doc/stunnel.8
@@ -61,8 +61,8 @@
 .\}
 .\" ========================================================================
 .\"
-.IX Title "STUNNEL 8"
-.TH STUNNEL 8 "2011.08.18" "4.42" "stunnel"
+.IX Title "STUNNEL4 8"
+.TH STUNNEL 8 "2011.08.18" "4.42" "stunnel4"
 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
 .\" way too many mistakes in technical documents.
 .if n .ad l
Index: stunnel4/tools/stunnel.conf-sample.in
===================================================================
--- stunnel4.orig/tools/stunnel.conf-sample.in
+++ stunnel4/tools/stunnel.conf-sample.in
@@ -8,17 +8,17 @@
 
 ; A copy of some devices and system files is needed within the chroot jail
 ; Chroot conflicts with configuration file reload and many other features
-chroot = @localstatedir@/lib/stunnel/
+chroot = @localstatedir@/lib/stunnel4/
 ; Chroot jail can be escaped if setuid option is not used
 setuid = nobody
 setgid = @DEFAULT_GROUP@
 
 ; PID is created inside the chroot jail
-pid = /stunnel.pid
+pid = /stunnel4.pid
 
 ; Debugging stuff (may useful for troubleshooting)
 ;debug = 7
-;output = @localstatedir@/log/stunnel/stunnel.log
+;output = @localstatedir@/log/stunnel4/stunnel.log
 
 ; *****************************************************************************
 ; * Service Defaults (may also be specified in individual service sections)   *
Index: stunnel4/src/Makefile.am
===================================================================
--- stunnel4.orig/src/Makefile.am
+++ stunnel4/src/Makefile.am
@@ -27,7 +27,7 @@
 
 # Additional compiler flags
 
-AM_CPPFLAGS = -DLIBDIR='"$(pkglibdir)"' -DCONFDIR='"$(sysconfdir)/stunnel"' -DPIDFILE='"$(localstatedir)/run/stunnel/stunnel.pid"'
+AM_CPPFLAGS = -DLIBDIR='"$(pkglibdir)"' -DCONFDIR='"$(sysconfdir)/stunnel"' -DPIDFILE='"$(localstatedir)/run/stunnel4.pid"'
 
 # Win32 executable
 
Index: stunnel4/src/Makefile.in
===================================================================
--- stunnel4.orig/src/Makefile.in
+++ stunnel4/src/Makefile.in
@@ -254,7 +254,7 @@
 INCLUDES = -I/usr/kerberos/include
 
 # Additional compiler flags
-AM_CPPFLAGS = -DLIBDIR='"$(pkglibdir)"' -DCONFDIR='"$(sysconfdir)/stunnel"' -DPIDFILE='"$(localstatedir)/run/stunnel/stunnel.pid"'
+AM_CPPFLAGS = -DLIBDIR='"$(pkglibdir)"' -DCONFDIR='"$(sysconfdir)/stunnel"' -DPIDFILE='"$(localstatedir)/run/stunnel4.pid"'
 
 # Win32 executable
 EXTRA_DIST = stunnel.exe make.bat mingw.mak makece.bat evc.mak vc.mak makew32.bat nogui.c os2.mak
Index: stunnel4/doc/stunnel.pl.8
===================================================================
--- stunnel4.orig/doc/stunnel.pl.8
+++ stunnel4/doc/stunnel.pl.8
@@ -61,8 +61,8 @@
 .\}
 .\" ========================================================================
 .\"
-.IX Title "STUNNEL.PL 8"
-.TH STUNNEL.PL 8 "2011.08.18" "4.42" "stunnel"
+.IX Title "STUNNEL4.PL 8"
+.TH STUNNEL.PL 8 "2011.08.18" "4.42" "stunnel4"
 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
 .\" way too many mistakes in technical documents.
 .if n .ad l
Index: stunnel4/doc/stunnel.fr.8
===================================================================
--- stunnel4.orig/doc/stunnel.fr.8
+++ stunnel4/doc/stunnel.fr.8
@@ -61,8 +61,8 @@
 .\}
 .\" ========================================================================
 .\"
-.IX Title "STUNNEL.FR 8"
-.TH STUNNEL.FR 8 "2011.08.18" "4.42" "stunnel"
+.IX Title "STUNNEL4.FR 8"
+.TH STUNNEL.FR 8 "2011.08.18" "4.42" "stunnel4"
 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
 .\" way too many mistakes in technical documents.
 .if n .ad l
Index: stunnel4/tools/stunnel.init.in
===================================================================
--- stunnel4.orig/tools/stunnel.init.in
+++ stunnel4/tools/stunnel.init.in
@@ -1,6 +1,6 @@
 #! /bin/sh -e
 ### BEGIN INIT INFO
-# Provides:          stunnel
+# Provides:          stunnel4
 # Required-Start:    $local_fs $remote_fs
 # Required-Stop:     $local_fs $remote_fs
 # Should-Start:      $syslog
@@ -10,8 +10,8 @@
 # Short-Description: Start or stop stunnel 4.x (SSL tunnel for network daemons)
 ### END INIT INFO
 
-DEFAULTPIDFILE="/var/run/stunnel.pid"
-DAEMON=@prefix@/bin/stunnel
+DEFAULTPIDFILE="/var/run/stunnel4.pid"
+DAEMON=@prefix@/bin/stunnel4
 NAME=stunnel
 DESC="SSL tunnels"
 FILES="/etc/stunnel/*.conf"
@@ -33,9 +33,9 @@
 }
 
 startdaemons() {
-  if ! [ -d /var/run/stunnel ]; then
-    rm -rf /var/run/stunnel
-    install -d -o stunnel -g stunnel /var/run/stunnel
+  if ! [ -d /var/run/stunnel4 ]; then
+    rm -rf /var/run/stunnel4
+    install -d -o stunnel4 -g stunnel4 /var/run/stunnel4
   fi
   for file in $FILES; do 
     if test -f $file; then
@@ -70,9 +70,9 @@
   OPTIONS="-- $OPTIONS"
 fi
 
-test -f /etc/default/stunnel && . /etc/default/stunnel
+test -f /etc/default/stunnel4 && . /etc/default/stunnel4
 if [ "$ENABLED" = "0" ] ; then
-  echo "$DESC disabled, see /etc/default/stunnel"
+  echo "$DESC disabled, see /etc/default/stunnel4"
   exit 0
 fi
 
