|
|
Home » Developing U++ » UppHub » Updater package
Updater package [message #30663] |
Fri, 14 January 2011 23:49 |
mdelfede
Messages: 1308 Registered: September 2007
|
Ultimate Contributor |
|
|
Well... the name could also be WebUpdater.
It's a package for installing/updating applications automagically.
No need for installers, but you can have them
It's enough to include the package just after GUI_APP_MAIN :
GUI_APP_MAIN
{
Updater updater;
updater
.SetMaxVersion(GetMaxVersion())
.SetWebRoot("www.timberstruct.com/webupdater/updatertest")
.UpdateManual();
if(!updater.Run())
return;
----------FOLLOWING APPLICATION CODE FROM HERE ------------
}
The web server layout is :
[WebRoot]/[AppName]/LINUX32/versions
[WebRoot]/[AppName]/LINUX32/[version1]/[AppName]
[WebRoot]/[AppName]/LINUX32/[version2]/[AppName]
.....
[WebRoot]/[AppName]/LINUX32/[versionN]/[AppName]
[WebRoot]/[AppName]/LINUX64/versions
[WebRoot]/[AppName]/LINUX64/[version1]/[AppName]
[WebRoot]/[AppName]/LINUX64/[version2]/[AppName]
.....
[WebRoot]/[AppName]/LINUX64/[versionN]/[AppName]
[WebRoot]/[AppName]/WINDOWS32/versions
[WebRoot]/[AppName]/WINDOWS32/[version1]/[AppName]
[WebRoot]/[AppName]/WINDOWS32/[version2]/[AppName]
.......
[WebRoot]/[AppName]/WINDOWS32/[versionN]/[AppName]
[WebRoot]/[AppName]/WINDOWS64/versions
[WebRoot]/[AppName]/WINDOWS64/[version1]/[AppName]
[WebRoot]/[AppName]/WINDOWS64/[version2]/[AppName]
.......
[WebRoot]/[AppName]/WINDOWS64/[versionN]/[AppName]
'versions' file contains a list of available file versions in double format xxxx.xx (major + 2 digits minor version number) one for each line.
On launch, the application will (if enabled) look for an updated version on web server, ask user (or not, if autoupdate is enabled) if he wants to update, copy itself on a temporary folder, respawn in superuser mode (POSIX), fetch the application code and replace the older one.
It will then store the current app version in a system-wide config file AND re-run the updated application sa previous normal user.
It supports version limiting, i.e., if there's 2.00 version available but user is allowed up to 1.6, it's enough to do
updater.SetMaxVersion(1.6)
and updater will limit to this one at most.
Code SHOULD (and WILL !) be cross platform, by now I tested it on Linux64 bit only.
It's still missing icon and menu embedding; if somebody knows how to do it in Windows, I'll appreciate his help !
Ciao
Max
p.s: the only limitation is that updater gets his paths from application name. So, if you want your app to be installed as "TimberStruct" the executable MUST be named TimberStruct[.exe].
The executable can also be a simple stub with just the updater code; on launch it will download from web the "true" application, on newest version; it can so be deployed as a very small installer app.
If run with --UNINSTALL as first option, it will uninstall the app, along with his system config folder.
Feel free to test it, but beware... Windows is completely untested by now!
p.p.s : if you want to test, beware that I've got testfiles on my server jsut for LINUX64 by now... on next days I'll add WINDOWS versions too, hopefully.
[Updated on: Sat, 15 January 2011 15:48] Report message to a moderator
|
|
|
Re: Updater package [message #30668 is a reply to message #30663] |
Sat, 15 January 2011 22:28 |
mdelfede
Messages: 1308 Registered: September 2007
|
Ultimate Contributor |
|
|
Updater now works also in windows.
Test files are on server, so you can test it in both environment (LINUX64 and WINDOWS32).
Ciao
Max
TEST INSTRUCTIONS :
1) Build and run UpdaterTest application
2) It will ask for install, answer Yes
3) App will download version 1.5 from server (notice that in test app the maximum version is limited to 1.6)
4) Launch the installed app (NOT the one you built), it'll notice that a version 2.0 is available and ask for update
5) Answer yes and you'll get the 2.0 version installed
6) Launch again the application, it'll just run and show 2.0 version, as it's the last one on server
7) run 'UpdaterTest --UNINSTALL' and the app will be completely removed, besides user configuration folder that could contain user data.
if you rebuild the test app changing the SetMaxVersion() from 1.6 to something greater than 2.0, you'll notice that it'll download the 2.0 directly.
SetMaxVersion() has the purpose to work together with a license manager (Protect stuff, here ) when the user isn't allowed to pass some version number.
Still no docs by now, and still no shell embedding... I'd appreciate some help to add this one for windows platform
Ciao
Max
[Updated on: Sun, 16 January 2011 01:24] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
Re: Updater package [message #34033 is a reply to message #34032] |
Wed, 12 October 2011 10:22 |
mdelfede
Messages: 1308 Registered: September 2007
|
Ultimate Contributor |
|
|
koldo wrote on Wed, 12 October 2011 06:37 | Hello Massimo
I wanted to use your Updater with your Protect packages.
Some questions:
- Now Bazaar/Updater has the same name that Updater package, so I cannot get the Bazaar one from a package kept outside Bazaar. How can I overcome it?
|
I guess you can, just add Bazaar nest to your working assembly.
I do it always in my app... I've a TimberStruct assembly with TimberStruct, Bazaar and UppSrc nests inside and it works.
Quote: |
- It seems that Updater is also an installer package as it:
-- Download the files
-- Install the program
-- Creates Program Files folder and Application Data folder
|
Yep, it is. you can (as I did...) deploy a small programm that contains just updater and setup to fetch your real app.
When user launches it first time, he gets the true application downloaded and installed, in its latest version, so you can leave the installer forever on your web site without worrying updating it.
Quote: |
Would it be possible to choose the Program Files folder location and name, and the Application Data folder name?
|
It would need some changes.... you can do it, but it should maintain the actual defaults to not break the apps using it now.
You could add a "SetProgramFilesFolder()" and "SetAppDataFolder()" member functions that could change the paths from the default.
Quote: |
- Could it work from LAN folders too? (this is a must for me now)
|
Uhmmmm.... never tried. You can try to install the Server app onto a PC in your lan and see.... it's a quick test.
Quote: |
- The uninstaller is run from a program with a name from GetTempFileName() that appears in window caption. Could you use just the program name or with something like " - Uninstaller" added?
|
ops, yes... I guess I forgot to set the title.
Quote: |
- In my case the uninstaller do not remove the Application Data folder. May this be switched on or off? (to ask the user if s/he wants to delete data folder)
|
that could also be added as an extension, not too difficult.
I'm sorry that I can't work on it on these days... but you can do it, just be sure to not break actual behaviour, or my customers will kill me
Quote: |
These are just the first set of questions . Thank you. Updater seems VERY complete.
|
Thank you... I guess it could be extended, indeed, The most important missing thing is the ability to update other files than the executable itself; it should be a trivial addition too, indeed.
Ciao
Max
|
|
|
Re: Updater package [message #34035 is a reply to message #34033] |
Wed, 12 October 2011 13:42 |
|
koldo
Messages: 3394 Registered: August 2008
|
Senior Veteran |
|
|
Hello Massimo
Quote: | I guess you can, just add Bazaar nest to your working assembly.
| I think that to do it I would have to put first Bazaar and after that uppsrc, but I prefer the opposite: to have uppsrc first. This way it always put uppsrc Updater instead of Bazaar Updater. I tried to put Bazaar/Updater but it does not work.
Quote: | Yep, it is. you can (as I did...) deploy a small programm that contains just updater and setup to fetch your real app.
When user launches it first time, he gets the true application downloaded and installed, in its latest version, so you can leave the installer forever on your web site without worrying updating it.
| So:
- You deploy an installer with Updater inside.
- Updater downloads the application, that also has Updater inside
Quote: | It would need some changes.... you can do it, but it should maintain the actual defaults to not break the apps using it now.
| It is an honor . Of course compatibility is a must.
Quote: | You could add a "SetProgramFilesFolder()" and "SetAppDataFolder()" member functions that could change the paths from the default.
| Great. SetProgramFilesFolder() will be filled by the installer (asking the user). I may do an installer soon with a look and feel similar to InstaShield or Nullsoft.
Quote: | Uhmmmm.... never tried. You can try to install the Server app onto a PC in your lan and see.... it's a quick test.
| A focus could be to create a local Licenses Server running in a LAN handling all customer licenses.
Other focus could be to update directly from LAN folders like uppsrc/Updater does, but following your versions standard about folder names.
Quote: | The most important missing thing is the ability to update other files than the executable itself
| I will check it, following an interface as similar as possible to uppsrc/Updater but without breaking compatibility (or asking you before if a have a good idea ).
In addition to this, and recognizing that the security options to save a key are in order:
1. A Web server
2. An USB dongle
3. A local encrypted file including key and data to identify computer hardware
... could it be added the option 3 to Protect? . It could be done this way (you may think something better):
- First time the installer is run, it gives a code and gives the option to send an email with it. This code includes the key you put with ProtectEncrypt and local computer info in a hash code or encrypted (if encrypted you can get that data, for example to monitor deep hardware changes that void the key but that can be permitted so you will send a new key).
- You return the user a key including a hash of the code and additional data as the license end date.
This is because in my case the application is expected to work without dongle and without internet connexion.
In addition, other thing to add to Updater and client access to get a key in Web, is the local Proxy handling, very usual in company environments.
Best regards
Iñaki
|
|
|
Re: Updater package [message #34036 is a reply to message #34035] |
Wed, 12 October 2011 14:21 |
mdelfede
Messages: 1308 Registered: September 2007
|
Ultimate Contributor |
|
|
koldo wrote on Wed, 12 October 2011 13:42 |
.......
3. A local encrypted file including key and data to identify computer hardware
... could it be added the option 3 to Protect? . It could be done this way (you may think something better):
- First time the installer is run, it gives a code and gives the option to send an email with it. This code includes the key you put with ProtectEncrypt and local computer info in a hash code or encrypted (if encrypted you can get that data, for example to monitor deep hardware changes that void the key but that can be permitted so you will send a new key).
- You return the user a key including a hash of the code and additional data as the license end date.
This is because in my case the application is expected to work without dongle and without internet connexion.
In addition, other thing to add to Updater and client access to get a key in Web, is the local Proxy handling, very usual in company environments.
|
Well, I was planning a similar protection schema on the beginning, but I didn't find any *reliable* way to get a key from user's machine. For "reliable" I mean that :
1) It don't change if user adds/replaces an hard disk or and usb disk
2) It don't allows easily to user to fake it, for example, running app into vmware or similar....
The other remaining option, the dongle, should be not too difficult to implement, besides the fact that it must be multiplatform....
Max
|
|
|
|
Re: Updater package [message #34040 is a reply to message #34037] |
Thu, 13 October 2011 13:06 |
|
koldo
Messages: 3394 Registered: August 2008
|
Senior Veteran |
|
|
Hello Massimo
To identify an equipment and user I use these functions:
GetSystemInfo(manufacturer, productName, version, numberOfProcessors, mbSerial);
GetBiosInfo(biosVersion, biosReleaseDate, biosSerial);
Array <NetAdapter> netAdapter = GetAdapterInfo(); // Includes MAC addresses for all adapters (WAN, LAN, WLAN, ...)
GetHDSerial();
GetUserName();
From them I use this data. These are the results:
- manufacturer: Good although sometimes empty in PC clones
- productName: Good although sometimes empty in PC clones
- mbSerial: Good although sometimes empty in PC clones
- biosVersion: Good although sometimes empty in PC clones
- biosSerial: Good although sometimes empty in PC clones
- mac: Good using "ETHERNET" adapter. Other adapters can change unexpectedly
- hdserial: Good although code messed up in some Windows 7 PCs 64 bits
- userName: Good although easily changed for home users
As you imagined the identification is not perfect, but it is good in professional environments.
Best regards
Iñaki
|
|
|
|
|
|
|
|
|
Goto Forum:
Current Time: Fri Sep 20 20:05:39 CEST 2024
Total time taken to generate the page: 0.02889 seconds
|
|
|