]> pd.if.org Git - zpackage/blobdiff - zpm-install
add install option to merge files
[zpackage] / zpm-install
index 911ebf72bcc76702df8041a8ed799814ca4a3ab2..0cb0281b36cce820622adee08cc9dafcb8b9fe51 100755 (executable)
@@ -18,11 +18,13 @@ absorb=0
 overwrite=0
 syncopts=''
 installall=0
+mergefiles=0
 
 # zpm-install [-SCn] [ -d localdb ] [ -f pkgfile ] [ -R installroot ] pkgstr ...
-while getopts f:d:R:nSCvAOa opt; do
+while getopts f:d:R:nSCvAOaF opt; do
        case $opt in
                f) pkgfile="$OPTARG" ;;
+               F) mergefiles=1 ;;
                d) localdb="$OPTARG" ;;
                R) rootdir="$OPTARG" ;;
                S) runscripts=0 ;;
@@ -135,6 +137,10 @@ for pkgid in $pkglist; do
                if [ $? -ne 0 ]; then
                        die "pre-install script for $pkgid failed"
                fi
+       else
+               if zpm script -f $pkgfile -Fql -p pre-install $pkgid; then
+                       zpm note -p $pkgid -m 'pre-install script not run'
+               fi
        fi
 
        # remove the package if it exists.  can't be in an installed
@@ -150,7 +156,11 @@ for pkgid in $pkglist; do
                if [ $verbose -gt 0 ]; then
                        echo merging $pkgid
                fi
-               zpm merge -u -F -f $pkgfile -s installing $pkgid
+               if [ $mergefiles -eq 1 ]; then
+                       zpm merge -u -F -f $pkgfile -s installing $pkgid
+               else
+                       zpm merge -u -f $pkgfile -s installing $pkgid
+               fi
                if [ $? -ne 0 ]; then
                        die "merging $pkgid failed"
                fi
@@ -170,6 +180,10 @@ if [ $verbose -gt 0 ]; then
        syncopts="$syncopts -v"
 fi
 
+if [ "$pkgfile" != "$ZPMDB" ]; then
+       syncopts="$syncopts -f $pkgfile"
+fi
+
 zpm syncfs $syncopts
 
 syncrv=$?
@@ -201,6 +215,10 @@ for pkgid in $pkglist; do
        
        if [ $runscripts -gt 0 ]; then
                zpm script -f $pkgfile -p post-install $pkgid $current
+       else
+               if zpm script -f $pkgfile -Fql -p post-install $pkgid; then
+                       zpm note -p $pkgid -m 'post-install script not run'
+               fi
        fi
 
        if [ -n "$current" ]; then
@@ -213,5 +231,10 @@ for pkgid in $pkglist; do
        # TODO will need force option
        if [ $runconfigure -gt 0 ]; then
                zpm script -f $pkgfile -p configure $pkgid
+       else
+               if zpm script -f $pkgfile -Fql -p configure $pkgid; then
+                       zpm note -p $pkgid -m 'configure script not run'
+               fi
        fi
+
 done