[PATCH 1/2] Copy setup.exe to /bin/cygwin-setup.exe
Corinna Vinschen
corinna-cygwin@cygwin.com
Thu Feb 3 10:31:00 GMT 2011
On Feb 2 23:24, Jon TURNEY wrote:
> Make a copy of setup.exe as /bin/cygwin-setup.exe.
>
> This enables a few useful things:
> - Register that copy of setup.exe with Add/Remove programs
While that sounds nice, doesn't that introduce more puzzled questions?
I can easily imagine people thinking they can remove the entire Cygwin
distro by removing setup.exe via Ad//Remove programs.
> - Add a start menu item pointing to that copy of setup.exe
> - Type 'cygwin-setup -q -P<package>' to install a package
Nice idea, but here's another problem lurking, UAC. If you try to start
cygwin-setup as a admin user from a non-elevated shell, you'll get a
puzzeling error message, because there's the word "setup" in the
application name.
The reason: With UAC default settings, Windows will try to start the
application as an installer with admin permissions, and that's not
possible from a non-elevated shell. It will trying to do so with
every binary containing one of the words "instal", "setup", "patch",
or "update".
The workaround is to add a side-by-side manifest file, just as, for
instance, the "install.exe" binary.
> Questions:
>
> Would setup.exe be a better choice of name?
cygwin-setup is as good a name as setup, IMHO.
> Does Add/Remove item for cygwin behave at all sensibly with multiple
> cygwin installations?
Good question. Didn't you try?
> static void
> +copy_setup(void)
> +{
> + setupname = backslash (cygpath ("/bin/cygwin-setup.exe"));
> +
> + /*
> + Copy this executable to the cygwin bin directory
> + (this might fail we are already running from there... :-))
> + */
> + TCHAR filename[MAX_PATH+1];
> + GetModuleFileName(NULL, filename, MAX_PATH);
> + CopyFile(filename, setupname.c_str(), FALSE);
Please set 0755 permissions after copying, provided the CopyFile
didn't return an error.
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat
More information about the Cygwin-apps
mailing list