Graphical Linux application installer for audiences that are used to Windows
installers. When all you would really need is unzip
, but want a nice user
experience nonetheless. Imitates the look and feel of
NSIS, or rather
Wizard97-type
installers.
(Example installer splash image by Deniz Altindas and banner image by Victoria via unsplash.com)
Download the latest builder
and extract the setup-installer-builder
executable from it.
# Run the Setup for the installer-builder (it's a showcase within a showcase 🙂)
chmod +x setup-installer-builder
./setup-installer-builder
# Go to the installed path
cd ~/LinuxInstallerBuilder/ # (or the path you selected during installation)
# (Add/edit file(s) in the "data" subfolder here, but the example has one already.)
# Create the example installer, and give it a version of 1.0 (optional)
make VERSION=1.0
# Run the default output file
./Setup
This project creates an installer builder, which is used to create the actual installers. The installer builder comes in the shape of a zip archive containing:
data/
source folder for your fileslinux-installer
binary
resources/
— to customize and modifyMakefile
/make.bat
(for building on Linux/Windows respectively) to put
it all togetherThe installer builder has no external dependencies (except for make
on Linux, and
Powershell
on Windows), and can be run on a minimal dedicated build machine.
The following dependencies need to be installed to build:
go
gcc
gtk3
make
pkg-config
zip
(Technically, BSD-Make works just as well as GNU-Make, so if you have bmake
that'll work too).
Prepared install commands for popular distributions are below:
If you're new to Go, verify that your installation works by running go version
. It
should print the installed Go version.
If you want to edit the installer GUI layout you should install Glade as well.
These steps need to be executed only initially and after updating the installer builder itself.
cd
into the local copy of this repository and run make linux-builder.zip
.linux-builder.zip
archive to builder machine (if different). The
builder machine can run Linux or Windows.These steps need to be executed in the extracted builder directory, and for every installer.
data
subfoldervariables.version
(and possibly other variables) in
resources
/config.yml
make
to create installer.
cd ~/path/to/linux-builder
make
# or set version and filename directly on the commandline:
make VERSION=10.0 OUTPUT=Setup_ExampleApp_v1.1
cd /d D:\Data\linux-builder\
make.bat
:: or:
make.bat VERSION=10.0 OUTPUT=Setup_ExampleApp_v1.1
If you set the variables in resources
/config.yml
before you can also
simply run make.bat
by double-clicking.
You can pre-compress files that are the same for several installers into zip archives
and put them into the data_compressed
folder. This can speed up the creation of a
batch of mostly-similar installers.
Note: The archive name data.zip
is used by the builder, so don't use that specific
filename.
Various parts of the installer can be customized and changed without touching the code, such as the style and layout of elements, and the translation strings. The way to do this is described in this section.
Adding a new screen (or removing one) requires only minor code changes, and is explained below as well.
The splash.bmp
image is shown on the left-hand side of the language-, welcome- and
success-/failure screens, and should be a vertical 164×314 pixels in size. The right
side of the image should connect well with the window.background
color (currently
plain white #ffffff
).
The banner.bmp
image is shown on the top of all other screens and should be a
horizontal 497×60 pixels in size. The bottom of the image should connect well with the
window.background
color like above.
The icon.gif
image is used as the icon in the taskbar and possibly the window's title
bar while the installer is running. It should be a square GIF image, not too large
(16×16 or 32×32 pixels).
The GUI layout of the installer is specified in resources/gui/gui.glade
. This file can
be edited with Glade, a WYSIWYG GTK3 UI editor.
The layout consists of the main installer window and a do-you-really-want-to-quit dialog box.
The installer window consists mainly of the "Stack" of screens that the installer can go through. Not all have to be visited (e.g. installation failure), and not necessarily in order (although they are mostly run through sequentially).
GTK3 supports styling UI elements with CSS. Elements can have ids, classes and are of a type, just like regular HTML elements.
The GUI CSS is loaded from a variable in resources/config.yml
called gui_css
, which
controls some colors in the GUI, and mostly sets the background color to white, and
changes some font properties so the license text is not too large, and the filenames in
the installer progress not too prominent.
To change the styling of the installer, simply change the content of that variable. See
the GTK3 CSS docs for
information and both the example config.yml
and the
config.yml
for this repository's installer for hints.
Before installation starts, and after, there is the possibility of running a custom script to do any tasks necessary at that time. Currently these are present, but empty.
The hook scripts live in resources/hooks/
and are named after their execution time,
namely pre-install.sh
and post-install.sh
, which run before and after installation,
respectively.
You can write custom commands into these files and they will be executed. Their output (for debugging purposes) is logged into the installer.log file that is created when the installer is run.
In short: Add a new file named xx.yml
inside resources/languages/
(or better, copy
en.yml
), where "xx" is the language's two-letter ISO
639-1 code. Then translate all
messages. The language should now be available in the language selection in the GUI and
the help text in the CLI mode.
E.g. in order to add French, create and translate resources/languages/fr.yml
.
A new installer screen is a two-step process:
resources/gui/gui.glade
screenHandlers()
inside gui/gui.go
In the list of screens in Glade, right-click on the screen after which you want to insert your new screen, and select "Insert Page After" at the bottom of the context menu. Double-click inside the resulting empty space and select GtkBox to create a layout base for the new screen. Give the Box an ID in the details panel on the right in the "General" tab. This ID is needed in the next step.
You can then design the inside of the Box however you like. Remember to add IDs to relevant elements in order to reach them from the behavior code.
In gui/gui.go
inside screenHandlers()
add a new section for the screen like this:
{
name: "myscreen",
disabled: false,
before: func() {
// ...
},
after: func() {
// ...
},
undo: func() bool {
// ...
}
},
The "name" key is the ID you chose in the layout step. The "disabled", "before",
"after" and "undo" keys are documented in the comment for the ScreenHandler struct a
little bit earlier in gui/gui.go
. See there for details.
If a function for a key is empty (or if "disabled" is false
), the key can be omitted
completely.
See HACKING.md.
libc.so.6: version GLIBC_... not found
The installer might fail to run on another machine with an error like this:
./linux-installer-dev: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by ./linux-installer-dev)
The installer builder was linked on a machine with a newer libc than the one on the running system. The solution is to build on a system with the lowest libc version that you want to target. Generally this means to build the installer builder on the oldest Linux version that you are targeting.
To check which version you are running, run ldd --version
.
(Note that this does not affect the machine on which you are packaging the actual installers. You can run the installer builder on any system.)
This software has a CC0 license.
To the extent possible under law, all copyright and related or neighboring rights to this work are waived.
(And yes, this means commercial use is explicitly allowed.)
This software was developed and tested for years at Contecs engineering services GmbH who have graciously allowed publication as free and open source software. Thank you very much!