delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/09/12/10:08:17

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <3D80A15A.D7D2CF13@pajhome.org.uk>
Date: Thu, 12 Sep 2002 15:14:50 +0100
From: Paul Johnston <paj AT pajhome DOT org DOT uk>
X-Accept-Language: en
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Release candidate 1: /etc/hosts

--------------50E01E77144081DDBE279FD3
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi,

Thanks to Corinna, Joe, Nicholas, Warren and especially Igor, this
script should now be good enough. I've successfully tested it on XP
only.

BTW, this version uses uname to get the OS - the most reliable way.
Also, if for some reason a user wanted to lie to the script, uname would
be the obvious choice without having to read to source.

Paul

--------------50E01E77144081DDBE279FD3
Content-Type: application/x-sh;
 name="make-etc-links.sh"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="make-etc-links.sh"

#!/bin/sh
#--
# Create symbolic links from some /etc files to the Windows equivalents
#--

FILES="hosts protocols services networks"

OSNAME=`/bin/uname -s`
WINHOME=`/bin/cygpath -W`

case "$OSNAME" in
  CYGWIN_NT*) WINETC="$WINHOME/system32/drivers/etc" ;;
  CYGWIN_9*|CYGWIN_ME*) WINETC="$WINHOME" ;;
  *) 
    echo "Unknown system type $OSNAME; exiting" >&2
    exit 0
  ;;
esac

if [ ! -d "$WINETC" ]
then
  echo "Directory $WINETC does not exist; exiting" >&2
  exit 0
fi

for FILE in $FILES
do
  if [ ! -e "/etc/$FILE" ]
  then
    # Windows only uses the first 8 characters
    WFILE=`expr substr "$FILE" 1 8`
    /bin/ln -s -v "$WINETC/$WFILE" "/etc/$FILE"
  fi
done



--------------50E01E77144081DDBE279FD3
Content-Type: text/plain; charset=us-ascii

--
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/
--------------50E01E77144081DDBE279FD3--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019