diff --git a/Manual.md b/Manual.md index f3d1c548bfc..4bd95711129 100644 --- a/Manual.md +++ b/Manual.md @@ -681,6 +681,18 @@ as `srcpkgs//.INSTALL` or `srcpkgs//.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//.INSTALL.msg` or `srcpkgs//.REMOVE.msg` respectively. ### Creating system accounts/groups at runtime diff --git a/common/hooks/post-install/04-create-xbps-metadata-scripts.sh b/common/hooks/post-install/04-create-xbps-metadata-scripts.sh index 1da3d8b7873..48855cd98c6 100644 --- a/common/hooks/post-install/04-create-xbps-metadata-scripts.sh +++ b/common/hooks/post-install/04-create-xbps-metadata-scripts.sh @@ -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 }