Pass the ${UPDATE} argument to the triggers, to support restarting

services while upgrading packages.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091002152419-qo4i4qpp8ba8qxqd
This commit is contained in:
Juan RP 2009-10-02 17:24:19 +02:00
parent ca2dd0f873
commit 1c076967d4

View File

@ -40,11 +40,12 @@ xbps_write_metadata_scripts_pkg()
cat >> $tmpf <<_EOF cat >> $tmpf <<_EOF
#!/bin/sh -e #!/bin/sh -e
# #
# Generic INSTALL/REMOVE script. # Generic INSTALL/REMOVE script. Arguments passed to this script:
# #
# \$1 = action # \$1 = ACTION [pre/post]
# \$2 = pkgname # \$2 = PKGNAME
# \$3 = version # \$3 = VERSION
# \$4 = UPDATE [yes/no]
# #
# Note that paths must be relative to CWD, to avoid calling # Note that paths must be relative to CWD, to avoid calling
# host commands if /bin/sh (dash) is not installed and it's # host commands if /bin/sh (dash) is not installed and it's
@ -57,7 +58,11 @@ TRIGGERSDIR="./var/db/xbps/triggers"
ACTION="\$1" ACTION="\$1"
PKGNAME="\$2" PKGNAME="\$2"
VERSION="\$3" VERSION="\$3"
UPDATE="\$4"
#
# The following code will run the triggers.
#
_EOF _EOF
# #
@ -162,7 +167,7 @@ _EOF
if ! $(echo $j|grep -q pre-${action}); then if ! $(echo $j|grep -q pre-${action}); then
continue continue
fi fi
printf "\t\${TRIGGERSDIR}/$f run $j \${PKGNAME} \${VERSION}\n" >> $tmpf printf "\t\${TRIGGERSDIR}/$f run $j \${PKGNAME} \${VERSION} \${UPDATE}\n" >> $tmpf
printf "\t[ \$? -ne 0 ] && exit \$?\n" >> $tmpf printf "\t[ \$? -ne 0 ] && exit \$?\n" >> $tmpf
done done
done done
@ -174,7 +179,7 @@ _EOF
if ! $(echo $j|grep -q post-${action}); then if ! $(echo $j|grep -q post-${action}); then
continue continue
fi fi
printf "\t\${TRIGGERSDIR}/$f run $j \${PKGNAME} \${VERSION}\n" >> $tmpf printf "\t\${TRIGGERSDIR}/$f run $j \${PKGNAME} \${VERSION} \${UPDATE}\n" >> $tmpf
printf "\t[ \$? -ne 0 ] && exit \$?\n" >> $tmpf printf "\t[ \$? -ne 0 ] && exit \$?\n" >> $tmpf
done done
done done