Compare commits

..

14 Commits

Author SHA1 Message Date
Brooke Kuhlmann
566b9d871e Added version release notes 2021-03-16 18:22:22 -06:00
Brooke Kuhlmann
f640e37089 Updated setup software as configure software script
Necessary to better describe the purpose of this script.
2021-03-16 18:21:28 -06:00
Brooke Kuhlmann
c3c3036c88 Added dotfiles script
Necessary to make installing personal dotfiles a first class citizen
like many of the other install scripts. Having one's own dotfiles as
part of the machine setup helps ensure the shell is configured properly
especially when it comes to dealing with language specific dependencies
for Ruby, Rust, Node, etc. This reduces duplication within this project
-- and the macOS Configuration project -- from having to know all of
these details when settings can be defined within one's own dotfiles
once.
2021-03-16 18:21:18 -06:00
Brooke Kuhlmann
6990b9d2c6 Added Node packages script
Necessary to provide a single source of truth for installing Node
dependencies. This used to be managed by the Yarn Setup project but
that project is being deprecated in favor of this project.
2021-03-16 18:21:09 -06:00
Brooke Kuhlmann
b8d96b3479 Fixed environment configuration to source Bash resource
Once the `.bashrc` file has been created, immediately load it so
contents are executed instead of duplicating this work on a separate
line.
2021-03-16 18:21:06 -06:00
Brooke Kuhlmann
be9edafe52 Added Ruby gems script
Necessary to provide a single source of truth for installing Ruby
dependencies. This used to be managed by the Ruby Setup project but
that project is being deprecated in favor of this project.
2021-03-16 18:20:57 -06:00
Brooke Kuhlmann
c62ef77ce2 Updated install root detection to support Elm
Necessary so Elm can be installed properly since Homebrew support isn't
great.
2021-03-16 18:20:57 -06:00
Brooke Kuhlmann
e9cd22bb36 Added bare package installer
Necessary to download and install bare packages that are not wrapped as
DMGs or zips first.
2021-03-16 18:20:57 -06:00
Brooke Kuhlmann
e9476d6a6a Refactored install scripts to separate script paths
Minor improvement to readability so the script path stands out as being
configuragble versus being grouped with the default Bash settings.
2021-03-16 18:20:57 -06:00
Brooke Kuhlmann
35663cf8b3 Added Rust crates script
Necessary to implement the installation of Rust and associated crates
which can be used by downstream configurations. This functionality was
originally part of the macOS Configuration project but has been moved
here to provide a common foundation in which to build upon.
2021-03-16 18:20:44 -06:00
Brooke Kuhlmann
eec175e232 Added mas check to App Store install script
Necessary to ensure mas is installed before executing the script. This
reduces the strain on downstream projects/scripts from having to do
this check. This was previously part of the macOS Configuration project
but has been moved here as central location for core functionality.
2021-03-14 11:24:12 -06:00
Brooke Kuhlmann
dd62dad160 Added Homebrew installation to Homebrew sripts
Ensures Homebrew is installed before running scripts so downstream
projects don't have to remember to do this work.
2021-03-14 11:11:11 -06:00
Brooke Kuhlmann
c65f06d5b8 Removed CPU detection in favor of architecture detection
Provides a cleaner and more reliable way to determine what machine
architecture is being used.
2021-02-28 09:10:42 -07:00
Brooke Kuhlmann
6567969919 Updated dev tools installer to agree to Rosetta license
Necessary to reduce an additional prompt for the user to deal with and
allow a more automated install process. This also includes better
architecture detection, instead of CPU detection, when determining
whether to install Rosetta.
2021-02-28 09:09:27 -07:00
22 changed files with 301 additions and 62 deletions

View File

@@ -1,5 +1,22 @@
= Changes = Changes
== 12.0.0 (2021-03-16)
* Fixed environment configuration to source Bash resource - Brooke Kuhlmann
* Added Homebrew installation to Homebrew sripts - Brooke Kuhlmann
* Added Node packages script - Brooke Kuhlmann
* Added Ruby gems script - Brooke Kuhlmann
* Added Rust crates script - Brooke Kuhlmann
* Added bare package installer - Brooke Kuhlmann
* Added dotfiles script - Brooke Kuhlmann
* Added mas check to App Store install script - Brooke Kuhlmann
* Added version release notes - Brooke Kuhlmann
* Updated dev tools installer to agree to Rosetta license - Brooke Kuhlmann
* Updated install root detection to support Elm - Brooke Kuhlmann
* Updated setup software as configure software script - Brooke Kuhlmann
* Removed CPU detection in favor of architecture detection - Brooke Kuhlmann
* Refactored install scripts to separate script paths - Brooke Kuhlmann
== 11.2.0 (2021-02-27) == 11.2.0 (2021-02-27)
* Added Apple Silicon instructions - Brooke Kuhlmann * Added Apple Silicon instructions - Brooke Kuhlmann

View File

@@ -28,15 +28,17 @@ toc::[]
* Provides a command line interface, written in Bash, with no additional dependencies for * Provides a command line interface, written in Bash, with no additional dependencies for
installation and management of a macOS machine. installation and management of a macOS machine.
* Supports macOS boot disk creation for fresh install of operating system. * Supports macOS boot disk creation for fresh install of operating system.
* Downloads and installs link:https://developer.apple.com/xcode[Xcode Command Line Tools]. * Installs link:https://developer.apple.com/xcode[Xcode Command Line Tools].
* Downloads, installs, and configures link:http://brew.sh[Homebrew Formulas]. * Installs link:http://brew.sh[Homebrew] formulas and casks.
* Downloads, installs, and configures link:https://caskroom.github.io[Homebrew Casks]. * Installs link:http://www.apple.com/macosx/whats-new/app-store.html[App Store] software.
* Downloads, installs, and configures link:http://www.apple.com/macosx/whats-new/app-store.html[App * Installs non-App Store software applications.
Store] software. * Installs software application extensions.
* Downloads, installs, and configures non-App Store software applications. * Installs dotfiles.
* Downloads, installs, and configures software application extensions. * Installs link:https://nodejs.org[Node] link:https://www.npmjs.com[packages].
* Applies basic and default software settings. * Installs link:https://www.ruby-lang.org[Ruby] link:https://rubygems.org[gems].
* Sets up and configures installed software for use. * Installs link:https://www.rust-lang.org[Rust] link:https://crates.io[crates].
* Applies basic default software settings.
* Configures installed software.
* Supports restoration of machine backups. * Supports restoration of machine backups.
== Screencast == Screencast
@@ -57,7 +59,7 @@ To install, run:
---- ----
git clone https://github.com/bkuhlmann/mac_os.git git clone https://github.com/bkuhlmann/mac_os.git
cd mac_os cd mac_os
git checkout 11.2.0 git checkout 12.0.0
---- ----
== Usage == Usage
@@ -83,9 +85,13 @@ Install:
m: Install Mac App Store software. m: Install Mac App Store software.
a: Install application software. a: Install application software.
x: Install application software extensions. x: Install application software extensions.
df: Install dotfiles.
np: Install Node packages.
rg: Install Ruby gems.
rc: Install Rust crates.
d: Apply default settings. d: Apply default settings.
s: Setup installed software. cs: Configure installed software.
i: Install everything (i.e. executes all install options). i: Install everything (i.e. executes all install options in order listed).
Restore: Restore:
R: Restore settings from backup. R: Restore settings from backup.
Manage: Manage:
@@ -143,21 +149,30 @@ macOS Boot Disk Recovery:
All executable scripts can be found in the `bin` folder: All executable scripts can be found in the `bin` folder:
* `bin/apply_basic_settings`: Applies basic, initial, settings for setting up a machine. _Can be * `bin/apply_basic_settings` (optional, customizable): Applies basic and initial settings for
customized._ setting up a machine.
* `bin/apply_default_settings`: Applies useful system and application defaults. _Can be customized._ * `bin/apply_default_settings` (optional, customizable): Applies bare minimum system and application
* `bin/create_boot_disk`: Creates macOS boot disk. defaults.
* `bin/install_app_store`: Installs macOS, GUI-based, App Store applications. _Can be customized._ * `bin/configure_software` (optional, customizable): Configures installed software as part of the
* `bin/install_applications`: Installs macOS, GUI-based, non-App Store applications. _Can be post install process.
customized._ * `bin/create_boot_disk` (optional): Creates a macOS boot disk.
* `bin/install_dev_tools`: Installs macOS development tools required by Homebrew. * `bin/install_app_store` (optional, customizable): Installs macOS, GUI-based, App Store
* `bin/install_extensions`: Installs macOS application extensions and add-ons. _Can be customized._ applications.
* `bin/install_homebrew_casks`: Installs Homebrew Formulas. _Can be customized._ * `bin/install_applications` (optional, customizable): Installs macOS, GUI-based, non-App Store
* `bin/install_homebrew_formulas`: Installs Homebrew Casks. _Can be customized._ applications.
* `bin/restore_backup`: Restores system/application settings from backup image. _Can be customized._ * `bin/install_dev_tools` (required): Installs macOS development tools required by Homebrew.
* `bin/run`: The main script and interface for macOS setup. * `bin/install_dotfiles` (optional, customizable): Installs personal dotfiles so the system is
* `bin/setup_software`: Configures and launches (if necessary) installed software. _Can be tailored to your workflow.
customized._ * `bin/install_extensions` (optional, customizable): Installs macOS application extensions and
add-ons.
* `bin/install_homebrew_casks` (optional, customizable): Installs Homebrew Formulas.
* `bin/install_homebrew_formulas` (optional, customizable): Installs Homebrew Casks.
* `bin/install_node_packages` (optional, customizable): Installs Node packages.
* `bin/install_ruby_gems` (optional, customizable): Installs Ruby gems.
* `bin/install_rust_crates` (optional, customizable): Installs Rust crates.
* `bin/restore_backup` (optional, customizable): Restores system/application settings from backup
image.
* `bin/run` (required): The main script and interface for macOS setup.
The `lib` folder provides the base framework for installing, re-installing, and uninstalling The `lib` folder provides the base framework for installing, re-installing, and uninstalling
software. Everything provided via the link:https://www.alchemists.io/projects/mac_os-config[macOS software. Everything provided via the link:https://www.alchemists.io/projects/mac_os-config[macOS

View File

@@ -6,6 +6,7 @@ set -o nounset
set -o errexit set -o errexit
set -o pipefail set -o pipefail
IFS=$'\n\t' IFS=$'\n\t'
SCRIPT_PATH="$MAC_OS_CONFIG_PATH/bin/apply_basic_settings" SCRIPT_PATH="$MAC_OS_CONFIG_PATH/bin/apply_basic_settings"
if [[ -x "$SCRIPT_PATH" ]]; then if [[ -x "$SCRIPT_PATH" ]]; then

View File

@@ -6,6 +6,7 @@ set -o nounset
set -o errexit set -o errexit
set -o pipefail set -o pipefail
IFS=$'\n\t' IFS=$'\n\t'
SCRIPT_PATH="$MAC_OS_CONFIG_PATH/bin/apply_default_settings" SCRIPT_PATH="$MAC_OS_CONFIG_PATH/bin/apply_default_settings"
if [[ -x "$SCRIPT_PATH" ]]; then if [[ -x "$SCRIPT_PATH" ]]; then

16
bin/configure_software Executable file
View File

@@ -0,0 +1,16 @@
#! /usr/bin/env bash
# Configures installed software.
set -o nounset
set -o errexit
set -o pipefail
IFS=$'\n\t'
SCRIPT_PATH="$MAC_OS_CONFIG_PATH/bin/configure_software"
if [[ -x "$SCRIPT_PATH" ]]; then
"$SCRIPT_PATH"
else
printf "WARNING: Configure software script does not exist or is not executable.\n"
fi

View File

@@ -6,9 +6,11 @@ set -o nounset
set -o errexit set -o errexit
set -o pipefail set -o pipefail
IFS=$'\n\t' IFS=$'\n\t'
SCRIPT_PATH="$MAC_OS_CONFIG_PATH/bin/install_app_store" SCRIPT_PATH="$MAC_OS_CONFIG_PATH/bin/install_app_store"
if [[ -x "$SCRIPT_PATH" ]]; then if [[ -x "$SCRIPT_PATH" ]]; then
check_mas_install
"$SCRIPT_PATH" "$SCRIPT_PATH"
else else
printf "WARNING: App Store install script does not exist or is not executable.\n" printf "WARNING: App Store install script does not exist or is not executable.\n"

View File

@@ -6,6 +6,7 @@ set -o nounset
set -o errexit set -o errexit
set -o pipefail set -o pipefail
IFS=$'\n\t' IFS=$'\n\t'
SCRIPT_PATH="$MAC_OS_CONFIG_PATH/bin/install_applications" SCRIPT_PATH="$MAC_OS_CONFIG_PATH/bin/install_applications"
if [[ -x "$SCRIPT_PATH" ]]; then if [[ -x "$SCRIPT_PATH" ]]; then

View File

@@ -1,6 +1,6 @@
#! /usr/bin/env bash #! /usr/bin/env bash
# Installs development tooling requirements. Installs development tooling requirements.
printf "Installing Xcode CLI tools...\n" printf "Installing Xcode CLI tools...\n"
xcode-select --install xcode-select --install
@@ -12,6 +12,6 @@ if [[ "$xcode_response" != "y" ]]; then
exit 1 exit 1
fi fi
if [[ -n "$(get_cpu)" ]]; then if [[ "$(/usr/bin/arch)" == "arm64" ]]; then
softwareupdate --install-rosetta softwareupdate --install-rosetta --agree-to-license
fi fi

16
bin/install_dotfiles Executable file
View File

@@ -0,0 +1,16 @@
#! /usr/bin/env bash
# Installs dotfiles.
set -o nounset
set -o errexit
set -o pipefail
IFS=$'\n\t'
SCRIPT_PATH="$MAC_OS_CONFIG_PATH/bin/install_dotfiles"
if [[ -x "$SCRIPT_PATH" ]]; then
"$SCRIPT_PATH"
else
printf "WARNING: Dotfiles install script does not exist or is not executable.\n"
fi

View File

@@ -6,6 +6,7 @@ set -o nounset
set -o errexit set -o errexit
set -o pipefail set -o pipefail
IFS=$'\n\t' IFS=$'\n\t'
SCRIPT_PATH="$MAC_OS_CONFIG_PATH/bin/install_extensions" SCRIPT_PATH="$MAC_OS_CONFIG_PATH/bin/install_extensions"
if [[ -x "$SCRIPT_PATH" ]]; then if [[ -x "$SCRIPT_PATH" ]]; then

View File

@@ -6,9 +6,11 @@ set -o nounset
set -o errexit set -o errexit
set -o pipefail set -o pipefail
IFS=$'\n\t' IFS=$'\n\t'
SCRIPT_PATH="$MAC_OS_CONFIG_PATH/bin/install_homebrew_casks" SCRIPT_PATH="$MAC_OS_CONFIG_PATH/bin/install_homebrew_casks"
if [[ -x "$SCRIPT_PATH" ]]; then if [[ -x "$SCRIPT_PATH" ]]; then
install_homebrew
"$SCRIPT_PATH" "$SCRIPT_PATH"
else else
printf "WARNING: Homebrew Casks install script does not exist or is not executable.\n" printf "WARNING: Homebrew Casks install script does not exist or is not executable.\n"

View File

@@ -6,9 +6,11 @@ set -o nounset
set -o errexit set -o errexit
set -o pipefail set -o pipefail
IFS=$'\n\t' IFS=$'\n\t'
SCRIPT_PATH="$MAC_OS_CONFIG_PATH/bin/install_homebrew_formulas" SCRIPT_PATH="$MAC_OS_CONFIG_PATH/bin/install_homebrew_formulas"
if [[ -x "$SCRIPT_PATH" ]]; then if [[ -x "$SCRIPT_PATH" ]]; then
install_homebrew
"$SCRIPT_PATH" "$SCRIPT_PATH"
else else
printf "WARNING: Homebrew Formulas install script does not exist or is not executable.\n" printf "WARNING: Homebrew Formulas install script does not exist or is not executable.\n"

17
bin/install_node_packages Executable file
View File

@@ -0,0 +1,17 @@
#! /usr/bin/env bash
# Installs Node packages.
set -o nounset
set -o errexit
set -o pipefail
IFS=$'\n\t'
SCRIPT_PATH="$MAC_OS_CONFIG_PATH/bin/install_node_packages"
if [[ -x "$SCRIPT_PATH" ]]; then
check_yarn_install
"$SCRIPT_PATH"
else
printf "WARNING: Node packages install script does not exist or is not executable.\n"
fi

17
bin/install_ruby_gems Executable file
View File

@@ -0,0 +1,17 @@
#! /usr/bin/env bash
# Installs Ruby gems.
set -o nounset
set -o errexit
set -o pipefail
IFS=$'\n\t'
SCRIPT_PATH="$MAC_OS_CONFIG_PATH/bin/install_ruby_gems"
if [[ -x "$SCRIPT_PATH" ]]; then
install_ruby
"$SCRIPT_PATH"
else
printf "WARNING: Ruby gems install script does not exist or is not executable.\n"
fi

17
bin/install_rust_crates Executable file
View File

@@ -0,0 +1,17 @@
#! /usr/bin/env bash
# Installs Rust crates.
set -o nounset
set -o errexit
set -o pipefail
IFS=$'\n\t'
SCRIPT_PATH="$MAC_OS_CONFIG_PATH/bin/install_rust_crates"
if [[ -x "$SCRIPT_PATH" ]]; then
install_rust
"$SCRIPT_PATH"
else
printf "WARNING: Rust crates install script does not exist or is not executable.\n"
fi

View File

@@ -6,6 +6,7 @@ set -o nounset
set -o errexit set -o errexit
set -o pipefail set -o pipefail
IFS=$'\n\t' IFS=$'\n\t'
SCRIPT_PATH="$MAC_OS_CONFIG_PATH/bin/restore_backup" SCRIPT_PATH="$MAC_OS_CONFIG_PATH/bin/restore_backup"
if [[ -x "$SCRIPT_PATH" ]]; then if [[ -x "$SCRIPT_PATH" ]]; then

View File

@@ -39,9 +39,13 @@ while true; do
printf " m: Install Mac App Store software.\n" printf " m: Install Mac App Store software.\n"
printf " a: Install application software.\n" printf " a: Install application software.\n"
printf " x: Install application software extensions.\n" printf " x: Install application software extensions.\n"
printf " df: Install dotfiles.\n"
printf " np: Install Node packages.\n"
printf " rg: Install Ruby gems.\n"
printf " rc: Install Rust crates.\n"
printf " d: Apply default settings.\n" printf " d: Apply default settings.\n"
printf " s: Setup installed software.\n" printf " cs: Configure installed software.\n"
printf " i: Install everything (i.e. executes all install options).\n" printf " i: Install everything (i.e. executes all install options in order listed).\n"
printf " Restore:\n" printf " Restore:\n"
printf " R: Restore settings from backup.\n" printf " R: Restore settings from backup.\n"
printf " Manage:\n" printf " Manage:\n"

View File

@@ -1,15 +0,0 @@
#! /usr/bin/env bash
# Sets up and launches (if necessary) installed software.
set -o nounset
set -o errexit
set -o pipefail
IFS=$'\n\t'
SCRIPT_PATH="$MAC_OS_CONFIG_PATH/bin/setup_software"
if [[ -x "$SCRIPT_PATH" ]]; then
"$SCRIPT_PATH"
else
printf "WARNING: Software setup script does not exist or is not executable.\n"
fi

View File

@@ -143,6 +143,23 @@ install_homebrew() {
} }
export -f install_homebrew export -f install_homebrew
# Installs a package via a zip file.
# Parameters: $1 (required) - URL, $2 (required) - Application name.
install_bare_pkg() {
local url="$1"
local app_name="$2"
local install_path=$(get_install_path "$app_name")
local work_file="$app_name.pkg"
if [[ ! -e "$install_path" ]]; then
download_file "$url" "$work_file"
install_pkg "$MAC_OS_WORK_PATH" "$app_name"
printf "Installed: $app_name.\n"
verify_application "$app_name"
fi
}
export -f install_bare_pkg
# Installs a package. # Installs a package.
# Parameters: $1 (required) - Package source path, $2 (required) - Application name. # Parameters: $1 (required) - Package source path, $2 (required) - Application name.
install_pkg() { install_pkg() {
@@ -171,6 +188,28 @@ install_program() {
} }
export -f install_program export -f install_program
# Installs Ruby.
# Parameters: None.
install_ruby() {
local version="$(cat $HOME/.ruby-version | tr -d '\n')"
if [[ ! -x "$(command -v ruby)" && -n $(ruby --version | grep --quiet "$version") ]]; then
$(get_homebrew_bin_root)/ruby-install "ruby-$version"
chruby "$version"
gem update --system && gem update
fi
}
export -f install_ruby
# Installs Rust.
# Parameters: None.
install_rust() {
if ! command -v cargo > /dev/null; then
curl --proto "=https" --tlsv1.2 --fail --silent --show-error https://sh.rustup.rs | sh
fi
}
export -f install_rust
# Installs an application via a tar file. # Installs an application via a tar file.
# Parameters: $1 (required) - URL, $2 (required) - Application name, $3 (required) - Decompress options. # Parameters: $1 (required) - URL, $2 (required) - Application name, $3 (required) - Decompress options.
install_tar_app() { install_tar_app() {

View File

@@ -22,10 +22,18 @@ process_option() {
bin/install_applications;; bin/install_applications;;
'x') 'x')
bin/install_extensions;; bin/install_extensions;;
'df')
bin/install_dotfiles;;
'np')
bin/install_node_packages;;
'rg')
bin/install_ruby_gems;;
'rc')
bin/install_rust_crates;;
'd') 'd')
bin/apply_default_settings;; bin/apply_default_settings;;
's') 'cs')
bin/setup_software;; bin/configure_software;;
'i') 'i')
caffeinate_machine caffeinate_machine
bin/apply_basic_settings bin/apply_basic_settings
@@ -35,8 +43,12 @@ process_option() {
bin/install_app_store bin/install_app_store
bin/install_applications bin/install_applications
bin/install_extensions bin/install_extensions
bin/install_dotfiles
bin/install_node_packages
bin/install_ruby_gems
bin/install_rust_crates
bin/apply_default_settings bin/apply_default_settings
bin/setup_software bin/configure_software
clean_work_path;; clean_work_path;;
'R') 'R')
caffeinate_machine caffeinate_machine
@@ -46,7 +58,10 @@ process_option() {
verify_homebrew_casks verify_homebrew_casks
verify_app_store_applications verify_app_store_applications
verify_applications verify_applications
verify_extensions;; verify_extensions
verify_node_packages
verify_ruby_gems
verify_rust_crates;;
'C') 'C')
caffeinate_machine;; caffeinate_machine;;
'ua') 'ua')

View File

@@ -28,13 +28,6 @@ get_basename() {
} }
export -f get_basename export -f get_basename
# Answers current CPU.
# Parameters: None.
get_cpu() {
printf "%s" "$(system_profiler SPHardwareDataType | awk '/Chip/ {print $3}')"
}
export -f get_cpu
# Answers the file extension. # Answers the file extension.
# Parameters: $1 (required) - The file name. # Parameters: $1 (required) - The file name.
get_extension() { get_extension() {
@@ -52,7 +45,7 @@ export -f get_extension
# Answers Homebrew root path. # Answers Homebrew root path.
# Parameters: None. # Parameters: None.
get_homebrew_root() { get_homebrew_root() {
if [[ -n "$(get_cpu)" ]]; then if [[ "$(/usr/bin/arch)" == "arm64" ]]; then
printf "%s" "/opt/homebrew" printf "%s" "/opt/homebrew"
else else
printf "%s" "/usr/local/Homebrew" printf "%s" "/usr/local/Homebrew"
@@ -63,7 +56,7 @@ export -f get_homebrew_root
# Answers Homebrew binary root path. # Answers Homebrew binary root path.
# Parameters: None. # Parameters: None.
get_homebrew_bin_root() { get_homebrew_bin_root() {
if [[ -n "$(get_cpu)" ]]; then if [[ "$(/usr/bin/arch)" == "arm64" ]]; then
printf "%s" "/opt/homebrew/bin" printf "%s" "/opt/homebrew/bin"
else else
printf "%s" "/usr/local/bin" printf "%s" "/usr/local/bin"
@@ -86,6 +79,12 @@ get_install_root() {
local file_name="$1" local file_name="$1"
local file_extension=$(get_extension "$file_name") local file_extension=$(get_extension "$file_name")
# Special cases not supported by Homebrew.
if [[ "$file_name" == "elm" ]]; then
printf "/usr/local/bin"
return
fi
# Dynamically build the install path based on file extension. # Dynamically build the install path based on file extension.
case $file_extension in case $file_extension in
'') '')
@@ -102,6 +101,27 @@ get_install_root() {
} }
export -f get_install_root export -f get_install_root
# Checks Yarn has been installed and exits if otherwise.
# Parameters: None.
check_yarn_install() {
if ! command -v yarn > /dev/null; then
printf "%s\n" "ERROR: Yarn can't be found. Please ensure Homebrew and Yarn have been installed."
exit 1
fi
}
export -f check_yarn_install
# Checks Mac App Store (mas) CLI has been installed and exits if otherwise.
# Parameters: None.
check_mas_install() {
if ! command -v mas > /dev/null; then
printf "%s\n" "ERROR: Mac App Store (mas) CLI can't be found."
printf "%s\n" " Please ensure Homebrew and mas (i.e. brew install mas) have been installed."
exit 1
fi
}
export -f check_mas_install
# Configures shell for new machines and ensures PATH is properly configured for running scripts. # Configures shell for new machines and ensures PATH is properly configured for running scripts.
# Parameters: None. # Parameters: None.
configure_environment() { configure_environment() {
@@ -111,8 +131,7 @@ configure_environment() {
if [[ ! -s "$HOME/.bashrc" ]]; then if [[ ! -s "$HOME/.bashrc" ]]; then
printf "%s\n" 'export PATH="/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"' > "$HOME/.bashrc" printf "%s\n" 'export PATH="/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"' > "$HOME/.bashrc"
source "$HOME/.bashrc"
fi fi
export PATH="/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/opt/homebrew/sbin:/usr/local/sbin:/usr/sbin:/sbin:$PATH"
} }
export -f configure_environment export -f configure_environment

View File

@@ -126,3 +126,54 @@ verify_path() {
fi fi
} }
export -f verify_path export -f verify_path
# Checks for missing Node packages.
verify_node_packages() {
local packages=$(yarn global list --json | grep '"type":"info"')
printf "\nChecking Node packages...\n"
while read line; do
if [[ "$line" == "yarn global add"* ]]; then
local package=$(printf "$line" | awk '{print $4}')
verify_listed_application "$package" "${packages[*]}"
fi
done < "$MAC_OS_CONFIG_PATH/bin/install_node_packages"
printf "Node packages check complete.\n"
}
export -f verify_node_packages
# Checks for missing Ruby gems.
verify_ruby_gems() {
local gems="$(gem list --no-versions)"
printf "\nChecking Ruby gems...\n"
while read line; do
if [[ "$line" == "gem install"* ]]; then
local gem=$(printf "$line" | awk '{print $3}')
verify_listed_application "$gem" "${gems[*]}"
fi
done < "$MAC_OS_CONFIG_PATH/bin/install_ruby_gems"
printf "Ruby gems check complete.\n"
}
export -f verify_ruby_gems
# Checks for missing Rust crates.
verify_rust_crates() {
printf "\nChecking Rust crates...\n"
local crates="$(ls -A1 $HOME/.cargo/bin)"
while read line; do
if [[ "$line" == "cargo install"* ]]; then
local crate=$(printf "$line" | awk '{print $3}')
verify_listed_application "$crate" "${crates[*]}"
fi
done < "$MAC_OS_CONFIG_PATH/bin/install_rust_crates"
printf "Rust crates check complete.\n"
}
export -f verify_rust_crates