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
This commit is contained in:
Juan RP 2009-05-05 00:19:25 +02:00
parent e98378b2d5
commit 706782cf0c
2 changed files with 15 additions and 5 deletions

View file

@ -60,7 +60,7 @@ xbps_write_metadata_pkg()
msg_error "Cannot find subpackage template!" msg_error "Cannot find subpackage template!"
fi fi
unset run_depends conf_files keep_dirs noarch triggers \ unset run_depends conf_files keep_dirs noarch triggers \
revision revision openrc_services
. $XBPS_TEMPLATESDIR/${sourcepkg}/${subpkg}.template . $XBPS_TEMPLATESDIR/${sourcepkg}/${subpkg}.template
pkgname=${sourcepkg}-${subpkg} pkgname=${sourcepkg}-${subpkg}
set_tmpl_common_vars set_tmpl_common_vars

View file

@ -146,9 +146,14 @@ _EOF
case "$action" in case "$action" in
install) 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 found=1
cat $XBPS_TEMPLATESDIR/$pkgname/INSTALL >> $tmpf cat ${install_file} >> $tmpf
fi fi
echo "exit 0" >> $tmpf echo "exit 0" >> $tmpf
if [ -z "$found" ]; then if [ -z "$found" ]; then
@ -158,9 +163,14 @@ _EOF
mv $tmpf ${DESTDIR}/INSTALL && chmod 755 ${DESTDIR}/INSTALL mv $tmpf ${DESTDIR}/INSTALL && chmod 755 ${DESTDIR}/INSTALL
;; ;;
remove) 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 found=1
cat $XBPS_TEMPLATESDIR/$pkgname/REMOVE >> $tmpf cat ${remove_file} >> $tmpf
fi fi
echo "exit 0" >> $tmpf echo "exit 0" >> $tmpf
if [ -z "$found" ]; then if [ -z "$found" ]; then