package kit: Add pre-uninstall scripts feature.

Just like post-install scripts which run shortly after a package is
installed, pre-uninstall scripts are run just before a package is
removed.  Implements enhancement #13427

* Fix script exit code handling vs script launch errors.
* Bump package and repo file version numbers due to new attribute,
  unfortunately makes new .hpkg files not backwards compatible.
* Add pre-uninstall functionality, mostly cloning the post-install
  except in a few places.
* Discover that _RunQueuedScripts() is never called, a future TODO:?
* Update package documentation for pre-uninstall scripts, and use of
  the boot/post-install directory.

Change-Id: I45596255ce74bc102f6e5b606cbf83e4e4347a17
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1504
Reviewed-by: Alexander G. M. Smith <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
Alexander G. M. Smith
2020-09-21 10:47:57 +00:00
committed by Adrien Destugues
parent e6f60cad2a
commit a22fa0c977
18 changed files with 178 additions and 39 deletions
+15 -4
View File
@@ -87,7 +87,7 @@ total_size
minor_version
The minor version of the HPKG format the file conforms to. The current minor
version is 0 (B_HPKG_MINOR_VERSION). Additions of new attributes to the
version is 1 (B_HPKG_MINOR_VERSION). Additions of new attributes to the
attributes or TOC sections should generally only increment the minor version.
When a file with a greater minor version is encountered, the reader should
ignore unknown attributes.
@@ -915,7 +915,18 @@ B_HPKG_ATTRIBUTE_ID_PACKAGE_POST_INSTALL_SCRIPT ("package:post-install-script")
:Value: Relative path of a script that shall be executed after package
activation.
:Allowed Values: Installation location relative path of a file included in the
package.
package. Must start with "boot/post-install/", so besides being run after
package installation, it also gets run on the first boot after the OS is
installed.
:Child Attributes: none
B_HPKG_ATTRIBUTE_ID_PACKAGE_PRE_UNINSTALL_SCRIPT ("package:pre-uninstall-script")
:Type: string
:Value: Relative path of a script that shall be executed before package
deactivation.
:Allowed Values: Installation location relative path of a file included in
the package. For consistency, it is recommended to start with
"boot/pre-uninstall/".
:Child Attributes: none
Haiku Package Repository Format
@@ -994,8 +1005,8 @@ total_size
minor_version
The minor version of the HPKR format the file conforms to. The current minor
version is 0 (B_HPKG_REPO_MINOR_VERSION). Additions of new attributes to the
attributes section shouldgenerally only increment the minor version. When a
version is 1 (B_HPKG_REPO_MINOR_VERSION). Additions of new attributes to the
attributes section should generally only increment the minor version. When a
file with a greater minor version is encountered, the reader should ignore
unknown attributes.