From: Nicolas Boisselier Date: Wed, 3 Aug 2016 16:07:45 +0000 (+0100) Subject: mac_install_dmg X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=0aeb56da9d45820f6be62446559d8a084b95bdad;p=nb.git mac_install_dmg --- diff --git a/etc/profile.d/mac.sh b/etc/profile.d/mac.sh index 36828f10..7231056c 100644 --- a/etc/profile.d/mac.sh +++ b/etc/profile.d/mac.sh @@ -1,6 +1,7 @@ # See: http://www.infoworld.com/article/2614879/mac-os-x/top-20-os-x-command-line-secrets-for-power-users.html mac_pbcopy() { - cat $@ | ssh -q $1 -o 'ForwardAgent yes' 'cat|pbcopy' + local host="$1"; shift + cat $@ | ssh -q $host -o 'ForwardAgent yes' 'cat|pbcopy' } [ -z "$DARWIN" ] && return 0 @@ -44,3 +45,9 @@ md5sum() { mac_xmessage() { osascript -e "tell app \"System Events\" to display dialog \"$@\"" } + +mac_install_dmg() { + local MOUNTDIR=$(echo `hdiutil mount jdk-7u51-macos-x64.dmg | tail -1 | awk '{$1=$2=""; print $0}'` | xargs -0 echo) + sudo installer --verbose -pkg "${MOUNTDIR}/"*.pkg -target / + sudo hdiutil detach "${MOUNTDIR}" +}