Flatten directory structure and update documentation

- Moved all files from mac_os/ subdirectory to repository root
- Updated README.adoc to reflect simplified architecture
- Updated QUICK_INSTALL.md with all current apps
- Added claude-cli to install.sh and bin/install_homebrew_formulas
- Repository now shows clean file structure without nested mac_os folder
- Documentation now accurately describes opinionated installer approach

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-09 13:31:07 -06:00
parent 74943e31f4
commit 2fcf26506a
89 changed files with 167 additions and 249 deletions

27
lib/installers.sh Normal file
View File

@@ -0,0 +1,27 @@
#! /usr/bin/env bash
# Defines software installer functions.
# Label: Install Homebrew
# Description: Install and setup Homebrew.
install_homebrew() {
if ! command -v brew > /dev/null; then
/bin/bash -c "$(curl --location --fail --silent --show-error https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Determine Homebrew path based on architecture
local brew_path="/opt/homebrew/bin/brew"
if [[ "$(/usr/bin/arch)" != "arm64" ]]; then
brew_path="/usr/local/bin/brew"
fi
# Add to shell profile for future sessions
if [[ ! -f "$HOME/.zprofile" ]] || ! grep -q "brew shellenv" "$HOME/.zprofile"; then
echo >> "$HOME/.zprofile"
echo "eval \"\$($brew_path shellenv)\"" >> "$HOME/.zprofile"
fi
# Set up PATH for current session
eval "$($brew_path shellenv)"
fi
}
export -f install_homebrew

53
lib/options.sh Normal file
View File

@@ -0,0 +1,53 @@
#! /usr/bin/env bash
# Defines command line prompt options.
# Colors for output
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Label: Process Option
# Description: Run script based on selection.
# Parameters: $1 (required): The option to process.
process_option() {
case $1 in
'b')
bin/install_basics;;
't')
bin/install_dev_tools;;
'hf')
bin/install_homebrew_formulas;;
'hc')
bin/install_homebrew_casks;;
'm')
bin/install_app_store;;
'i')
caffeinate_machine
bin/install_basics
bin/install_dev_tools
bin/install_homebrew_formulas
bin/install_homebrew_casks
bin/install_app_store
clean_work_path
printf "\n🎉 ${GREEN}Installation Complete!${NC}\n\n"
printf "✅ All software has been installed successfully!\n\n"
printf "${YELLOW}Next steps:${NC}\n"
printf " • Restart your terminal to use Homebrew commands\n"
printf " • Configure installed applications as needed\n"
printf " • Run 'bin/run c' to check installation status\n\n"
printf "${GREEN}Enjoy your new macOS setup!${NC}\n\n";;
'c')
verify_homebrew_formulas
verify_homebrew_casks
verify_app_store_applications;;
'C')
caffeinate_machine;;
'w')
clean_work_path;;
'q');;
*)
printf "ERROR: Invalid option.\n";;
esac
}
export -f process_option

12
lib/settings.sh Normal file
View File

@@ -0,0 +1,12 @@
#! /usr/bin/env bash
set -o nounset
set -o errexit
set -o pipefail
IFS=$'\n\t'
# Get the absolute path to the mac_os directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
export MAC_OS_PATH="$(dirname "$SCRIPT_DIR")"
export MAC_OS_WORK_PATH=/tmp/downloads

63
lib/utilities.sh Normal file
View File

@@ -0,0 +1,63 @@
#! /usr/bin/env bash
# Defines general utility functions.
# Label: Caffeinate Machine
# Description: Keep machine running for a very long time.
caffeinate_machine() {
if [[ -n "$(pgrep -x caffeinate)" ]]; 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
# Label: Clean Work Path
# Description: Clean work path of artifacts.
clean_work_path() {
rm -rf "$MAC_OS_WORK_PATH"
}
export -f clean_work_path
# Label: Get Basename
# Description: Answer file or directory basename.
# Parameters: $1 (required): Path.
get_basename() {
printf "%s" "${1##*/}"
}
export -f get_basename
# Label: Get Homebrew Root
# Description: Answer Homebrew root path.
get_homebrew_root() {
if [[ "$(/usr/bin/arch)" == "arm64" ]]; then
printf "%s" "/opt/homebrew"
else
printf "%s" "/usr/local/Homebrew"
fi
}
export -f get_homebrew_root
# Label: Get Homebrew Bin Root
# Description: Answer Homebrew binary root path.
get_homebrew_bin_root() {
if [[ "$(/usr/bin/arch)" == "arm64" ]]; then
printf "%s" "/opt/homebrew/bin"
else
printf "%s" "/usr/local/bin"
fi
}
export -f get_homebrew_bin_root
# Label: Check Mac App Store Install
# Description: Check Mac App Store (mas) CLI has been installed.
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 mas (i.e. brew install mas) is installed."
exit 1
fi
}
export -f check_mas_install

81
lib/verifiers.sh Normal file
View File

@@ -0,0 +1,81 @@
#! /usr/bin/env bash
# Defines verification/validation functions.
# Label: Verify App Store Applications
# Description: Check for missing App Store applications.
verify_app_store_applications() {
local applications=""
printf "\n%s\n" "Checking App Store applications..."
applications="$(mas list)"
while read line; do
if [[ "$line" == "mas install"* ]]; then
application=$(printf "$line" | awk '{print $3}')
verify_listed_application "$application" "${applications[*]}"
fi
done < "$MAC_OS_PATH/bin/install_app_store"
printf "%s\n" "App Store check complete."
}
export -f verify_app_store_applications
# Label: Verify Homebrew Casks
# Description: Check for missing Homebrew casks.
verify_homebrew_casks() {
local applications=""
printf "\nChecking Homebrew casks...\n"
applications="$(brew list --casks)"
while read line; do
if [[ "$line" == "brew install --cask"* ]]; then
application=$(printf "%s" "$line" | awk '{print $5}')
verify_listed_application "$application" "${applications[*]}"
fi
done < "$MAC_OS_PATH/bin/install_homebrew_casks"
printf "%s\n" "Homebrew cask check complete."
}
export -f verify_homebrew_casks
# Label: Verify Homebrew Formulas
# Description: Check for missing Homebrew formulas.
verify_homebrew_formulas() {
local applications=""
printf "Checking Homebrew formulas...\n"
applications="$(brew list --formulae)"
while read line; do
if [[ "$line" == "brew install"* ]]; then
application=$(printf "%s" "$line" | awk '{print $3}')
# Exception: "gpg" is the binary but is listed as "gnugp".
if [[ "$application" == "gpg" ]]; then
application="gnupg"
fi
verify_listed_application "$application" "${applications[*]}"
fi
done < "$MAC_OS_PATH/bin/install_homebrew_formulas"
printf "%s\n" "Homebrew formula check complete."
}
export -f verify_homebrew_formulas
# Label: Verify Listed Application
# Description: Verify listed application exists.
# Parameters: $1 (required): Current application, $2 (required): Application list.
verify_listed_application() {
local application="$1"
local applications="$2"
if [[ "${applications[*]}" != *"$application"* ]]; then
printf "%s\n" " - Missing: $application"
fi
}
export -f verify_listed_application