From: Nicolas Boisselier Date: Sat, 17 Sep 2016 16:09:35 +0000 (+0100) Subject: mac_install_dmg X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=f25bf6863d0ca200d0670b08d34b6ae35164f045;p=nb.git mac_install_dmg --- 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}" }