X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=zpm-setscript;h=0036e66090b3e539dc9ba22e3b9cffa5198f66ef;hb=e7ce7c71c84e3e2a394562a6adec73062759f5df;hp=09e3b4a6d9853b523f4d09bcdaf24b81bc5eb542;hpb=51a6d79f8a532376a9f27dbb5133bf13a5474703;p=zpackage diff --git a/zpm-setscript b/zpm-setscript index 09e3b4a..0036e66 100755 --- a/zpm-setscript +++ b/zpm-setscript @@ -129,6 +129,17 @@ EOS #printf "%s\n" $path ) +showscript() ( + stage=$1 + stage=$(zpm quote "$stage") + hash=$(zpm shell $pkgfile "select hash from scripts_pkgid + where pkgid = '$pkgid' and stage = '$stage'") + if [ -z "$hash" ]; then + die "no script for $stage $pkgid" + fi + zpm extract $pkgfile "$hash" - +) + # TODO better syntax for showing the script # TODO a way to set the script hash directly while [ $# -gt 1 ]; do @@ -136,9 +147,9 @@ while [ $# -gt 1 ]; do script=$2 shift 2 - if [ "$script" = '-' ]; then + if [ "$script" = '--' ]; then removescript "$stage" - elif [ -z "$script" ]; then + elif [ "$script" = '-' ]; then showscript "$stage" else addscript "$stage" "$script"