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:
63
lib/utilities.sh
Normal file
63
lib/utilities.sh
Normal 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
|
||||
Reference in New Issue
Block a user