summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2022-01-20 15:54:46 +0200
committerFlorian Festi <ffesti@redhat.com>2022-01-24 12:46:46 +0100
commited61ee28d088299bbd5bc99d2cc104e3979ff32f (patch)
treeaa836dedcbc1b42195dfe5920fd229dc62699266 /docs
parentfc8386be36a32f8462a0d16a2dd3e5e18f7fbc2d (diff)
downloadrpm-ed61ee28d088299bbd5bc99d2cc104e3979ff32f.tar.gz
Support relocatable packages in Lua scriptlets too (#1531)
Pass relocatable package prefixes as RPM_INSTALL_PREFIX Lua table to Lua scriptlets, add a test-case. In Lua, indexes start at 1 rather than 0, so the numbers appear off by one which is annoying, but consistent within Lua and our other similar Lua constructs such as scriptlet arg. Fixes: #1531
Diffstat (limited to 'docs')
-rw-r--r--docs/manual/lua.md4
1 files changed, 4 insertions, 0 deletions
diff --git a/docs/manual/lua.md b/docs/manual/lua.md
index c471e150c..3896c9a20 100644
--- a/docs/manual/lua.md
+++ b/docs/manual/lua.md
@@ -29,6 +29,10 @@ The point? Remember, Lua is embedded in rpm. This means the Lua scriptlets run i
Scriptlet arguments are accessible from a global 'arg' table. Note: in Lua, indexes customarily start at 1 (one) instead of 0 (zero), and for the better or worse, the rpm implementation follows this practise. Thus the scriptlet arg indexes are off by one from general expectation based on traditional scriptlet arguments. The argument containing number of installed package instances is arg[2] and the similar argument for trigger targets is arg[3], whereas traditionally they are 1 and 2 (eg $1 and $2 in shell scripts).
+Scriptlets of relocatable packages additionally carry a global
+`RPM_INSTALL_PREFIX` table containing all the possible prefixes of the
+package. (rpm >= 4.18.0)
+
While scriptlets shouldn't be allowed to fail normally, you can signal scriptlet failure status by using Lua's error(msg, [level]) function if you need to. As <lua> scriptlets run within the rpm process itself, care needs to be taken within the scripts - eg os.exit() must not be called (see ticket #167). In newer rpm versions (>= 4.9.0) this is not an issue as rpm protects itself by returning errors on unsafe os.exit() and posix.exec().
## Lua macros