summaryrefslogtreecommitdiff
path: root/build/mac/cmdline-install
diff options
context:
space:
mode:
Diffstat (limited to 'build/mac/cmdline-install')
-rwxr-xr-xbuild/mac/cmdline-install57
1 files changed, 57 insertions, 0 deletions
diff --git a/build/mac/cmdline-install b/build/mac/cmdline-install
new file mode 100755
index 0000000..f1cd4eb
--- /dev/null
+++ b/build/mac/cmdline-install
@@ -0,0 +1,57 @@
+#!/bin/sh
+#
+# install a PCP *.dmg package from the command line ...
+# run from the build/mac directory in a PCP build tree after Makepkgs
+#
+tmp=`mktemp -d /var/tmp/pcp.XXXXXXXXX` || exit 1
+sts=1
+trap "rm -rf $tmp; exit \$sts" 0 1 2 3 15
+
+disk_image=`echo pcp-*.dmg | sed -e 's/$/ /' -e 's/[^ ]*\.tmp\.dmg / /' -e 's/ $//'`
+if [ "$disk_image" = "pcp-*.dmg" ]
+then
+ echo "Error: no .dmg file?"
+ exit
+fi
+
+n=`echo "$disk_image" | wc -w | sed -e 's/ //'`
+if [ "$n" -gt 1 ]
+then
+ echo "Error: more than one .dmg file: $disk_image"
+ exit
+fi
+
+base=`echo $disk_image | sed -e 's/\.dmg$//'`
+if hdiutil attach $disk_image >$tmp/out 2>&1
+then
+ :
+else
+ cat $tmp/out
+ echo "Error: hdiutil attach failed"
+ exit
+fi
+
+if [ -d /Volumes/$base/$base.pkg ]
+then
+ if sudo installer -pkg /Volumes/$base/$base.pkg -target / >$tmp/out 2>&1
+ then
+ sts=0
+ else
+ cat $tmp/out
+ echo "Error: installer failed"
+ fi
+else
+ ls -l /Volumes/$base/
+ echo "Error: no package directory /Volumes/$base/$base.pkg?"
+ exit
+fi
+
+if hdiutil detach /Volumes/$base >$tmp/out 2>&1
+then
+ :
+else
+ cat $tmp/out
+ echo "Error: hdiutil detach failed"
+ sts=1
+ exit
+fi