Implement support for {INSTALL,REMOVE}.msg files (fix #454).

This commit is contained in:
Juan RP 2014-09-15 16:18:46 +02:00
parent 10cb7ff95e
commit c2b011a98a
2 changed files with 23 additions and 0 deletions

View file

@ -681,6 +681,18 @@ as `srcpkgs/<pkgname>/<subpkg>.INSTALL` or `srcpkgs/<pkgname>/<subpkg>.REMOVE` r
> NOTE: always use paths relative to the current working directory, otherwise if the scripts cannot
be executed via `chroot(2)` won't work correctly.
> NOTE: do not use INSTALL/REMOVE scripts to print messages, see the next section for
more information.
### INSTALL.msg and REMOVE.msg files
The `INSTALL.msg` and `REMOVE.msg` files can be used to print a message at post-install
or pre-remove time, respectively.
Ideally those files should not exceed 80 chars per line.
subpackages can also have their own `INSTALL.msg` and `REMOVE.msg` files, simply create them
as `srcpkgs/<pkgname>/<subpkg>.INSTALL.msg` or `srcpkgs/<pkgname>/<subpkg>.REMOVE.msg` respectively.
### Creating system accounts/groups at runtime

View file

@ -329,15 +329,26 @@ hook() {
if [ -n "${sourcepkg}" -a "${sourcepkg}" != "${pkgname}" ]; then
# subpkg
meta_install=${XBPS_SRCPKGDIR}/${pkgname}/${pkgname}.INSTALL
msg_install=${XBPS_SRCPKGDIR}/${pkgname}/${pkgname}.INSTALL.msg
meta_remove=${XBPS_SRCPKGDIR}/${pkgname}/${pkgname}.REMOVE
msg_remove=${XBPS_SRCPKGDIR}/${pkgname}/${pkgname}.REMOVE.msg
else
# sourcepkg
meta_install=${XBPS_SRCPKGDIR}/${pkgname}/INSTALL
msg_install=${XBPS_SRCPKGDIR}/${pkgname}/INSTALL.msg
meta_remove=${XBPS_SRCPKGDIR}/${pkgname}/REMOVE
msg_remove=${XBPS_SRCPKGDIR}/${pkgname}/REMOVE.msg
fi
process_metadata_scripts install ${meta_install} || \
msg_error "$pkgver: failed to write INSTALL metadata file!\n"
process_metadata_scripts remove ${meta_remove} || \
msg_error "$pkgver: failed to write REMOVE metadata file!\n"
if [ -s ${msg_install} ]; then
install -m644 ${msg_install} ${PKGDESTDIR}
fi
if [ -s ${msg_remove} ]; then
install -m644 ${msg_remove} ${PKGDESTDIR}
fi
}