delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/09/13/09:52:42

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: <3D81C757.49B19C45@pajhome.org.uk>
Date: Fri, 13 Sep 2002 12:09:11 +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 2: /etc/hosts
References: <Pine DOT GSO DOT 4 DOT 44 DOT 0209122307360 DOT 19696-300000 AT slinky DOT cs DOT nyu DOT edu>

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

Hi,

> > 1) the '-l' option of cygpath works in the cvs HEAD, and
> > 2) it does exactly what we need (thanks, Corinna).

Cool... I've just modified your code to correct case on $WINETC before we do the
directory check. This has the side-effect of catching the cygpath bug without
creating any links.

As for the script name, given the scope of /etc/postinstall I think it should
contain the package name. Someone suggested mketc.sh and that's fairly
consistent with the old-skool MKDEV script. So I think it should be called
cygwin-mketc.sh.

How come your script works when cygpath is called inside $(...) but not
backticks?

Paul

--------------4EE7B0442CFF79F7508FC6FD
Content-Type: application/x-sh;
 name="cygwin-mketc.sh"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="cygwin-mketc.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

WINETC="$(/bin/cygpath -u "$(/bin/cygpath -w -l "$WINETC")")"
if [ ! -d "$WINETC" ]
then
  echo "Directory $WINETC does not exist; exiting" >&2
  echo "If directory name is garbage, update cygpath to 1.22 or later" >&2
  exit 0
fi

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



--------------4EE7B0442CFF79F7508FC6FD
Content-Type: text/plain; charset=us-ascii;
 name="cygwin-mketc.sh-0.9.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="cygwin-mketc.sh-0.9.diff"

19a20
> WINETC="$(/bin/cygpath -u "$(/bin/cygpath -w -l "$WINETC")")"
22a24
>   echo "If directory name is garbage, update cygpath to 1.22 or later" >&2
32c34
<     WFILE="$(cygpath -u "$(cygpath -w -l "$WFILE")")"
---
>     WFILE="$(/bin/cygpath -u "$(/bin/cygpath -w -l "$WFILE")")"


--------------4EE7B0442CFF79F7508FC6FD
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/
--------------4EE7B0442CFF79F7508FC6FD--

- Raw text -


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