Creating an installer

Started by
8 comments, last by Ravuya 17 years, 5 months ago
I want to creat an installer that will copy the required files over to the users computer. For this I would like a system like in a package manager. That is if you aren't in root user it promts you for root pwrd and then 'su's to root. I would like to know: 1)How do I prompt for root password and put the data into an su command... for that matter, how do I call su in standard C/C++? 2)How do I store/compress files in the executable? (like windows installers) 3)If posible, could all this be in Xt or X11 please (very low level)?
pushpork
Advertisement
If you're targetting a Linux distro, you would probably be better off using the native installer that comes with a system. That's generally one of RPM, DEB, or tarball. You will find that not only have these widely available tools solved all the problems you;re trying to solve, but they've solved many problems you're not even aware of.

As to answering your questions, you're probably better off using forkpty to exec su so you can forward the prompts and replies through a pluggable front end (remember MVC?). That way you can install from a GUI or from the command line, or even from a curses-based front-end.

Stephen M. Webb
Professional Free Software Developer

My plan is to make a crossplatofrm (*nix with X11 or at least all linux distros) open source installer generator (like Inno setup) to make linux an easier interface for average home users.

execl() or system() is an example of what I need for several commands (a recent google).

Also, maybe I could link a file to the app (like a zip or just a raw binary file) and read it off? how could I get offserts from linked files?
pushpork
I'd recommend against it. All modern desktop distros already have unified and extremely easy to use installation mechanisms. Adding another one doesn't help, especially since there's a fair chance that your custom installer will interfere with the distro's package manager and cause no end of grief.
Quote:there's a fair chance that your custom installer will interfere with the distro's package manager and cause no end of grief.


Quoted for truth. I hardly ever install anything that's not in my distro's native package format. If there's something new out I usually wait for it to appear in my distro's repository.

<hr />
Sander Marechal<small>[Lone Wolves][Hearts for GNOME][E-mail][Forum FAQ]</small>

Quote:Original post by JPulham
My plan is to make a crossplatofrm (*nix with X11 or at least all linux distros) open source installer generator (like Inno setup) to make linux an easier interface for average home users.

execl() or system() is an example of what I need for several commands (a recent google).

Also, maybe I could link a file to the app (like a zip or just a raw binary file) and read it off? how could I get offserts from linked files?


Uh oh, please do not proceed with your plan (you obviously don't have enough experience). Use an existing system like everyone else is suggesting, unless you are doing it only for learning.

Here are two projects that does what you are thinking about doing, there are most likely more, just try searching a bit:
http://autopackage.org/
http://www.lokigames.com/development/setup.php3

Note that lot's of people think those are bad too (especially the autopackage one), even if they are mature and work most of the time.

About your "also" part, sounds like a job to PhysicsFS http://icculus.org/physfs/. Or if you meant by "linking" that your program knows where to find the file, then the usual way is to define the location when compiling the program.

Below are some more pointers if you are really interested in learning how to work with installers in *nix -like systems:
http://www.faqs.org/faqs/by-newsgroup/comp/comp.unix.programmer.html
http://www.pathname.com/fhs/


If your goal is to produce a program and not an installer, then the best practice IMHO would be to just provide the source, and ask/wait for someone else to do the distribution specific binary packages for you.

OTOH if your goal is to "make linux an easier interface for average home users", then you need to first find out what are the pitfalls of current implementations. What problems do you think there are for average user on what linux distributions, what is "average user" and so on.
I have been discussing this with my friends. It started out as a program that sellected the best package and installed it from a group of popular packages in the program (RPM, DEB ect)
But then I thought of just copying to the /usr/bin dir ect... like many WINDOWS installers do.
The idea was to make a more attractive interface for developers. Maybe makin it crossplatofrm for the ULTIMATE crossplatofrm development :P
Once it was part done (could pass as an installer) I'd make it Open Source (of sorts) and get as much help as posible, I can't take on uncle Billy on my lonesome... :D
pushpork
google: InstallBase
oops...they got there first :P

AHH!
Quote:
like many WINDOWS installers do.

But does theres crash, make anoying dialogs appear and wipe you hard drive :D

lol... only windows
pushpork
Most of the commercial games I've seen on Linux use the Loki Setup tools to install the game.

This topic is closed to new replies.

Advertisement