GPSFileDepot.com
 

News:

Welcome to GPSFileDepot!

Main Menu

Installer script... again

Started by Boyd, October 06, 2011, 02:08:36 PM

Previous topic - Next topic

-Oz-

Did you have two maps list then or still just one?
Dan Blomberg
Administrator - GPSFileDepot
GPS Units: Garmin Dakota 20, Garmin GPSMap 60csx, Nuvi 255W, Nuvi 250W, ForeRunner 110, Fenix 2, Tactix Bravo, Foretrex 401
See/Download My Maps!

Boyd

Yeah, after uploading I realized that I had created a second nested folder (guess I zipped the whole folder instead of selecting all the files and zipping them). Will have to update that so that the files are all there when you first open the folder. But that's my screw-up, not a problem with the installer. And it seemed pretty obvious that you need to open the folder, which is why I didn't jump right in and fix it. Anyway, your point is well taken.

If you run the installer again, it will just copy the same files to the same place, it won't install anything twice. As mentioned above, this is just a bare-bones installer script that doesn't do anything like checking to see if the map is already installed or if there's a previous version.

It's not a limitation of the installer program (inno), it's just a script that needs more work to deal with these issues. Join in the fun and help customize the script so that it handles these things.  :)

I think it would be very simple to make the script uninstall a previous universal version of the map. That value of AppID uniquely identifies your map (you need to generate this yourself using a function of Inno Setup Compiler). If you create a new map and keep this same ID, it should just be a case of having the script do an uninstall first, then install the new map.

Earlier in this thread I posted a little test map while working on this script. I used the same AppID for that map, and when I ran the uninstaller for my "real" map I noticed that it removed that little test map as well as the real one since the ID was the same.

What gets a little more complicated is uninstalling a previous registry-based map. As I said, I'm sure that is quite possible since the tools to work with the registry are all there. But I just don't have a grasp of how the registry works. Will try to study this some more.

Boyd

#107
Here's what I've learned so far about uninstalling previous versions:

If the previous version was in the gmap (universal) format:

1. If the map has the same name, you can have the installer just over-write the old folders and files

2. If the map has a different name you can add an [InstallDelete] section that will be executed before the installer to remove any folders/files that you specify

If the previous version was in registry format AND you know where it was installed: You can use a [Run] section to run the uninstaller program (uninstall.exe) for the old version. This might be a problem because the GPSFD installer allowed the user to choose a custom install location.

If the previous version was in registry forum and you don't know where it was installed:

Here's where I get confused. It looks like you can use the [registry] section to find and delete any registry entries for the old map. I guess that would be good enough to remove the map from Mapsource. But I don't see a way to find and delete the actual .img files using the registry (which is what Oz was doing in his NSIS script)

Further thoughts...
Seems like the best way to remove an old registry based map is to simply run the uninstall.exe file that was created by NSIS when the old map was installed. That can easily be done in the inno [run] section. What I don't understand is how to FIND that old uninstall.exe unless you know where the user originally installed his map.   :-\


Seldom

Quote from: Boyd on December 14, 2011, 05:49:10 PM
Here's what I've learned so far about uninstalling previous versions:

If the previous version was in the gmap (universal) format:

1. If the map has the same name, you can have the installer just over-write the old folders and files

2. If the map has a different name you can add an [InstallDelete] section that will be executed before the installer to remove any folders/files that you specify


What happens when you add tiles to the same mapset (or delete them or change their names)?  It seems to me that it would be safer to make the Delete standard.

Boyd

#109
I'd think you would want to replace the whole mapset when you change any part of it, because that could get confusing otherwise. But since the gmap format is just a collection of directories and files, you could drill down and replace individual tiles if you really wanted to.

The current version of the inno installer (that I used for my new map) is really simple. It just copies the folders and files to the right location on your computer. That's all you need to "install" a gmap. To "uninstall", you just delete the folders and files. That can be done by replacing them with new ones with the same names, or by explicitly deleting them.

Boyd

Maybe this is a more clear answer. This inno script section installs a map named "MyMap"

Quote[Files]
Source: "{src}\MyMap.gmapi\*"; DestDir: "{commonappdata}\GARMIN\Maps"; Flags: external ignoreversion recursesubdirs createallsubdirs

If you make a new version and also name it "MyMap", then that same command will replace the old version with the new version.

If your new version is named "MyNewMap", then you would add the following to first remove MyMap

Quote[InstallDelete]
Type: filesandordirs; Name: "{commonappdata}\GARMIN\Maps\MyMap.gmapi"

Then you would install the new map with

Quote[Files]
Source: "{src}\MyNewMap.gmapi\*"; DestDir: "{commonappdata}\GARMIN\Maps"; Flags: external ignoreversion recursesubdirs createallsubdirs

Boyd

#111
OK, looks like there's a way to uninstall the registry based map, but I'm gonna need Oz's help with this.  :D

With NSIS, I think this is how Oz would remove a registry-based map named "OldMap"

QuoteReadRegStr $R0 HKLM \"Software\Microsoft\Windows\CurrentVersion\Uninstall\OldMap\UninstallString"
  ExecWait '$R0'

In inno, we have this syntax (scroll way down this man page: http://www.jrsoftware.org/ishelp/index.php?topic=consts)

Quote{reg:HKxx\SubkeyName,ValueName|DefaultValue}

    Embeds a registry value.

So, would something like this accomplish the same thing in inno? Specifying a Filename in the [run] section simply causes that program (ie: uninstall.exe) to be run.

Quote[Run]
Filename: {reg: HKLM \"Software\Microsoft\Windows\CurrentVersion\Uninstall\OldMap\UninstallString"}

I just don't understand this registry stuff, and I'm reluctant to start experimenting with scripts that might mess up my own registry. I'm not completely clear on what "UninstallString" represents in that NSIS script. Is that a value that is read from the registry itself (ie: the full pathname of the uninstaller)? If so, I assume that inno could also read it. Or is it some kind of variable or constant from NSIS that wouldn't work in inno?  :-\


BobT

Attached is my IS script that I have been using for years.  It was before the new version that allows you define variables.  I would just use find/replace to change the names.  In this script you will see a section called [Type] and [components] that let a user select certain items they wanted copied to their computer, mainly original gps tracks.  You need these to view in Google Earth.  The sections is the registry section where I write to the registry.  I did not use the new gmap format.  This may are may not be of any help to you in your quest.  You can install one of my maps on this site to see how it works.


-Oz-

#113
Boyd:

Yes, you're definitely on the right track.  That installer string gives the location of the uninstall file.  The $R0 for NSIS just is the variable the value from the registry gets saved to.

Based on
Quote{reg:HKxx\SubkeyName,ValueName|DefaultValue}

    Embeds a registry value.

This code may not work:
Quote[Run]
Filename: {reg: HKLM \"Software\Microsoft\Windows\CurrentVersion\Uninstall\OldMap\UninstallString"}

I think it should actually look like:
Quote[Run]
Filename: {reg: HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\OldMap,UninstallString}
Note the comma before uninstall string since that is how the template appears to be.

However I can't test it yet because I really have to finish my real work before I screw with this.  The good news for testing though is you should just be able to run that line in Inno and see if it opens the uninstaller.  It won't actually modify the registry.

NOTE: After re-reading I think that is the command for edit the registry.  You need to find the command to read data from the registry.
Dan Blomberg
Administrator - GPSFileDepot
GPS Units: Garmin Dakota 20, Garmin GPSMap 60csx, Nuvi 255W, Nuvi 250W, ForeRunner 110, Fenix 2, Tactix Bravo, Foretrex 401
See/Download My Maps!

Boyd

#114
Will look at this tonight, but I think his:

{reg: HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\OldMap,UninstallString}

is not a "command" at all. It's way to read a registry value into a variable so that it can be used in a command.  I am assuming that it would expand to the full pathname of the uninstaller .exe. Thanks for the syntax corrections!

By placing it in the [run] section and using the File command, it should just execute the uninstaller. In other words, it's the equivalent of;

ExecWait '$R0'

in NSIS... or at least I think so  :) Will post back tonight, am working outside on home renovation on this warm winter day.

@BobT: thanks for posting that, will have a look.

-Oz-

Another syntax one; remove the space between HKLM and \Software
Dan Blomberg
Administrator - GPSFileDepot
GPS Units: Garmin Dakota 20, Garmin GPSMap 60csx, Nuvi 255W, Nuvi 250W, ForeRunner 110, Fenix 2, Tactix Bravo, Foretrex 401
See/Download My Maps!

Boyd

It is confusing. But I have tested that map on Windows7.  XP, and Vista and it worked properly. Are you sure you aren't running an old version of Mapsource?

To find the correct directory, open a Windows Explorer Window and paste the following into the address bar at the top

%ALLUSERSPROFILE%\Garmin\Maps

This works for me. Give it a try.

-Oz-

Huh, was someone having a problem?  The install worked fine for me (all I have to test with is win 7 32 and 64bit).
Dan Blomberg
Administrator - GPSFileDepot
GPS Units: Garmin Dakota 20, Garmin GPSMap 60csx, Nuvi 255W, Nuvi 250W, ForeRunner 110, Fenix 2, Tactix Bravo, Foretrex 401
See/Download My Maps!

Boyd

#118
Oops, I'm sorry! I meant to respond to a PM on this topic that maps4gps sent me about problems with the universal installer. So I reviewed this thread to try and remember how I did things and somehow I got confused and posted the response here. 

This is what happens when it try to do something quickly late in the evening.... :-[

maps4gps

Not a problem with a mapset, but not sure if a procedure for doing this has been decided on.

In reviewing the posts in this thread,  'c:\users\all users\garmin\maps' was indicated for the location of the xxx.gmap file/folder
Seldom had just posted  'c:\programdata\garmin\maps' for your FL topo
I did not find where 'Boyd's Map of New Jersey 2012' got installed to.