]> pd.if.org Git - zpackage/commitdiff
add option to show install scripts
authorNathan Wagner <nw@hydaspes.if.org>
Sat, 6 Oct 2018 17:58:09 +0000 (17:58 +0000)
committerNathan Wagner <nw@hydaspes.if.org>
Sat, 6 Oct 2018 18:25:42 +0000 (18:25 +0000)
zpm-setscript

index 09e3b4a6d9853b523f4d09bcdaf24b81bc5eb542..0036e66090b3e539dc9ba22e3b9cffa5198f66ef 100755 (executable)
@@ -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"