Archive: Installer log


Installer log
I am looking for ways to make a log and
uninstall from it. So far I have found a
way based on this Script by Afrow Uk.

I need to understand how to get a few
things to work by log automatically.

1. Uninstall folders that were created.

It doesn't seem to do it. Altho I can do
it by writting it in the Uninstaller section.

Attached is the Script I have put together.

If you know of better ways to do log
installations please let me know !!!

-MichaelFlya-


You probably missed this bit at the top:

Note: ${SetOutPath} must be used in reverse order of the directory tree, for example:
${SetOutPath} "$INSTDIR\dir\subdir\anotherdir"
...
${SetOutPath} "$INSTDIR\dir\subdir"
...
${SetOutPath} "$INSTDIR\dir"
...
...else directories will not be removed on uninstall.
It won't delete the folders if they aren't empty.
If you're really lazy then just change
RMDir $R0 #is dir
to
RMDir /r $R0 #is dir

Edit: I changed it to use RMDir /r now. I think that otherwise people will just get annoyed.

-Stu

Well I understand that, but the Log puts
directories before the file deletions.

In that Script it only installs for example
INSTALLERDIR1 with files in it. There is no
Subfolders. I can't move SetOutPath there
is no point in it. So it just doesn't write the
log right. It should write The log to where
the directories are after the files not before.

-MichaelFlya-


Could you show me the code?

-Stu


Well I have no idea why you couldn't
see the attachment on the first post,
but here you go I will attach it again.

And since I am posting again I will just
explain a few more questions I had on
the to do list. If you can help me out.

2.
How could I make a log for a zip ? I have
installations from sites that use zips and
sometimes the contents may change and
in order for me to uninstall them properly
I would need a log of what was unzipped.

3.
How would I use it with *.* so all contents
in the folder would be on log ?

4.
How could shortcuts also be logged ?

5.
How can Registry Keys be logged ?

6.
How can anything else besides folders and
files be logged ? .. lol.


-MichaelFlya-


The thing I need to log the most at the moment
is a compressed zip folder. Is there a way to log
a Zip while you extract it? That way I can remove
only what was unzipped.

-MichaelFlya-


I found a DLL that allows me to do some things.
I am wondering if it's uses can be expanding on.

(NsisLog.dll)
Here is two links where you can find out about it:
1.Nsislog About DLL
2.Nsislog Download DLL



Using this code with Afrow UK's code.
(Not that it is needed to use together):


Section -closelogfile
FileClose $UninstLog
nsislog::log "$INSTDIR\uninstall.log" "$INSTDIR\INSTALLERDIR1"
nsislog::log "$INSTDIR\uninstall.log" "$INSTDIR\INSTALLERDIR2"
SetFileAttributes "$INSTDIR\${UninstLog}" READONLY|SYSTEM
SectionEnd


Only place it can go because the NsisLog.dll can't write to the
file until the file is closed from Afrow UK's process and it has
to go right before the SetFileAttributes are set to read only.

Also on another note I can get that same effect to work right
with Afrow Uk's code and properly too if I do, for Example
change the code for "INSTALLERDIR1" like this:


(From the script I attached on a post above)


Section "Install Main"
${SetOutPath} "$INSTDIR\INSTALLERDIR1"
${File} ".\dir1\" "Doc1.txt"
${File} ".\dir1\" "Doc2.txt"
${File} ".\dir1\" "Doc3.txt"
SectionEnd

Change to:



Section "Install Main"
SetOutPath "$INSTDIR\INSTALLERDIR1"
${File} ".\dir1\" "Doc1.txt"
${File} ".\dir1\" "Doc2.txt"
${File} ".\dir1\" "Doc3.txt"
${SetOutPath} "$INSTDIR\INSTALLERDIR1"
SectionEnd


That will write the log right, but it shouldn't have to be
done that way. Back to the NsisLog.dll it looks like it would
do more than just files & folders. I have some more testing
to do on it and more searching to do. I haven't yet found
good or I should say "Complete" ways to make a log to
uninstall from.


-MichaelFlya-