Beginnings of a patch: /etc/hosts

Igor Pechtchanski pechtcha@cs.nyu.edu
Tue Sep 10 13:36:00 GMT 2002


On Tue, 10 Sep 2002, Paul Johnston wrote:

> (back in main cygwin list as Robert pointed out this is not a setup
> change)
>
> Hi,
>
> I've created an NT-only postinstall script that should be suitible. I
> suggest it's called /etc/postinstall/make-etc-links.sh I don't have
> access to a Win 9x machine right now - if someone else could do this
> bit, that would be great; alternatively I will be able to do it in the
> next week or so.
>
> Paul
>
>
> #!/bin/sh
> #--
> # Creates symbolic links from some /etc files to their windows
> equivalents
> #--
> VERBOSE=-v
>
> if [ "$OS" = "Windows_NT" ]
> then
>   WINETC=`/bin/cygpath $SYSTEMROOT`/system32/drivers/etc
>   FILES="hosts protocol services"
> fi
>
> for FILE in $FILES
> do
>   if [ ! -e /etc/$FILE ]
>   then
>     /bin/ln -s $VERBOSE ${WINETC}/$FILE /etc/$FILE
>   fi
> done
>
> > NT has an equivalent to /etc/hosts, so I think the cygwin install should
> > create this symbolic link:
> >
> > /etc/hosts -> ${SYSTEMROOT}/system32/drivers/etc/hosts

9x systems also have these files, they should reside in ${WINBOOTDIR}.
You also omitted a file called 'networks'.

Attached are a new version of your script, as well as a diff with your
original version.

Note also that the links should probably use proper case for the path and
filenames, in case someone has CYGWIN=*check_case:strict*.  I'm not sure
how to do this properly (use [cmd /c "dir /b "`cygpath -w $file`], maybe?)
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

It took the computational power of three Commodore 64s to fly to the moon.
It takes a 486 to run Windows 95.  Something is wrong here. -- SC sig file
-------------- next part --------------
--- make-etc-links.sh-orig	2002-09-10 15:39:42.000000000 -0400
+++ make-etc-links.sh	2002-09-10 15:39:37.000000000 -0400
@@ -4,11 +4,14 @@
 #--
 VERBOSE=-v
 
-if [ "$OS" = "Windows_NT" ]
-then
-  WINETC=`/bin/cygpath $SYSTEMROOT`/system32/drivers/etc
-  FILES="hosts protocol services"
-fi
+OSNAME=`/bin/uname -s`
+
+case "$OSNAME" in
+   CYGWIN_NT*) WINETC=`/bin/cygpath $SYSTEMROOT`/system32/drivers/etc ;;
+   CYGWIN_9*) WINETC=`/bin/cygpath $WINBOOTDIR` ;;
+   *) echo "Unknown system type $OSNAME; exiting" >&2; exit 1 ;;
+esac
+FILES="hosts protocol services networks"
 
 for FILE in $FILES
 do
-------------- next part --------------
#!/bin/sh
#--
# Creates symbolic links from some /etc files to their windows equivalents
#--
VERBOSE=-v

OSNAME=`/bin/uname -s`

case "$OSNAME" in
   CYGWIN_NT*) WINETC=`/bin/cygpath $SYSTEMROOT`/system32/drivers/etc ;;
   CYGWIN_9*) WINETC=`/bin/cygpath $WINBOOTDIR` ;;
   *) echo "Unknown system type $OSNAME; exiting" >&2; exit 1 ;;
esac
FILES="hosts protocol services networks"

for FILE in $FILES
do
  if [ ! -e /etc/$FILE ]
  then
    /bin/ln -s $VERBOSE ${WINETC}/$FILE /etc/$FILE
  fi
done

-------------- next part --------------
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


More information about the Cygwin mailing list