From 1c076967d4e4d622c53d414bf842d90ae9143f6d Mon Sep 17 00:00:00 2001 From: Juan RP Date: Fri, 2 Oct 2009 17:24:19 +0200 Subject: [PATCH] Pass the ${UPDATE} argument to the triggers, to support restarting services while upgrading packages. --HG-- extra : convert_revision : xtraeme%40gmail.com-20091002152419-qo4i4qpp8ba8qxqd --- shutils/metadata_scripts.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/shutils/metadata_scripts.sh b/shutils/metadata_scripts.sh index 126c4d65..79d5a861 100644 --- a/shutils/metadata_scripts.sh +++ b/shutils/metadata_scripts.sh @@ -40,11 +40,12 @@ xbps_write_metadata_scripts_pkg() cat >> $tmpf <<_EOF #!/bin/sh -e # -# Generic INSTALL/REMOVE script. +# Generic INSTALL/REMOVE script. Arguments passed to this script: # -# \$1 = action -# \$2 = pkgname -# \$3 = version +# \$1 = ACTION [pre/post] +# \$2 = PKGNAME +# \$3 = VERSION +# \$4 = UPDATE [yes/no] # # Note that paths must be relative to CWD, to avoid calling # host commands if /bin/sh (dash) is not installed and it's @@ -57,7 +58,11 @@ TRIGGERSDIR="./var/db/xbps/triggers" ACTION="\$1" PKGNAME="\$2" VERSION="\$3" +UPDATE="\$4" +# +# The following code will run the triggers. +# _EOF # @@ -162,7 +167,7 @@ _EOF if ! $(echo $j|grep -q pre-${action}); then continue 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 done done @@ -174,7 +179,7 @@ _EOF if ! $(echo $j|grep -q post-${action}); then continue 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 done done