Subject: Re: chown, #!command in scripts, auto-execute (.bat), etc
From: Larry Hall <[email-masked]>
To: Andreas <[email-masked]>, Cygwin List <[email-masked]>
Cc: [email-masked]
Date: Fri, 09 Apr 2004 18:08:26 -0400

At 01:19 PM 4/7/2004, you wrote:

>Larry Hall wrote:
>
>>At 12:51 PM 3/25/2004, you wrote:
>> 
>>
>>>Hallo!
>>>I'm using CYGWIN_NT-5.1 (cygcheck.out attached)
>>>*I installed Cygwin in a Subdir /cygdrive/d/temp/Cyg/, because here we don't have permissions for /. So I want to chroot to that installation-directory, for getting the programs working properly.
>>>chroot $InstallROOT $InstallROOT/usr/bin/bash
>>>-->> "chroot: cannot chdir to root directory: No such file or directory"
>>>At home I did the same, ADDITIONALLY having /usr/bin/bash, but I get the same errors.
>>>   
>>This makes perfect sense to me, given your cygcheck output.  I'll give you
>>a hint as to why this makes sense to me.  What is "$InstallROOT" set to?
>>
>> 
>Hallo!
>Content of $InstallROOT is in the comment (see lines below!), but that seems to be unimportant,
>perhaps the following lines are more important than cygout.txt?! ;-)

OK, so can you get there explicitly?

>I unpacked all to a directory (Temp), where we have write-permissions.

What do you mean "unpacked"?  Do you mean that you installed, using 
setup.exe, in your "Temp" directory or did you do something else?

>So "my (imaginary) Root" is that directory, and I want to chroot to that directory, which doesn't work. (chroot instead of mounting /)

If you installed with setup.exe, '/' is already mounted there.

>Is mount D:/Temp /Xyz   the same as      mount /cygwin/d /Xyz ?

No.  'mount /cygdrive/d/Temp /Xyz' would be the same but that would 
imple '/' and '/Xyz' are the same, which doesn't seem necessary.

>Why is /cygwin not named /mnt? - Why is it not possible to mount other things into /cygwin?

Do you mean '/cygdrive'?  Name it whatever you like (see 'man mount').
'/cygdrive' is a virtual file system used to map DOS drives into the POSIX
space.

>Or is /cygwin the (source-) "device" ?
>
>>>chroot $InstallROOT; doesn't work  # InstallROOT=/cygdrive/d/Temp/Cyg
>>>Also cd /; chroot .    # doesn't work
>>>chroot /;    # works, but worthless
>>>
>>>* mount works, whereas I can't alter anything (umount, mounting others doens't work)
>>> -->> umount: /cygdrive/H: Permission denied
>>>mkdir X; mount /dev/hda1 X   -->> mount: X: Invalid argument
>>> which devices are to be used? (As /dev/null nothing exists, but works)
>>>   
>>I think you don't understand what mount does in Cygwin.  Read 'man mount'
>>and <http://cygwin.com/cygwin-ug-net/using-utils.html#MOUNT>.
>> 
>I read it, but it doesnt work as expected:
>mkdir $HOME/L; mount -u D:/ $HOME/L
>-->mount: /cygdrive/d/temp/Cyg/home//L: Invalid argument

Your example works for me.

>>>* Why doesn't work #!bash ? On other systems it's enough to let it find by the $PATH.
>>>   
>>And what's in your path?  Would you be able to find bash in it's installed
>>location using only your currently defined path as a guide?
>$InstallROOT/usr/bin is in my PATH. Typing bash (or any other command) (in the Home-dir) works!
>The problem is that under cygwin the path is not searched for any #!Commands (try out yourself!)

I did.  Works fine.

>>>Extension .bat is executed by command.com, if no extension, I would like to be able to leave the #!command out!
>>Sorry, I'm not sure what you're driving at with this statement, unless it
>>was just meant to clarify that you cannot run 'bash' without specifying
>>the full path to it.
>> 
>I'm speaking about the extension. Is it possible to execute any script (without known extension) using bash.exe,
>WITHOUT having to write #!bash.exe in the first line?! (Because otherwise it is executed by command.com)

Sure.

>What does mount -x/-X/-E do in detail? (any files being interpreted as binary, regardless their permissions?)
>-o Option (-o managed) doesn't work?

Look at the Users Guide.

--
Larry Hall                              http://www.rfk.com
RFK Partners, Inc.                      (508) 893-9779 - RFK Office
838 Washington Street                   (508) 893-9889 - FAX
Holliston, MA 01746                     

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