You are not logged in.
A script to install a package from dmg file
Tested in El Capitan
You can test it with TextWrangler
download TextWrangler_5.0.2.dmg and place into a folder
download install-textwrangler.sh and place into same folder
open terminal and navigate to folder and run following commands
chmod +x ./install-textwrangler.sh
./install-textwrangler.sh
install-textwrangler.sh
#!/bin/bash
sudo echo "install from dmg file - by ndog"
# paths
parentdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
dmg="TextWrangler_5.0.2.dmg"
app="TextWrangler.app"
shortcut="TextWrangler"
# install dmg
mkdir /tmp/install
echo "$parentdir/$dmg"
hdiutil attach "$parentdir/$dmg" -readonly -mountpoint /tmp/install -nobrowse
sudo cp -a "/tmp/install/$app" "/Applications"
hdiutil detach /tmp/install
rmdir /tmp/install
# get realpath to Desktop
realpath() {
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
}
desktop=$(realpath ~/Desktop)
# create alias on desktop
echo $app
echo "$desktop"
rm -rf "$desktop/$shortcut" 2> /dev/null
sleep 1
/usr/bin/osascript -e "tell application \"Finder\" to make alias file to POSIX file \"/Applications/$app\" at POSIX file \"$desktop\""
# create alias in dock
defaults write com.apple.dock persistent-apps -array-add "<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>`echo /Applications/$app`</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>"
killall Dock
Last edited by NDog (09 Jul 2016 05:46)
cmd, vbs, ps, bash
autoit, python, swift
Offline