From f25bf6863d0ca200d0670b08d34b6ae35164f045 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Sat, 17 Sep 2016 17:09:35 +0100 Subject: [PATCH] mac_install_dmg --- etc/profile.d/mac.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/etc/profile.d/mac.sh b/etc/profile.d/mac.sh index a45e94a9..6f8b08c2 100644 --- a/etc/profile.d/mac.sh +++ b/etc/profile.d/mac.sh @@ -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}" } -- 2.47.3