Mon, 28 Jan 2013 17:37:18 +0100
Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.
2 =pod
4 =head1 NAME
6 B<openpkg register> - OpenPKG Registry Command-Line Client
8 =head1 SYNOPSIS
10 B<register> [-u|--user=<user|token>] [-l|--link=<token>] [I<-d|--desc=<text>>]
11 [-m|--mode=fake|post|wipe] [I<-a|--args=<args>>]
12 [I<--plat=<text>>] [I<--orel=<text>>] [I<--uuid=<file>>]
13 [I<--conf=<file>>] [I<--prep=<file>>] [I<--tran=<file>>]
14 [I<--util=<file>>] [--data=<tag>[,<tag>...]]
15 [I<-P|--preparation>] [I<-T|--transaction>]
16 [I<-U|--utilization>] [I<-C|--convenience>]
17 [I<-I|--interaction>]
18 [I<-v|--verbose>] [I<-h|--help>]
20 B<register> -S|--printstatus
22 B<register> -R|--rewriteurls [I<url> ...]
24 =head1 DESCRIPTION
26 B<openpkg register> is the Command-Line Client the OpenPKG Registry. It is
27 used by administrators to register an instance with the OpenPKG Registry for
28 later association.
30 After association, B<openpkg register> can be used for repetitive
31 reregistrations which update the heartbeat of the instance on the Registry
32 server, avoiding premature depature from the database. It is assumed that
33 every instance will be reregistered daily. Dormant
34 instances might be discarded from the Registry, revoking their access to
35 additional resources.
37 =head1 PRIMARY OPERATIONS
39 The following primary operations are available:
41 =over 4
43 =item B<-h>, B<--help>
45 Display brief usage message.
47 =item B<-v>, B<--verbose>
49 Display progress information during data posting.
51 =item B<-P>, B<--preparation>
53 Execute the primary operation "preparation".
54 Creates registry data for one request and dumps it stdout
55 in XML format. That request can be filtered and piped into
56 the transaction phase or it can be copied and pasted into the
57 XMLdump CGI facility manually.
58 A copy of the output of the last run is also saved to the C<${REGISTRY_PREP}> file.
60 =item B<-T>, B<--transaction>
62 Execute the primary operation "transaction".
63 Reads registry data with one request from stdin, executes
64 the transaction and writes registry data with one or more
65 responses to stdout in XML format.
66 Depending on the mode of operation, the transaction might be an actual
67 transport to the XMLdump CGI facility or a fake activity which complements the
68 manual preparation.
69 A copy of the output of the last run is also saved to the C<${REGISTRY_TRAN}> file.
71 =item B<-U>, B<--utilization>
73 Execute the primary operation "utilization".
74 Reads registry data with one response from stdin and updates the local
75 registry information.
76 Depending on the mode of operation, the utilization might be an actual
77 processing of a transaction response or a fake activity which complements the
78 manual transaction.
79 Anyway, this step finalizes the registration process and makes the instance
80 assume it has been properly registered. This status can be printed. URL
81 rewriting is activated.
82 A copy of the output of the last run is also saved to the C<${REGISTRY_UTIL}> file.
84 =item B<-C>, B<--convenience>
86 Execute the primary operation "convenience".
87 This executes the three primary operations "preparation", "transaction" and
88 "utilization" in that order and pipes data through this chain.
90 =item B<-I>, B<--interaction>
92 Execute the primary operation "interaction".
93 Like "convenience" but user is interactively asked for information. This is
94 the easiest way to do registration but it is not meat to be automated.
96 =item B<-S>, B<--printstatus>
98 If the instance has been registered, information about the registration is printed in a
99 format suitable for shell evaluation and return code is true.
100 Otherwise nothing is printed and return code is false.
102 =item B<-R>, B<--rewriteurls> [I<url> ...]
104 If the instance has been registered, the given URLs are rewritten to prepend
105 user:pass information before hostnames below the openpkg.(org|net|com)
106 domains. Note the username is is UUID_REGISTRY and the password is the
107 concatenation of UUID_INSTANCE and UUID_PLATFORM from the
108 PREFIX/etc/openpkg/uuid file. Both informations are not meant to be used for
109 traditional authentication, they are merly statistical information.
110 Otherwise the URLs are returned verbatim.
112 =back
114 =head1 STANDARD OPTIONS
116 Standard options are typically used to automate registration (not
117 association).
119 =over 4
121 =item B<-m>, B<--mode> fake|post|wipe
123 Overrides C<${REGISTRY_MODE}> variable in C<${REGISTRY_CONF}> file.
124 Has no default and is a manadatory setting.
126 In B<post> mode, transactions are carried out using real network connectivity.
127 The "preparation" step creates a XMLdump and writes it into the
128 C<${REGISTRY_PREP}> file. The "transaction" step posts it to the DropXML form
129 using a HTTP request. The response coming back from Registration server is
130 also in XML format and is saved to C<${REGISTRY_TRAN}> file. The
131 "utilization" step processes this response and writes the final results to the
132 C<${REGISTRY_UTIL}> file.
134 In B<fake> mode, no network connectivity takes place.
135 The "prepararation" step creates a XMLdump and writes it into the
136 C<${REGISTRY_PREP}> file. The "transaction" step is a fake only. It assumes a
137 successful response from the Registration server and saves it to
138 C<${REGISTRY_TRAN}> file. The "utilization" step processes this response and
139 writes the final results to the C<${REGISTRY_UTIL}> file.
140 I<Note>: fake mode is meant as a way to register instances which cannot or must
141 not post data directly to the Registration server.
143 In B<wipe> mode, the registration is wiped out locally. The status is reset
144 and URL rewriting is disabled.
145 I<Note>: the registration server is not contacted, the instace must be removed
146 manually using the web interface.
147 I<Note>: wiping registration is highly recommended as a precursor action of
148 cloning activities.
150 =item B<-a>, B<--args> "arg [arg ...]"
152 Overrides C<${REGISTRY_ARGS}> variable in C<${REGISTRY_CONF}> file.
153 Complements the mode and is specific to it.
154 Defaults to "http://registry.openpkg.org/register" which is the official registry of the OpenPKG Project.
155 This default is useful for "post" mode.
157 =item B<-u>, B<--user> I<user|token>
159 Overrides C<${REGISTRY_USER}> variable in C<${REGISTRY_CONF}> file.
160 Indicates the registry user which will find this registration in his arrival queue.
161 The user can also specified as a token which is enabled for use as "user".
162 If the token is also enabled for "assoc" the registered instance is immediately associated
163 to the user with no need for the user to visit the web interface.
164 This information in submitted via the "registry_user" attribute of the XML request.
165 Retrieves default online from http://openpkg.org/go/autoregister and is a manadatory setting.
167 =item B<-l>, B<--link> I<token>
169 Overrides C<${REGISTRY_LINK}> variable in C<${REGISTRY_CONF}> file.
170 Indicates the registry user which will find this registration linked to his token.
171 The link must be specified as a token which is enabled for use as "link".
172 If a user token is used and the link token is also enabled for "assoc" then the registered instance
173 is immediately associated to the user with no need for the user to visit the web interface.
174 This information in submitted via the "registry_link" attribute of the XML request.
175 Has no default and is an optional setting.
176 Be aware that linked users see the same information about an instance as the associated user
177 can find on his "association" page but they cannot alter or delete information.
179 =item B<-d>, B<--desc> I<description>
181 Overrides C<${REGISTRY_DESC}> variable in C<${REGISTRY_CONF}> file.
182 Indicates a human readable description of the instance.
183 This information in submitted via the "registry_desc" attribute of the XML request.
184 It appears in the "description" column on the "association" page of the web form and can be edited on the server side.
185 Defaults to "openpkg://${FQDN}${PREFIX}"
187 =back
189 =head1 ADVANCED OPTIONS
191 Advanced options can be enganged to tailor and fully automate a registration
192 (not association).
194 =over 4
196 =item B<--plat>
198 Overrides C<${REGISTRY_PLAT}> variable in C<${REGISTRY_CONF}> file.
199 Indicates the platform. Concatenated information from CPU architecture (arch) and Operating System (os).
200 This information in submitted via the "registry_plat" attribute of the XML request.
201 Defaults to "%{l_platform -p}", e.g. "ix86-freebsd6.1"
203 =item B<--orel>
205 Overrides C<${REGISTRY_VERS}> variable in C<${REGISTRY_CONF}> file.
206 Indicates the OpenPKG release.
207 This information in submitted via the "registry_orel" attribute of the XML request.
208 Defaults to "%{l_openpkg_release}", e.g. "OpenPKG-CURRENT", "OpenPKG-2-STABLE", "OpenPKG-2.5",
210 =item B<--uuid>
212 Overrides C<${REGISTRY_UUID}> variable in C<${REGISTRY_CONF}> file.
213 Indicates the UUID file of the instance.
214 This information in submitted via the "uuid_registry", "uuid_instance" and "uuid_platform" attributes of the XML request.
215 Defaults to F<${PREFIX}/etc/openpkg/uuid>
217 =item B<--conf>
219 Overrides C<${REGISTRY_CONF}> variable from previous C<${REGISTRY_CONF}> file. Processing
220 of the current configuration file is aborted immediately with all variables
221 read so far kept. THe new configuration file is read in immediately and
222 processing continues there. This works similar to an include but is more
223 primitive as it does not allow nesting, only chaining.
224 Defaults to F<${PREFIX}/etc/openpkg/register.conf>
226 =item B<--prep>
228 Overrides C<${REGISTRY_PREP}> variable in C<${REGISTRY_CONF}> file.
229 File to save a copy of the output from the "preparation" step.
230 Defaults to F<${PREFIX}/etc/openpkg/register.prep>
232 =item B<--tran>
234 Overrides C<${REGISTRY_TRAN}> variable in C<${REGISTRY_CONF}> file.
235 File to save a copy of the output from the "transaction" step.
236 Defaults to F<${PREFIX}/etc/openpkg/register.tran>
238 =item B<--util>
240 Overrides C<${REGISTRY_UTIL}> variable in C<${REGISTRY_CONF}> file.
241 File to save a copy of the output from the "utilization" step.
242 Defaults to F<${PREFIX}/etc/openpkg/register.util>
244 =item B<--data>
246 Overrides C<${REGISTRY_DATA}> variable in C<${REGISTRY_CONF}> file.
247 Comma separated list of tags to prepare. Available tags are "request",
248 "package" and "provides". The "request" refers to the whole thing and
249 is mandatory. The "package" includes name-version-release information
250 for all installed packages and "provides" adds more details required to
251 capture package options. For details see OPENPKG_PREP below.
252 Defaults to "request,package,provides"
254 =back
256 =head1 FILES
258 The following files are used by B<openpkg register>:
260 =over 4
262 =item OPENPKG_UUID=F<${PREFIX}/etc/openpkg/uuid>
264 UUID_REGISTRY="..."
265 UUID_INSTANCE="..."
266 UUID_PLATFORM="..."
268 =item OPENPKG_CONF=F<${PREFIX}/etc/openpkg/register.conf>
270 Format suitable for shell evaluation. Interactive mode appends remarked date
271 and current settings for reuse as new defaults for future runs. Can be preset
272 to customize or automate registration.
274 =item OPENPKG_PREP=F<${PREFIX}/etc/openpkg/register.prep>
276 <?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
277 <!DOCTYPE registry
278 PUBLIC "-//OpenPKG//DTD OpenPKG Registry 0.0.1//EN"
279 "http://registry.openpkg.org/registry.dtd" []>
280 <registry>
281 <request id="..."
282 registry_user="me@example.com"
283 registry_desc="openpkg://rm0.openpkg.net/openpkg-dev"
284 registry_plat="ix86-freebsd6.1"
285 registry_orel="OpenPKG-CURRENT"
286 uuid_registry="..."
287 uuid_instance="..."
288 uuid_platform="..."
289 />
290 <package id="..." name="ssmtp" version="2.61" release="20050608">
291 <provides name="ssmtp::with_ssl" flag="=" version="no"/>
292 <provides name="MTA" flag="" version=""/>
293 <provides name="ssmtp" flag="=" version="2.61-20050608"/>
294 </package>
295 </registry>
297 The XML request starts with <?xml version ...> and <!DOCTYPE registry ...>
298 headers followed by a <registry> container. The request is inside a <request>
299 tag. Successful submission into the XMLdump form requires the headers and
300 exactly one container. It is possible to merge multiple requests into a single
301 container manually or otherwise and submit them all at once.
303 =item OPENPKG_TRAN=F<${PREFIX}/etc/openpkg/register.tran>
305 <?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
306 <!DOCTYPE registry
307 PUBLIC "-//OpenPKG//DTD OpenPKG Registry 0.0.1//EN"
308 "http://registry.openpkg.org/registry.dtd" []>
309 <registry>
310 <response id="..." done="yes">openpkg://rm0.openpkg.net/openpkg-dev</response>
311 </registry>
313 The XML response starts with <?xml version ...> and <!DOCTYPE registry ...>
314 headers followed by a <registry> container. The response is inside a <request>
315 tag. The data carried in the tag comes from the "description" column on the
316 "association" page of the web form and can be edited on the server side.
318 =item OPENPKG_UTIL=F<${PREFIX}/etc/openpkg/register.util>
320 REGISTRY_DBID="..."
321 REGISTRY_DONE="yes"
322 REGISTRY_RESP="openpkg://foo.example.com/my/openpkg/prefix"
324 =back
326 =head1 EXAMPLES
328 # su - openpkg-mop
329 $ openpkg register --printstatus
330 REGISTRY_DBID="..."
331 REGISTRY_DONE="yes"
332 REGISTRY_RESP="openpkg://foo.example.com/my/openpkg/prefix"
333 $ openpkg register --printstatus >/dev/null && echo "Yup"
334 Yup
335 $ eval `openpkg register --printstatus`; echo DONE=$REGISTRY_DONE
336 DONE=yes
337 $ openpkg register --mode=wipe
338 $ openpkg register --printstatus || echo "Nope"
339 Nope
340 $ openpkg register --user=thl@openpkg.net --mode=post
341 REGISTRY_DBID="...."
342 REGISTRY_DONE="yes"
343 REGISTRY_RESP="openpkg://foo.example.com/my/openpkg/prefix"
344 $ openpkg register --printstatus >/dev/null && echo "Yup"
345 Yup
346 $ openpkg register --rewriteurls http://download.openpkg.org/foo/bar
347 ftp://...:...@download.openpkg.org/foo/bar
349 =head1 SEE ALSO
351 bash(1), C<openpkg man uuid>, C<http://registry.openpkg.org/>
353 =head1 AUTHOR
355 Thomas Lotterer E<lt>thl@openpkg.orgE<gt>
357 =cut