[PATCH] Update Cygwin service installer script for new Cygwin release

Corinna Vinschen vinschen at redhat.com
Thu Jan 29 21:06:31 EST 2009


On Jan 28 12:51, Tim Rice wrote:
> On Wed, 28 Jan 2009, Corinna Vinschen wrote:
> 
> > Hi,
> > 
> > the below patch is necessary for the contrib/cygwin/ssh-host-config script
> > to work on Cygwin 1.5.x as well as on the new Cygwin 1.7.x.  The information
> > given for the setting of the CYGWIN environment variable is wrong for both
> > releases so I just removed it, together with the unnecessary (Cygwin 1.5.x)
> > or wrong (Cygwin 1.7.x) default setting.
> > 
> > Could somebody with checkin rights please apply this patch?
> 
> Done.

Thank you.

I have a follow up patch.  If the CYGWIN environment variable is empty,
the installer script should not install the service with an empty CYGWIN
variable, but rather without setting CYGWNI entirely.  That's what the
below patch does.  Would you mind to apply it as well?


Thank you,
Corinna


Index: contrib/cygwin/ssh-host-config
===================================================================
RCS file: /cvs/openssh/contrib/cygwin/ssh-host-config,v
retrieving revision 1.24
diff -u -p -r1.24 ssh-host-config
--- contrib/cygwin/ssh-host-config	28 Jan 2009 20:50:05 -0000	1.24
+++ contrib/cygwin/ssh-host-config	29 Jan 2009 10:05:03 -0000
@@ -313,11 +313,15 @@ install_service() {
         # the two cases.
 
         csih_check_user "${run_service_as}"
-
+	
+	if [ -n "${csih_cygenv}" ]
+	then
+	  cygwin_env="-e CYGWIN=\"${csih_cygenv}\""
+	fi
         if [ -z "${password}" ]
         then
-	  if cygrunsrv -I sshd -d "CYGWIN sshd" -p /usr/sbin/sshd -a "-D" -y tcpip \
-             -e CYGWIN="${csih_cygenv}"
+	  if eval cygrunsrv -I sshd -d \"CYGWIN sshd\" -p /usr/sbin/sshd \
+			    -a "-D" -y tcpip ${cygwin_env}
           then
             echo
             csih_inform "The sshd service has been installed under the LocalSystem"
@@ -326,8 +330,9 @@ install_service() {
             csih_inform "will start automatically after the next reboot."
           fi
         else
-	  if cygrunsrv -I sshd -d "CYGWIN sshd" -p /usr/sbin/sshd -a "-D" -y tcpip \
-             -e CYGWIN="${csih_cygenv}" -u "${run_service_as}" -w "${password}"
+	  if eval cygrunsrv -I sshd -d \"CYGWIN sshd\" -p /usr/sbin/sshd \
+			    -a "-D" -y tcpip ${cygwin_env} \
+			    -u "${run_service_as}" -w "${password}"
           then
 	    echo
 	    csih_inform "The sshd service has been installed under the '${run_service_as}'"

-- 
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat


More information about the openssh-unix-dev mailing list