#1 09 Jul 2016 07:51

NDog
Member
From: New Zealand
Registered: 31 May 2006
Posts: 113
Website

OSX - Install software from ISO & copy shortcuts to desktop and dock

A script to install software from an ISO
Tested in El Capitan cool

This is an example how to install from an ISO file using Office 2011 ISO.
You will need a Microsoft VLSC account to obtain it.
Microsoft ISO info
You can get the latest service pack and install it too

download SW_DVD5_Office_Mac_Standard_2011w_SP3_English_ISO_MLF_X18-77844.ISO and place into a folder
download Office2011-1465Update_EN-US.dmg and place into same folder
download install-office2011.sh and place into same folder
open terminal and navigate to folder and run following commands

chmod +x ./install-office2011.sh
./install-office2011.sh


install-office2011.sh

#!/bin/bash
sudo echo "install from ISO file - by ndog"


# paths
parentdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
ISO="SW_DVD5_Office_Mac_Standard_2011w_SP3_English_ISO_MLF_X18-77844.ISO"
pkg="Office Installer.pkg"

updatedmg="Office2011-1465Update_EN-US.dmg"
updatepkg="Office 2011 14.6.5 Update.pkg"

app[1]="/Applications/Microsoft Office 2011/Microsoft Word.app"
app[2]="/Applications/Microsoft Office 2011/Microsoft Excel.app"
app[3]="/Applications/Microsoft Office 2011/Microsoft PowerPoint.app"



installdiskimage() {
  # install pkg from disk image
  diskimage=$1
  pkgfile=$2
  mkdir /tmp/install
  echo "$diskimage"
  hdiutil attach "$diskimage" -readonly -mountpoint /tmp/install -nobrowse
  echo "/tmp/install/$pkgfile"
  sudo installer -verboseR -allowUntrusted -pkg "/tmp/install/$pkgfile" -target /
  hdiutil detach /tmp/install
  rmdir /tmp/install
}

realpath() {
  # get realpath
  [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
}

aliasdesktop() { 
  # create alias on desktop
  local desktop=$2
  /usr/bin/osascript -e "tell application \"Finder\" to make alias file to POSIX file \"$1\" at POSIX file \"$desktop\""
}

aliasdock() {
  # 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 $1`</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>"
}


# install ISO
installdiskimage "$parentdir/$ISO" "$pkg"
# install update
installdiskimage "$parentdir/$updatedmg" "$updatepkg"

# get user desktop location
userdesktop=$(realpath ~/Desktop)
# loop through applications and create aliases
for i in "${app[@]}"
do
   echo $i
   aliasdesktop "$i" "$userdesktop"
   aliasdock "$i"
done
killall Dock

cmd, vbs, ps, bash
autoit, python, swift

Offline

#2 09 Jul 2016 08:23

NDog
Member
From: New Zealand
Registered: 31 May 2006
Posts: 113
Website

Re: OSX - Install software from ISO & copy shortcuts to desktop and dock

For completeness here is the office 2016 version - requires a office 365 subscription

Office 2016 pkg files

install-office2016.sh

#!/bin/bash
sudo echo "install from pkg files - by ndog"


# paths
parentdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
pkg="Microsoft_Office_2016_15.23.0_160611_Installer.pkg"

update[1]="Microsoft_AutoUpdate_3.5.0_160506_Updater.pkg"
update[2]="Microsoft_Excel_15.23.2_160624_Updater.pkg"
update[3]="Microsoft_PowerPoint_15.23.2_160624_Updater.pkg"
update[4]="Microsoft_Word_15.23.2_160624_Updater.pkg"

app[1]="/Applications/Microsoft Word.app"
app[2]="/Applications/Microsoft Excel.app"
app[3]="/Applications/Microsoft PowerPoint.app"



installpkg() {
  # install pkg file directly
  sudo installer -verboseR -allowUntrusted -pkg "$1" -target /
}

realpath() {
  # get realpath
  [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
}

aliasdesktop() { 
  # create alias on desktop
  local desktop=$2
  /usr/bin/osascript -e "tell application \"Finder\" to make alias file to POSIX file \"$1\" at POSIX file \"$desktop\""
}

aliasdock() {
  # 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 $1`</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>"
}


# install package
installpkg "$parentdir/$pkg"
# install updates
for i in "${update[@]}"
do
  installpkg "$parentdir/$i"
done

# get user desktop location
userdesktop=$(realpath ~/Desktop)
# loop through applications and create aliases
for i in "${app[@]}"
do
   echo $i
   aliasdesktop "$i" "$userdesktop"
   aliasdock "$i"
done
killall Dock

cmd, vbs, ps, bash
autoit, python, swift

Offline

Board footer

Powered by FluxBB