Creating an installer file, linux - bash

I currently have an installation bash script (INSTALL) and a bunch of files that are the program itself. I would like to pack the files and the script in one file, maybe tar (?) and make it executable so that when it is called INSTALL will run.
Any ideas of how I can do it? What's the common method, if there is one, to do to?
Thanks

You can use a shar archive. shar archives are self-contained executable shell scripts that are self-unpacking, and you can execute whatever code you want after the script unpacks.

In the Linux world, the expectation is that programs come in the form of packages. The most common package formats are rpm (used by Red Hat, CentOS, Fedora, SuSE, …) and deb (used by Debian, Ubuntu, …). You'll often need to make separate versions of your package (linking to different libraries) for different releases of these distributions.
Compared with the Windows world (pre-Market), you have more work to do, because the programmer or distributor is expected to do the bulk of the work of tracking program dependencies. The end user experience is simpler: all package installation and subsequent maintenance (including tracking new versions, upgrading, uninstalling, etc.) is done through a single tool (APT on Debian/Ubuntu, Yum on Red Hat/Fedora, etc.). As a programmer, you can gain the benefit of standard tools to build packages, to track dependencies (no need to package libraries: the build tool will add the necessary dependencies). Many distributions provide a standard channel to install packages, such as PPAs for Ubuntu.

You can package it to rpm.
Rpm packages allow you to use scripts before and after unpacking process.

Related

Copy python modules from one system to another

Is it possibe to copy all of the python modules from one Windows computer to another computer? They are both running the same version of Python 2.7.12.
The reason for doing so is that I have internet access on one of them, and manual installing modules on the other requires to much time because of dependencies.
I suppose you mean "copy the python installation from one system to another" (else the answer is: put your modules on a USB key and copy them to the other system).
the best way
The best way of course would be to install Python properly on the other system using setup. But as you said, all dependencies/external libraries that you could easily get using pip for instance would have to be re-done. Nothing impossible with a small batch script, even if you don't have internet, but you would have to get hold of all the .whl files.
the full treatment, portable-style
But if you cannot you can create a "portable" version of python like this:
zip the contents of C:\python27 to an USB key
copy all python DLLS: copy C:\windows\system32\py*DLL K: (if K is your usb drive)
unzip the contents of the archive somewhere on the second machine
add the DLLs directly in the python27 directory.
(those DLLs were installed in the windows system in previous Python versions, now it's even simpler since they are natively installed in the python directory)
The advantage of this method is that it can be automated to be performed on several machines.
There are some disadvantages too:
python is not seen as "installed" in the registry, so no "uninstall" is proposed. It's a portable install
associations with .py and .pyw are not done. But you can do it manually by altering some registry keys.
another method, better
You can have best of both worlds like this:
perform a basic install of python on the second machine
overwrite the install with the zip file
=> you get the registered install + the associations + the PATH... I would recommend that last method.
Last partial method, maybe best matching your question
Try copying the Lib directory only. It's where the libraries are installed. I'm not 100% sure but it worked for me when I wanted to put wx on a python install lacking wx.
Of course you will copy over already existing files, but they are the same so no problem. I let other people comment if this is acceptable or not. I'm not sure of all the installation mechanism, maybe that will fail in some particular case.
In my case, copy-pasting python installation didn't do the job.
You need to check the "C:\Users\\AppData\Roaming\Python*" folder. You may find installed python modules there. Copy and paste these into your source folder will add these modules to your python.

Is there any package management system for MinGW+MSYS?

I am trying to compile some open source libraries in MinGW+MSYS. During the configure phase, I kept seeing some 3rd party libraries are missing.
For now, my solution is to download the source of the missing libraries and follow the GNU build process to compile and install them into my MinGW environment.
Is there any package management system for MinGW+MSYS to install packages easily? Just like apt-get.
I tried the mingw-get for the missing package. But it reports the error below.
mingw-get is the (closest equivalent to apt-get) package manager for MinGW and MSYS. However, it can only manage packages which are actually available for MinGW and/or MSYS, (either because a MinGW developer has built and packaged them, or a member of the MinGW user community has contributed them).
Arbitrarily guessing what packages may be available, and even what their correct package names may be, is unlikely to be productive. Run mingw-get in its GUI mode, (if it's properly installed, just running mingw-get without arguments should start it in this mode), to see a list of packages which are actually available; if you don't see any likely candidates for what you are looking for, then it doesn't (yet) exist. In that case, you will need to either find a non-MinGW alternative build, or build it yourself, from source. (If you choose the latter option, and your build is successful, then you may wish to consider contributing it to MinGW.org).
This works for me as a "package manager".
Install MSYS2. It comes with a package manager called pacman.

meaning of ./configure --with-ssl=openssl

I followed this install wget tutorial,
After I ran this
./configure --with-ssl=openssl
It ran so many checks, what exactly it did? Did it change anything in my system?
If it does, then, is it safer or more fault prove to use the package management tool like MacPort or such so that such 'configure' will not be done manually like this or does those tool do the same thing in order to make wget work?
Sorry, I am pretty noob on shell commands.
Thanks
It's part of the build process. The configure script collects information about your system and build options into a local file, nothing more.
Typically, this script is created by autoconf and is used to figure out whether the prerequisites for a build are properly installed, etc. It will collect this into a file config.save and also possibly generate a makefile and/or other build infrastructure in order for make to be able to concentrate on compiling and linking the source files.
Neither configure nor make should be expected to change anything outside of the directory tree where you run them.
Conventionally, make install will copy the final build artefacts into place so that other parts of your system can find them and use them.
See also http://www.edwardrosten.com/code/autoconf/
A prepackaged binary will already have been built on a remote system before it was packaged (though there are package managers which allow or require you to build locally; Gentoo Linux famously uses the latter approach) and is often the simplest way to get a tool if you don't have special requirements, such as building with a specific SSL version, or disabling SSL entirely, or getting a bleeding edge version before anybody has packaged it.

Multiple parallel MSys/MingW installations on Windows

when installing MSysgit, also MSys (as the name suggests) is installed on my machine.
When I additionally install DevKit for Ruby, yet another copy of MSys is installed on my computer. When installing the Haskell Platform for Windows, again another copy of MSys is installed on my machine. Is there any way of installing MSys/mingw once and tell all other software to do a lookup in the Path?
The version of msys that is included in the Git for Windows package is modified and if you attempt to replace it with a stock msys package you will run into problems. I can't comment on the other packages but basically - it is not worth worrying about. Disk space is significantly cheaper than the time you spend trying to make a number of independent packages share a common msys platform.
However, there are in fact people working on trying to sort that out. msys now has a package management system and I know of at least one project attempting to get the Git for Windows build environment working withing that system mingwGitDevEnv.

How to check a makefile for dependencies?

I'm trying to install something with the following command:
make world
It takes a long time, and usually it ends up with an error saying that I'm missing some kind of package. I found out what the package is, install it, and run the thing again, only to find out after a long time that I'm missing another package. Is there a way to find out all the packages I need to install without having to go through this process?
This is generally what the configure script does. If the project you're building doesn't have one, you should write one.
The best way to deal with dependencies is with a package manager such as:
On Ubuntu: apt-get
On Red Hat / Fedora: yum
On Mac OS X: port
On Windows: cygwin
If you install software with a package manager, it will automatically fetch, download, and install any dependencies as necessary. These package managers support a huge number of popular open source projects, but not all projects are supported. Some of these package managers support creating custom package repositories, which allows them to be used for dependency management in-house, as well.
Unfortunately, there is no general way to get all the library dependencies of a Makefile (short of grepping for "lib", ".so", and "-l" which may give you spurious results); however, if you are installing an open source project, chances are that it is supported by a package manager on your system.

Resources