another stupid question ...
... since here are so many so intelligent people ;-)
On unix I can remove the current interpreter, ie I can do
#!/usr/bin/perl
unlink("/usr/bin/perl");
and this will succeed (if I have permissions).
On windows (again) this doesn't work. I am running the uninstall program
which is a texlua script but the rmdir /q ... of bin/win32 does not
succeed.
The texlua script is invoked via usual win32 methods, i.e. the extension
.texlua is linked to the texlua interpreter, and the .texlua extension
is added to the PATHEXT to be searched, and bin/win32 is in the PATH env
var.
Well, in the worst case we have to live with a rogue texlua.exe
somewhere.
Any other ideas?
Best wishes
Norbert
-------------------------------------------------------------------------------
Dr. Norbert Preining
On Thu, Apr 3, 2008 at 12:58 PM, Norbert Preining
On unix I can remove the current interpreter, ie I can do #!/usr/bin/perl unlink("/usr/bin/perl"); and this will succeed (if I have permissions).
On UNIX you can unlink a file while some processes (possibly the same process) has that file open. Reads, writes, &c. continue to work, except the file is no longer in the directory tree. The file's inode is only deleted when all processes close their handles to it. Other systems don't have that property—deleting an in-use file may fail (under Windows) or leave the running process in some broken state (probably some OS operates that way). On the other hand, various programs' uninstall scripts successfully delete the entire directory tree, including the uninstaller. Don't know how they do it. Hope that helped some, --Joel
On the other hand, various programs' uninstall scripts successfully delete the entire directory tree, including the uninstaller. Don't know how they do it.
The uninstaller is an msiexec.exe script. The (un)installer in an integral part of the os. So the problem doesn't happen. In the old days, InstallShield offered a ugly trick to do what Norbert wants. Simply use luatex to write a .bat file doing a loop to remove your luatex.exe and itself. Launch the bat file from luatex (cmd /c foo.bat) and quit luatex. Ok, it is ugly. You also have the option to set the file to be removed after the next reboot (dlls, com components and so). And let the user reboot to finish the cleanup. You won't escape the fact that under Windows, any file that for which an open handle exists can't be deleted. Installation is a native service under Windows. You may want to play your own game, but expect annoyances. Regards, Fabrice
Fabrice Popineau writes:
The uninstaller is an msiexec.exe script. The (un)installer in an integral part of the os.
Hi Fabrice, I think that if a particular OS provides such a facility it probably makes sense to use it. What I don't know is how to tell the uninstaller *what* should be removed. I recently found a file on my Windows machine at work which looked like something exported from the registry but contained a list of all files installed. I thought that this file had been created by the installer and could be used to uninstall the program. However, I do not find this file again. Maybe I deleted it already. On Friday I tried to find out how Windows removes software packages. My first attempt was to run control panel -> software. You get a list of software packages installed, all accompanied by a "delete" button. I then looked into the packages and saw that they often provide a file uninstall.exe. Fabrice, you are using SVN and maybe you have TortoiseSVN installed. If true, we have the same environment. Windows offers me to uninstall TortoiseSVN. In the %ProgramFiles%/TortoiseSVN directory I don't see anything which looks like an uninstaller. And there is nothing which looks likes a list of files to be removed. If Windows is able to remove TortoiseSVN then there must be instructions *what* to remove somewhere. I exported the registry and searched for TortoiseSVN. Nothing found. Fabrice, can you enlighten me? Is it possible to create a list of files which should be deleted and instruct Windows to delete all files mentioned in this list? Regards, Reinhard -- ---------------------------------------------------------------------------- Reinhard Kotucha Phone: +49-511-3373112 Marschnerstr. 25 D-30167 Hannover mailto:reinhard.kotucha@web.de ---------------------------------------------------------------------------- Microsoft isn't the answer. Microsoft is the question, and the answer is NO. ----------------------------------------------------------------------------
Norbert Preining wrote:
.... since here are so many so intelligent people ;-)
On unix I can remove the current interpreter, ie I can do #!/usr/bin/perl unlink("/usr/bin/perl"); and this will succeed (if I have permissions).
On windows (again) this doesn't work. I am running the uninstall program which is a texlua script but the rmdir /q ... of bin/win32 does not succeed.
The texlua script is invoked via usual win32 methods, i.e. the extension ..texlua is linked to the texlua interpreter, and the .texlua extension is added to the PATHEXT to be searched, and bin/win32 is in the PATH env var.
Well, in the worst case we have to live with a rogue texlua.exe somewhere.
Any other ideas?
just do it in the calling script, say remover.bat: texlua remover.lua del /q texlua.exe remover.bat ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
participants (5)
-
Fabrice Popineau
-
Hans Hagen
-
Joel C. Salomon
-
Norbert Preining
-
Reinhard Kotucha