From: Nathan Wagner Date: Sat, 6 Oct 2018 17:58:09 +0000 (+0000) Subject: add option to show install scripts X-Git-Tag: v0.2.0~3 X-Git-Url: https://pd.if.org/git/?a=commitdiff_plain;h=ada8405d470a7b13eba173bcacfd660e13dfed0d;p=zpackage add option to show install scripts --- 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"