[go: up one dir, main page]

File: starch.m4

package info (click to toggle)
cctools 7.1.2-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 43,744 kB
  • sloc: ansic: 187,336; cpp: 20,196; python: 18,633; sh: 11,159; xml: 3,688; perl: 2,817; makefile: 1,105
file content (135 lines) | stat: -rw-r--r-- 4,150 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
include(manual.h)dnl
HEADER(starch)

SECTION(NAME)
BOLD(starch) - STandalone application ARCHiver

SECTION(SYNOPSIS)
CODE(BOLD(starch [options] PARAM(sfx_path)))

SECTION(DESCRIPTION)

BOLD(Starch) is a script that creates standalone application archives in the
form of self-extracting executables (CODE(SFX)). Users may specify the command,
executables, libraries, data, and environment scripts associated with the
application by specifying the appropriate command line options or by using a
configuration file.  BOLD(starch) is particularly useful for distributed
computing, in that it makes an executable portable across different
operating system variants.

SECTION(OPTIONS)

To create a CODE(SFX), simply specify the name of the CODE(SFX) to create along
with the PARAM(command) to execute and any other dependencies such as
PARAM(executables), PARAM(libraries), PARAM(data), or PARAM(environment)
scripts.
PARA
If a PARAM(command) is specified, but no PARAM(executable) is passed, then the
first token in the PARAM(command) will be used as the executable.
PARA
By default, CODE(starch) will use CODE(ldd) to detect any necessary libraries
from the specified set of PARAM(executables) and include them in the CODE(SFX).
OPTIONS_BEGIN
OPTION_ITEM(-A)Do not automatically detect library dependencies.
OPTION_PAIR(-C, cfg)Use configuration file.
OPTION_PAIR(-c, cmd)Specify command to execute.
OPTION_PAIR(-d, npath:opath)Add data (new path:old path).
OPTION_PAIR(-e, env)Add environment script.
OPTION_PAIR(-l, lib)Add library.
OPTION_PAIR(-x, exe)Add executable.
OPTION_ITEM(-h)Show help message and exit.
OPTION_ITEM(-v)Display verbose messages (default: False).
OPTIONS_END
Once a CODE(SFX) is generated, you can use it as a normal executable.

SECTION(CONFIGURATION FILE)
The command line options may be stored in a configuration file and passed to
starch using the CODE(starch -C) option.  The format of the configuration file is as
follows:
LONGCODE_BEGIN
[starch]
executables = echo date hostname
libraries   = libz.so
data        = hosts.txt:/etc/hosts localtime:/etc/localtime images:/usr/share/pixmaps
command     = echo $(hostname) $(date $@)
LONGCODE_END

SECTION(ENVIRONMENT VARIABLES)

The following environment variables will affect the execution of the CODE(SFX)
generated by CODE(starch):

SUBSECTION(SFX_DIR)
Determines the target directory where the CODE(SFX) will be extracted.  By
default this is CODE(/tmp/$hostname.$user.$basename.dir).

SUBSECTION(SFX_EXTRACT_ONLY)
Only extract the CODE(SFX).  By default it is extracted and executed.

SUBSECTION(SFX_EXTRACT_FORCE)
Extract the CODE(SFX) even if the CODE(SFX_DIR) exists. This is disabled by
default to as an optimization to avoid unnecessarily extracting.

SUBSECTION(SFX_KEEP)
Keep extracted files.  By default the files will be removed after execution.

SUBSECTION(SFX_UNIQUE)

Use CODE(mktempd) to generate a unique CODE(SFX_DIR) target directory. This
will prevent CODE(SFX_KEEP) from working properly since the names will change
in between invocations.

SECTION(EXIT STATUS)
On success, returns zero.  On failure, returns non-zero.

SECTION(EXAMPLES)

Package the date program:
LONGCODE_BEGIN
    $ starch -c date -x date date.sfx
LONGCODE_END

Package the date program using a configuration file:
LONGCODE_BEGIN
    $ cat data.cfg
    [starch]
    executables = date
    command = date
    $ starch -C date.cfg date.sfx
LONGCODE_END

Run standalone date program with parameters:
LONGCODE_BEGIN
    $ ./date.sfx +%s
LONGCODE_END

Only extract the archive:
LONGCODE_BEGIN
    $ env SFX_EXTRACT_ONLY=1 ./date.sfx
LONGCODE_END

Run and keep extracted directory:
LONGCODE_BEGIN
    $ env SFX_KEEP=1 ./date.sfx
LONGCODE_END

Run with unique directory:
LONGCODE_BEGIN
    $ env SFX_UNIQUE=1 ./date.sfx
LONGCODE_END

Advanced example involving a complex shell command:
LONGCODE_BEGIN
    $ starch -v -x tar -x rm  -c 'tar_test() { for f in $@; do if ! tar xvf $f; then exit 1; fi; done; rm $@'; }; tar_test' extract_and_remove.sfx
    $ ./extract_and_remove.sfx *.tar.gz
LONGCODE_END

SECTION(COPYRIGHT)

COPYRIGHT_BOILERPLATE

SECTION(SEE ALSO)

SEE_ALSO_MAKEFLOW

FOOTER