This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch for Bug in /etc/profile script ....


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]