Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5455a76d14 | ||
|
|
5569fdb345 | ||
|
|
8f2173c938 | ||
|
|
4f1ed26934 | ||
|
|
b7c89266f6 |
@@ -1,5 +1,12 @@
|
||||
= Changes
|
||||
|
||||
== 9.0.0 (2020-09-12)
|
||||
|
||||
* Fixed Homebrew cask verifier deprecation warning
|
||||
* Removed Homebrew Mecurial formula verification check
|
||||
* Removed unnecessary verifier code comments
|
||||
* Refactored utility basename and extension utilities
|
||||
|
||||
== 8.2.0 (2020-07-22)
|
||||
|
||||
* Fixed project requirements
|
||||
|
||||
@@ -59,7 +59,7 @@ To install, run:
|
||||
----
|
||||
git clone https://github.com/bkuhlmann/mac_os.git
|
||||
cd mac_os
|
||||
git checkout 8.2.0
|
||||
git checkout 9.0.0
|
||||
----
|
||||
|
||||
=== Development
|
||||
|
||||
@@ -136,7 +136,7 @@ export -f install_program
|
||||
# Parameters: $1 (required) - Repository URL, $2 (required) - Install path, $3 (optional) - Git clone options.
|
||||
install_git_app() {
|
||||
local repository_url="$1"
|
||||
local app_name=$(get_file_name "$2")
|
||||
local app_name=$(get_basename "$2")
|
||||
local install_path="$2"
|
||||
local options="--quiet"
|
||||
|
||||
@@ -175,7 +175,7 @@ export -f install_git_project
|
||||
# Parameters: $1 (required) - URL, $2 (required) - Install path.
|
||||
install_file() {
|
||||
local file_url="$1"
|
||||
local file_name=$(get_file_name "$1")
|
||||
local file_name=$(get_basename "$1")
|
||||
local install_path="$2"
|
||||
|
||||
if [[ ! -e "$install_path" ]]; then
|
||||
@@ -206,7 +206,7 @@ export -f download_file
|
||||
# Parameters: $1 (required) - Application source path, $2 (required) - Application name.
|
||||
install_app() {
|
||||
local install_root=$(get_install_root "$2")
|
||||
local file_extension=$(get_file_extension "$2")
|
||||
local file_extension=$(get_extension "$2")
|
||||
|
||||
printf "Installing: $install_root/$2...\n"
|
||||
|
||||
|
||||
@@ -2,6 +2,19 @@
|
||||
|
||||
# Defines general utility functions.
|
||||
|
||||
# Caffeinate machine.
|
||||
caffeinate_machine() {
|
||||
local pid=$(pgrep -x caffeinate)
|
||||
|
||||
if [[ -n "$pid" ]]; then
|
||||
printf "Machine is already caffeinated!\n"
|
||||
else
|
||||
caffeinate -s -u -d -i -t 3153600000 > /dev/null &
|
||||
printf "Machine caffeinated.\n"
|
||||
fi
|
||||
}
|
||||
export -f caffeinate_machine
|
||||
|
||||
# Answers the full install path (including file name) for file name.
|
||||
# Parameters: $1 (required) - The file name.
|
||||
get_install_path() {
|
||||
@@ -17,24 +30,11 @@ clean_work_path() {
|
||||
}
|
||||
export -f clean_work_path
|
||||
|
||||
# Caffeinate machine.
|
||||
caffeinate_machine() {
|
||||
local pid=$(pgrep -x caffeinate)
|
||||
|
||||
if [[ -n "$pid" ]]; then
|
||||
printf "Whoa, tweaker, machine is already caffeinated!\n"
|
||||
else
|
||||
caffeinate -s -u -d -i -t 3153600000 > /dev/null &
|
||||
printf "Machine caffeinated.\n"
|
||||
fi
|
||||
}
|
||||
export -f caffeinate_machine
|
||||
|
||||
# Answers the root install path for file name.
|
||||
# Parameters: $1 (required) - The file name.
|
||||
get_install_root() {
|
||||
local file_name="$1"
|
||||
local file_extension=$(get_file_extension "$file_name")
|
||||
local file_extension=$(get_extension "$file_name")
|
||||
|
||||
# Dynamically build the install path based on file extension.
|
||||
case $file_extension in
|
||||
@@ -52,10 +52,17 @@ get_install_root() {
|
||||
}
|
||||
export -f get_install_root
|
||||
|
||||
# Answers the file or directory basename.
|
||||
# Parameters: $1 (required) - The file path.
|
||||
get_basename() {
|
||||
printf "${1##*/}" # Answers file or directory name.
|
||||
}
|
||||
export -f get_basename
|
||||
|
||||
# Answers the file extension.
|
||||
# Parameters: $1 (required) - The file name.
|
||||
get_file_extension() {
|
||||
local name=$(get_file_name "$1")
|
||||
get_extension() {
|
||||
local name=$(get_basename "$1")
|
||||
local extension="${1##*.}" # Excludes dot.
|
||||
|
||||
if [[ "$name" == "$extension" ]]; then
|
||||
@@ -64,11 +71,4 @@ get_file_extension() {
|
||||
printf "$extension"
|
||||
fi
|
||||
}
|
||||
export -f get_file_extension
|
||||
|
||||
# Answers the file name.
|
||||
# Parameters: $1 (required) - The file path.
|
||||
get_file_name() {
|
||||
printf "${1##*/}" # Answers file or directory name.
|
||||
}
|
||||
export -f get_file_name
|
||||
export -f get_extension
|
||||
|
||||
@@ -9,7 +9,6 @@ verify_homebrew_formulas() {
|
||||
local applications="$(brew list)"
|
||||
|
||||
while read line; do
|
||||
# Skip blank or comment lines.
|
||||
if [[ "$line" == "brew install"* ]]; then
|
||||
local application=$(printf "$line" | awk '{print $3}')
|
||||
|
||||
@@ -18,11 +17,6 @@ verify_homebrew_formulas() {
|
||||
application="gnupg"
|
||||
fi
|
||||
|
||||
# Exception: "hg" is the binary but is listed as "mercurial".
|
||||
if [[ "$application" == "hg" ]]; then
|
||||
application="mercurial"
|
||||
fi
|
||||
|
||||
verify_listed_application "$application" "${applications[*]}"
|
||||
fi
|
||||
done < "$MAC_OS_CONFIG_PATH/bin/install_homebrew_formulas"
|
||||
@@ -35,23 +29,11 @@ export -f verify_homebrew_formulas
|
||||
verify_homebrew_casks() {
|
||||
printf "\nChecking Homebrew casks...\n"
|
||||
|
||||
local applications="$(brew cask list)"
|
||||
local applications="$(brew list --cask)"
|
||||
|
||||
while read line; do
|
||||
# Skip blank or comment lines.
|
||||
if [[ "$line" == "brew cask install"* ]]; then
|
||||
local application=$(printf "$line" | awk '{print $4}')
|
||||
|
||||
# Skip: Only necessary for the purpose of licensing system preference.
|
||||
if [[ "$application" == "witch" ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Skip: Bug with Homebrew Cask as these apps never show up as installed.
|
||||
if [[ "$application" == "skitch" || "$application" == "openemu" ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
verify_listed_application "$application" "${applications[*]}"
|
||||
fi
|
||||
done < "$MAC_OS_CONFIG_PATH/bin/install_homebrew_casks"
|
||||
@@ -67,7 +49,6 @@ verify_app_store_applications() {
|
||||
local applications="$(mas list)"
|
||||
|
||||
while read line; do
|
||||
# Skip blank or comment lines.
|
||||
if [[ "$line" == "mas install"* ]]; then
|
||||
local application=$(printf "$line" | awk '{print $3}')
|
||||
verify_listed_application "$application" "${applications[*]}"
|
||||
@@ -99,7 +80,6 @@ verify_applications() {
|
||||
|
||||
# For each application name, check to see if the application is installed. Otherwise, skip.
|
||||
for name in $file_names; do
|
||||
# Pass the key value to verfication.
|
||||
verify_application "${!name}"
|
||||
done
|
||||
|
||||
@@ -111,8 +91,6 @@ export -f verify_applications
|
||||
# Parameters: $1 (required) - The file name.
|
||||
verify_application() {
|
||||
local file_name="$1"
|
||||
|
||||
# Display the missing install if not found.
|
||||
local install_path=$(get_install_path "$file_name")
|
||||
|
||||
if [[ ! -e "$install_path" ]]; then
|
||||
@@ -143,7 +121,6 @@ export -f verify_extensions
|
||||
verify_path() {
|
||||
local path="$1"
|
||||
|
||||
# Display the missing path if not found.
|
||||
if [[ ! -e "$path" ]]; then
|
||||
printf " - Missing: $path\n"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user