Skip to content

Commit

Permalink
* Added booleans subsystem with support for complex expressions in
Browse files Browse the repository at this point in the history
   most installer tags.
  • Loading branch information
megastep committed Mar 29, 2006
1 parent 1ef4ccd commit 0781642
Show file tree
Hide file tree
Showing 17 changed files with 904 additions and 171 deletions.
3 changes: 3 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
Current:
Stephane Peter (Codehost) - Wed Mar 29 15:37:18 PST 2006
* Added booleans subsystem with support for complex expressions in
most installer tags.
Stephane Peter (Codehost) - Wed Mar 15 12:39:34 PST 2006
* Make fork on binary start optional, through root "fork" attribute.
Stephane Peter (Codehost) - Thu Mar 9 11:09:13 PST 2006
Expand Down
2 changes: 1 addition & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ CFLAGS += $(OPTIMIZE) $(HEADERS) $(OPTIONS)
CXXFLAGS = $(CFLAGS)

COMMON_OBJS = log.o install_log.o
CORE_OBJS = detect.o plugins.o network.o install.o copy.o file.o loki_launchurl.o
CORE_OBJS = detect.o plugins.o network.o install.o copy.o file.o loki_launchurl.o bools.o
OBJS = $(COMMON_OBJS) $(CORE_OBJS) main.o
LOKI_UNINSTALL_OBJS = loki_uninstall.o uninstall_ui.o
CARBON_UNINSTALL_OBJS = $(COMMON_OBJS) carbon_uninstall.o uninstall_carbonui.o
Expand Down
126 changes: 126 additions & 0 deletions README.xml
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ There are also optional attributes :
distro This component is only available with the specified OS distribution.
Look at the end of this file for a list of possible values.

if Specify an expression that has to be satisfied. See the BOOL element for more details.

preuninstall The path to an optional pre-uninstall script for the component.

postuninstall The path to an optional post-uninstall script for the component.
Expand Down Expand Up @@ -336,6 +338,67 @@ This element takes one mandatory attribute :
var The name of the environment variable to save.


The BOOL element :

This element allows the user to create some complex expressions to guide the
installer. This element allows the user to define boolean conditions, the values of
which are defined by arbritrary scripts. These booleans can then be used as part
of expressions used by other elements, like FILE or BINARY below, to define conditions.

This element must be a direct child of the root INSTALL element. Booleans are global
to a particular instance of the installer. Additionally, the installer itself defines
a set of standard booleans, as described below.

Booleans are intended to replace the previous filtering mechanisms, using "arch", "libc"
and so on attributes, while providing additional flexibility.

Booleans are case sensitive.

The BOOL element takes one mandatory attribute :

name The symbolic name for the boolean (variable name). May be up to 30 characters
long, and must start with an alphanumerical character. May not contain blank
spaces.

Additionally, one of the following attributes must be used :

script The command to be run to determine the value of the boolean. In the UNIX
tradition, it should return 0 for a TRUE value.

envvar The name of an environment variable to query for the value of the boolean.
The value must be a non-zero number to map to be TRUE. If the variable is not
set in the environment, the boolean will likewise be set to FALSE.

It also recognizes one optional attribute :

later If set to "yes", the script will be executed at the time that the condition
referencing it is evaluated. The default is to run the script once immediately
upon initialization to gather the static value.

Standard booleans defined by the installer :
- Standard 'true' and 'false' booleans.
- 'is-root' is TRUE if the installer is running as root.
- 'reinstalling' is TRUE if the product is already installed.
- 'bzip2' is TRUE if Bzip2 decompression is available in the installer.
- One boolean corresponding to the selected user interface: gtk1, gtk2, carbon, dialog, console
- One boolean for the CPU architecture: x86, ppc, sparc, alpha, etc
- One boolean for the detected libc version: libc5, glibc-2.1, etc.
- One boolean for the distribution / OS name : redhat, suse, aix, sco, etc.
- A boolean for the OS name as returned by uname.
- Two booleans representing the detection distribution version (not always meaningful) :
distro-major-<number> and distro-minor-<number>.
= Booleans for the detected locale setting and its encoding, e.g. en_US, ISO-8859-1, etc.
- On Linux, 'selinux' indicates whether SELinux is available and enabled.
- If RPM support was compiled in, 'rpm-support' is set. If RPM 3.x, then 'rpm3-support' is
also set to TRUE.

For example, on a Redhat Linux 7.3 sytem, the following bools would be defined to TRUE :
Linux, x86, redhat, distro-major-7, distro-minor-3

For more information about how to write expressions referencing these booleans, refer
to "About Boolean Expressions" below.


The REQUIRE element :

This element allows to set prerequisite conditions for the installer, through the
Expand Down Expand Up @@ -368,6 +431,8 @@ This element takes some optional attributes :
distro This component applies only to the specified OS distribution.
Look at the end of this file for a list of possible values.

condition Specify an expression that has to be satisfied. See the BOOL element for more details.

version [only for feature attribute] the minimum integer version number
required for the specified feature.

Expand All @@ -394,6 +459,8 @@ This element takes some optional attributes :
command A shell commands whose return value will determine whether to display the message.
A return value of 0 must be returned for the message to be displayed.

if Specify an expression that has to be satisfied. See the BOOL element for more details.

nogui If set to 'true', then the message will not be displayed in a GUI environment (X11, Mac)

The REMOVE_MSG element :
Expand Down Expand Up @@ -515,6 +582,8 @@ There are several optional attributes of the option element:
distro This option is only available with the specified OS distribution.
Look at the end of this file for a list of possible values.

if Specify an expression that has to be satisfied. See the BOOL element for more details.

size This is an optional size of the install option. The size can be
expressed in megabytes (with a M suffix), kilobytes (K), gigabytes
(G), or even bytes (B, or no suffix). Please note that versions of
Expand Down Expand Up @@ -636,6 +705,9 @@ There are several optional attributes of the binary element:
distro Files are only installed with the specified OS distribution.
Look at the end of this file for a list of possible values.

if Specify an expression that has to be satisfied. See the BOOL
element for more details.

symlink This is a symbolic link that is installed in the system path
and points to the installed binary.

Expand Down Expand Up @@ -742,6 +814,9 @@ There are several optional attributes of the files element:
distro Files are only installed with the specified OS distribution.
Look at the end of this file for a list of possible values.

if Specify an expression that has to be satisfied. See the BOOL
element for more details.

srcpath This is a directory relative to the top of the CD where the files
for this element should be copied from.

Expand Down Expand Up @@ -812,6 +887,22 @@ The following attributes are optional :
symlink A comma-separated list of symbolic links to create for this man page, in the same
section. Use this when your man page covers several commands / functions.

arch "any" is synonymous with the current architecture. You can also
use this attribute to force a precise architecture, for example
"ppc" or "sparc64". Matching can be negated with a leading !,
for instance "!x86".

libc "any" is synonymous with the current libc version. This can
also be used to force a libc version for the binary, i.e
"glibc-2.0" or "glibc-2.1". Matching can be negated with a
leading !, for example "!glibc-2.0".

distro Files are only installed with the specified OS distribution.
Look at the end of this file for a list of possible values.

if Specify an expression that has to be satisfied. See the BOOL
element for more details.

Note that the MANPAGE element does not take any children.
Do not forget to set the "manpages" attribute to the root <install> element to "yes" to be able
to use this feature.
Expand Down Expand Up @@ -839,6 +930,22 @@ There supported attributes for the script element are :
string of this attribute. See 'About localization' below for
more details.

arch "any" is synonymous with the current architecture. You can also
use this attribute to force a precise architecture, for example
"ppc" or "sparc64". Matching can be negated with a leading !,
for instance "!x86".

libc "any" is synonymous with the current libc version. This can
also be used to force a libc version for the binary, i.e
"glibc-2.0" or "glibc-2.1". Matching can be negated with a
leading !, for example "!glibc-2.0".

distro Files are only installed with the specified OS distribution.
Look at the end of this file for a list of possible values.

if Specify an expression that has to be satisfied. See the BOOL
element for more details.

size If the script handles the installation of some files and you want
the progress bar to reflect it, indicate the size here. The size
is updated when the script finishes. The syntax of this element is the
Expand Down Expand Up @@ -921,6 +1028,25 @@ Examples: redhat-7.1 (will match RedHat 7.1 and up)
caldera-3.1-exact (will match Caldera OpenLinux 3.1 only)
linux-2.4 (requires a 2.4.x Linux kernel or above)

About Boolean Expressions :

Many elements support the 'if' or 'condition' attribute to reference complex expressions
using the Setup boolean variables. The expressions have to follow the following syntax:

expression := [!]<operator>(<expression1>,<expression2>) |
[!]<boolean name>

Supported operators are : + (logical "and"), | (logical "or"), and ^ (logical "exclusive or").
Any expression can be negated by a ! prefix.
An undefined boolean is the same as a false boolean.

Some examples :

Match Fedora on PowerPC system:
+(fedora,ppc)
Match one of SuSE, Redhat 9 or Fedora, on all but Intel:
+(^(suse,+(redhat,distro-major-9),fedora),!x86)

About Meta-Installations :

Loki Setup allows you to install several products from the same interface.
Expand Down
Loading

0 comments on commit 0781642

Please sign in to comment.