]> git.nbdom.net Git - nb.git/commitdiff
mac_install_dmg
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Sat, 17 Sep 2016 16:09:35 +0000 (17:09 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Sat, 17 Sep 2016 16:09:35 +0000 (17:09 +0100)
etc/profile.d/mac.sh

index a45e94a98714b8b3cb3a5babd0fda9d96c49ceaf..6f8b08c25dc1b9403f22cf2837cfb14749518010 100644 (file)
@@ -71,7 +71,19 @@ mac_xmessage() {
 }
 
 mac_install_dmg() {
-  local MOUNTDIR=$(echo `hdiutil mount "$1" | tail -1 | awk '{$1=$2=""; print $0}'` | xargs -0 echo)
+  local file
+  case "$1" in
+    http*)
+      file=$(mktemp)
+      echo "$file"
+      trap 'rm -f -- "$file"' INT TERM HUP EXIT
+      curl "$1" -o "$file" || return
+    ;;
+    *)
+      file="$1"
+    ;;
+  esac
+  local MOUNTDIR=$(echo `hdiutil mount "$file" | tail -1 | awk '{$1=$2=""; print $0}'` | xargs -0 echo)
   sudo installer -verbose -pkg "${MOUNTDIR}/"*.pkg -target /
   sudo hdiutil detach "${MOUNTDIR}"
 }