Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com From: "John Morrison" To: Subject: RE: Patch for Bug in /etc/profile script .... Date: Mon, 23 Jun 2003 10:55:02 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Importance: Normal > From: Alan Miles > > 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 Thank you. I didn't know about the /usr/bin/install program. I'm in the process of updating the base- packages (slowly :( I'll do this mod then. Thanks again, J. -- 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/