- NSIS Discussion
- How to make a Personalized Installer
Archive: How to make a Personalized Installer
zivha
18th February 2011 09:24 UTC
How to make a Personalized Installer
Hello all,
Here is my dilemma, I need to create an installer that is personalized per each user downloading it. The website has tens of thousands of users, when a user login they can download a software installer but the installer should have some unique data for the user. So basically i need to personalize a generic installer per each user.
I can go the naive way and just create tens of thousands of copies of the installer, each with a different user ID and then have the installer when it is run connect to the server send the user id and get the rest of the specific user data. Obviously this solution seems very wasteful.
I can do it in real time in PHP by implementing the download code in PHP, have PHP dump the installer and then some user id data at the end. This is more generic but it means high load on the server and not being able to enjoy the efficiencies of a simple file server to the installers.
Another solution would be to encode the user id in the filename and then have the installer decode it from the filename and use it. This is very easy to do but it seems like a very fragile solution.
Any other ideas? Anyone had to cope with the same problem before?
Highcoder
18th February 2011 10:17 UTC
re
The best way to do this ist to compile the installer script on demand and pass the user id during compiletime. If your serve is a windows machine it should be easy.
I don´t know details how to do it but this way is i whould do it.
zivha
18th February 2011 10:27 UTC
Yeah I forgot this one, but is pretty much the same as having a PHP code dump the EXE and append some ID to it, I guess it is cleaner and safer to recompile. The problem is the same though or maybe even worse this this is not a scalable solution it's ok if you have a low traffic site but if you have high traffic keep compiling is not practical. Also our production server is obviously not Windows ;-) which poses another challenge to recompile on an Apache/LAMP configuration - I guess you could set up another Windows server just for compilations and have ti communicate with the main Apache web server but again, not scalable...
Highcoder
18th February 2011 10:58 UTC
Thats right but if you want a unique installer you have to manipulate it´s base. You can compile it, you can use your PHP variant, recource hacker tools to "inject" ID´s etc...
But there is no solution that needs no serverpower...
The variant of encoding ID in filename is the only lightweight variant for your purpose because renaming is resource friendly.
zivha
18th February 2011 12:11 UTC
Yeah renaming is easy and light but is also very fragile not the most reliable way to go :-)
MSG
18th February 2011 12:30 UTC
An alternative is to have the installer dial home to get the user id. You could let the user enter its login on a custom page or popup, or try to abuse a browser cookie...
zivha
18th February 2011 12:58 UTC
Yeah trying to avoid asking the user to enter his info again :-)
As for browser cookies, any experience doing that? my gut feeling would be that this would not be a super reliable solution.
MSG
18th February 2011 13:08 UTC
It'd be a hackjob, probably. There's currently another thread going on about cookie usage with the inetc plugin, maybe check that.
Afrow UK
18th February 2011 13:53 UTC
Just output the generic copy using a PHP and write an additional couple of characters containing the user id afterwards.
http://nsis.sourceforge.net/ReadCustomerData
Maybe a little bit overkill. One 'magic' character is enough.
Stu
MSG
18th February 2011 14:19 UTC
He already mentioned that solution, and noted that it'd be a problematic load on the server to use a php downloader.
zivha
18th February 2011 14:25 UTC
Yeah, maybe some PHP loader with caching, create the file on the fly and cache it for a while for subsequent downloads. arrrrrrr, I guess there is no easy way to escape this.
Afrow UK
18th February 2011 14:48 UTC
If the installer is large then make a small downloader and append the user id to that.
Stu
zivha
18th February 2011 14:56 UTC
Yeah good idea, it's about 650KB probably not worth it.
MSG
18th February 2011 17:40 UTC
Well if it's that small it should be quite doable to just use php...