From 706782cf0c7829bd87ef3d939beed7437932449e Mon Sep 17 00:00:00 2001 From: Juan RP Date: Tue, 5 May 2009 00:19:25 +0200 Subject: [PATCH] shutils: allow subpkgs to use INSTALL/REMOVE scripts. subpkgs to use them need to have ${pkgname}.INSTALL/REMOVE scripts on the directory. --HG-- extra : convert_revision : 293def453dd17d5bbdd68c9b25f8f2f16d673a8e --- shutils/metadata.sh | 2 +- shutils/metadata_scripts.sh | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/shutils/metadata.sh b/shutils/metadata.sh index 955ca799705..1db55660e75 100644 --- a/shutils/metadata.sh +++ b/shutils/metadata.sh @@ -60,7 +60,7 @@ xbps_write_metadata_pkg() msg_error "Cannot find subpackage template!" fi unset run_depends conf_files keep_dirs noarch triggers \ - revision + revision openrc_services . $XBPS_TEMPLATESDIR/${sourcepkg}/${subpkg}.template pkgname=${sourcepkg}-${subpkg} set_tmpl_common_vars diff --git a/shutils/metadata_scripts.sh b/shutils/metadata_scripts.sh index be207285212..80ecd4a3c25 100644 --- a/shutils/metadata_scripts.sh +++ b/shutils/metadata_scripts.sh @@ -146,9 +146,14 @@ _EOF case "$action" in install) - if [ -f "$XBPS_TEMPLATESDIR/$pkgname/INSTALL" ]; then + if [ -n "${sourcepkg}" -a "${sourcepkg}" != "${pkgname}" ]; then + install_file=${XBPS_TEMPLATESDIR}/${pkgname}/${pkgname}.INSTALL + else + install_file=${XBPS_TEMPLATESDIR}/${pkgname}/INSTALL + fi + if [ -f ${install_file} ]; then found=1 - cat $XBPS_TEMPLATESDIR/$pkgname/INSTALL >> $tmpf + cat ${install_file} >> $tmpf fi echo "exit 0" >> $tmpf if [ -z "$found" ]; then @@ -158,9 +163,14 @@ _EOF mv $tmpf ${DESTDIR}/INSTALL && chmod 755 ${DESTDIR}/INSTALL ;; remove) - if [ -f "$XBPS_TEMPLATESDIR/$pkgname/REMOVE" ]; then + if [ -n "${sourcepkg}" -a "${sourcepkg}" != "${pkgname}" ]; then + remove_file=${XBPS_TEMPLATESDIR}/${pkgname}/${pkgname}.REMOVE + else + remove_file=${XBPS_TEMPLATESDIR}/${pkgname}/REMOVE + fi + if [ -f ${remove_file} ]; then found=1 - cat $XBPS_TEMPLATESDIR/$pkgname/REMOVE >> $tmpf + cat ${remove_file} >> $tmpf fi echo "exit 0" >> $tmpf if [ -z "$found" ]; then