1 | #------------------------------------------------------------------------
|
---|
2 | # Macros to handle creation/deletion of WPS objects from %post* sections.
|
---|
3 | # There are four single macros:
|
---|
4 | #
|
---|
5 | # %wps_object_create OBJECTID:SPECIFICATION
|
---|
6 | # %wps_object_create_batch < FILE
|
---|
7 | # %wps_object_delete OBJECTID
|
---|
8 | # %wps_object_delete_all
|
---|
9 | #
|
---|
10 | # And a pair of begin-end macros:
|
---|
11 | #
|
---|
12 | # %wps_object_create_begin
|
---|
13 | # OBJECTID:SPECIFICATION
|
---|
14 | # OBJECTID:SPECIFICATION
|
---|
15 | # ...
|
---|
16 | # %wps_object_create_end
|
---|
17 | #
|
---|
18 | # All macros (except %wps_object_create_end) accept the -n option that
|
---|
19 | # specifies the full package name (defaults to %{name}). The -n option
|
---|
20 | # must be always used for subpackages as there is no way to detect the
|
---|
21 | # subpackage name automatically.
|
---|
22 | #
|
---|
23 | # OBJECTID is an object identifier (w/o angle brackets). SPECIFICATION is
|
---|
24 | # a string that describes the properties of the object to create and has
|
---|
25 | # the following format:
|
---|
26 | #
|
---|
27 | # CLASSNAME|TITLE|LOCATION[|SETUP[|OPTION]]
|
---|
28 | #
|
---|
29 | # Each component of this format string directly corresponds to the
|
---|
30 | # respective argument of the SysCreateObject REXX function. Refer to
|
---|
31 | # to the REXX reference manual for details.. Note that when OPTION is not
|
---|
32 | # specified, U (update) mode is used by default.
|
---|
33 | #
|
---|
34 | # FILE is a text file used to create multiple objects at once: each line
|
---|
35 | # in this file is an object ID followed by the specification (as described
|
---|
36 | # above except that no quotes needed), like this:
|
---|
37 | #
|
---|
38 | # OBJECTID:SPECIFICATION
|
---|
39 | #
|
---|
40 | # The pair of begin-end macrs serves for the same purpose but doesn't require
|
---|
41 | # an external file (see below for an example).
|
---|
42 | #
|
---|
43 | # The indirect FILE or begin-end form is preferred and even required if one
|
---|
44 | # of the object parameters contains a double forward slash (e.g. 'http://foo')
|
---|
45 | # because otherwise the Classic REXX interpreter will treat it as a start of
|
---|
46 | # the comment block and fail.
|
---|
47 | #
|
---|
48 | # Note that RPM tracks reference counting for each created object so you
|
---|
49 | # may e.g. share a single WPS folder among several packages -- by creating a
|
---|
50 | # folder with the same object ID in each package's %post section and
|
---|
51 | # deleting it in its %postun section -- the folder will be actually removed
|
---|
52 | # from the desktop only when the last package that creates it gets
|
---|
53 | # uninstalled.
|
---|
54 | #
|
---|
55 | # Note also that each object is automatically associated with the package
|
---|
56 | # it is created for so that %wps_object_delete_all knows what objects
|
---|
57 | # to delete when you call it from %postun.
|
---|
58 | #
|
---|
59 | # Some object parameters (the LOCATION string or parts of the SETUP string such
|
---|
60 | # as EXENAME) require valid OS/2 path strings as values, with back slashes
|
---|
61 | # instead of forward slashes and @unixroot expanded to a full path. You may
|
---|
62 | # cause this expansion by enclosing the respective part of the string in double
|
---|
63 | # parenthesis. Note that double parenthesis may not be nested.
|
---|
64 | #
|
---|
65 | # Examples:
|
---|
66 | #
|
---|
67 | # %post
|
---|
68 | # ...
|
---|
69 | # # create objects one by one...
|
---|
70 | # %wps_object_create MYAPP_FOLDER:WPFolder|My App %{version}|<WP_DESKTOP>
|
---|
71 | # %wps_object_create MYAPP_EXE:WPProgram|My App|<MYAPP_FOLDER>|EXENAME=((${_bindir}/myapp.exe))
|
---|
72 | #
|
---|
73 | # # ...or all at once
|
---|
74 | # %wps_object_create_begin
|
---|
75 | # MYAPP_README:WPProgram|Read Me|<MYAPP_FOLDER>|EXENAME=e.exe;PROGTYPE=PROG_PM;PARAMETERS=(({_%docdir}/%{name}/README));OPEN=RUNNING
|
---|
76 | # MYAPP_URL:WPUrl|myapp.example.com|<MYAPP_FOLDER>|URL=http://myapp.example.com
|
---|
77 | # %wps_object_create_end
|
---|
78 | #
|
---|
79 | # %postun
|
---|
80 | # ...
|
---|
81 | # # delete all objects created for this package with wps_object_create*
|
---|
82 | # %wps_object_delete_all
|
---|
83 | #
|
---|
84 | # # create objects for the subpackage 'sub'
|
---|
85 | # %post sub
|
---|
86 | # %wps_object_create -n %{name}-sub MYAPP_EXE:WPProgram|My Sub App|<MYAPP_FOLDER>|EXENAME=((${_bindir}/mysubapp.exe))
|
---|
87 | #
|
---|
88 | # # delete objects for the subpackage 'sub'
|
---|
89 | # %postun sub
|
---|
90 | # %wps_object_delete_all -n %{name}-sub
|
---|
91 | #
|
---|
92 |
|
---|
93 | %wps_object_create(n:) %{_rpmconfigdir_os2}/wps-object.exe /create %{!-n:%{name}}%{-n:%{-n*}} "%{*}"\
|
---|
94 | %{nil}
|
---|
95 |
|
---|
96 | %wps_object_create_batch(n:) %{_rpmconfigdir_os2}/wps-object.exe /create %{!-n:%{name}}%{-n:%{-n*}} %{*}\
|
---|
97 | %{nil}
|
---|
98 |
|
---|
99 | %wps_object_delete(n:) %{_rpmconfigdir_os2}/wps-object.exe /delete %{!-n:%{name}}%{-n:%{-n*}} "%{*}"\
|
---|
100 | %{nil}
|
---|
101 |
|
---|
102 | %wps_object_delete_all(n:) %{_rpmconfigdir_os2}/wps-object.exe /deleteall %{!-n:%{name}}%{-n:%{-n*}}\
|
---|
103 | %{nil}
|
---|
104 |
|
---|
105 | %wps_object_create_begin(n:) %{_rpmconfigdir_os2}/wps-object.exe /create %{!-n:%{name}}%{-n:%{-n*}} <<'EOF'\
|
---|
106 | %{nil}
|
---|
107 |
|
---|
108 | %wps_object_create_end EOF\
|
---|
109 | ###
|
---|
110 |
|
---|
111 | #------------------------------------------------------------------------
|
---|
112 | # Macros to check for conflicts with installed WarpIn packages.
|
---|
113 | #
|
---|
114 | # %warpin_conflicts_begin
|
---|
115 | # Vendor\Application\ConflictingPackage1
|
---|
116 | # Vendor\Application\ConflictingPackage2
|
---|
117 | # ...
|
---|
118 | # %warpin_conflicts_end
|
---|
119 | #
|
---|
120 | # This pair of begin-end macros takes a list of WarpIn package IDs in between
|
---|
121 | # and aborts the current scriptlet if any of these packages is installed.
|
---|
122 | # A message containing the name and the version of the detected conflicting
|
---|
123 | # package, if any, is printed to the console. This pair of macros is intended
|
---|
124 | # to be used in %pre sections of .spec files so that it is able to abort the
|
---|
125 | # installation if there are conflicts.
|
---|
126 | #
|
---|
127 |
|
---|
128 | %warpin_conflicts_begin \{ %{_rpmconfigdir_os2}/warpin-conflicts.exe <<'EOF'\
|
---|
129 | %{nil}
|
---|
130 |
|
---|
131 | %warpin_conflicts_end EOF\
|
---|
132 | \} || exit $?
|
---|