Chrome install script.

This commit is contained in:
Artem Sapegin 2012-10-22 15:11:46 +04:00
parent a7c8f00d81
commit 580145edbc
2 changed files with 69 additions and 0 deletions

57
includes/installer.sh Normal file
View File

@ -0,0 +1,57 @@
#!/bin/bash
# Utils to install OSX apps in various formats
# Based on https://github.com/bkuhlmann/osx/blob/master/functions/installers.sh
INSTALLER_DIR=`mktemp -d`
# Downloads an installer to local disk
#
# @param $1 URL
# @param $2 File name
function download_installer {
echo "Downloading $1/$2..."
cd "$INSTALLER_DIR"
curl -LO "$1/$2"
cd ..
}
# Installs an application
#
# @param Application folder
# @param Application name
function install_app {
echo "Installing $2.app..."
cp -a "$1/$2.app" "$HOME/Applications/"
#find "$1" -type d -name "*.app" -exec sh -c 'cp -a "$0" $HOME/Applications/' {} ';'
#find "$1" -type d -name "*.app" -exec sh -c 'cp -a "$0" $HOME/Applications/' {} ';'
}
# Installs an application via a DMG file
#
# @param $1 Donwload URL
# @param $2 Download file name
# @param $3 Mount path
# @param $4 App name
function install_dmg_app {
mount_point="/Volumes/$3"
download_installer "$1" "$2"
download_file="$INSTALLER_DIR/$2"
echo "Mounting $2..."
hdiutil attach "$download_file" -noverify -readonly -noautoopenro -noidmereveal
install_app "$mount_point" "$4"
echo "Cleaning..."
hdiutil detach -force "$mount_point"
rm -f "$download_file"
}
# Removes temporary directory
function install_cleanup {
rm -rf "$INSTALLER_DIR"
}

12
setup/apps.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
source "$HOME/dotfiles/includes/installer.sh"
# Install Chrome
install_dmg_app "https://dl.google.com/chrome/mac/stable/GGRO" "googlechrome.dmg" "Google Chrome" "Google Chrome"
# Make it default browser (it will not run Chrome)
open -a "Google Chrome" --args --make-default-browser
install_cleanup