delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/06/23/05:35:45

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
Reply-To: <alan DOT miles AT ieee DOT org>
From: "Alan Miles" <miles0201 AT cox DOT net>
To: <cygwin AT cygwin DOT com>
Cc: "Alan Miles" <Alan DOT Miles AT firstdatacorp DOT com>
Subject: Patch for Bug in /etc/profile script ....
Date: Mon, 23 Jun 2003 04:12:21 -0500
Message-ID: <JLEBIHHBMBHBAFPAJLEFCEGDDNAA.miles0201@cox.net>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
Importance: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165

All,

I have a file called /etc/skel/a/b/c/d.txt, /etc/skel/e/f.txt

Under Linux (and I certainly believe the same is true for UNIX), anything,
directory(s), file(s) etc put in /etc/skel
gets put into the user's home directory when the sys admin creates the
account and its home directory.

However, that is not happening here.

What is happening here in these two examples is that it is trying to copy
the file:

cp /etc/skel/a/b/c/d.txt /home/user1/a/b/c/d.txt
cp /etc/skel/e/f.txt     /home/user1/e/f.txt

Now this ** would ** work if the directories /home/user1/a/b/c/, and
/home/user1/e had already existed. However, they don't since the system
is creating the home directory. Hence the copy fails.

I am submitting this patch which corrects the problem. the key is the -D
flag on the install command - it causes the system to create any missing
leading directories, as well as doing the install.

$ diff -u /etc/profile.old profile
--- /etc/profile.old    2003-06-14 10:03:21.000000000 -0500
+++ profile     2003-06-23 04:01:00.000000000 -0500
@@ -32,7 +32,7 @@
   for f in `/bin/find . -type f`; do
     fDest=`echo $f | sed -e 's/^\.//g'`
     if [ ! -e "$HOME$fDest" -a ! -L "$HOME$fDest" ]; then
-      cp "$f" "$HOME/$fDest"
+      /usr/bin/install -D -p -v "${f}" "${HOME}/${fDest}"
     fi
   done
 fi
_________________________________________
Alan Miles
ICQ#: 171006836
More ways to contact me: http://wwp.icq.com/171006836
_________________________________________



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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