Refactored bin script printing
Necessary to have consistent use of `printf` especially with formatting strings and new lines. Milestone: patch
This commit is contained in:
@@ -2,33 +2,33 @@
|
|||||||
|
|
||||||
# Creates macOS boot disk.
|
# Creates macOS boot disk.
|
||||||
|
|
||||||
printf "macOS Boot Disk Tips\n"
|
printf "%s\n" "macOS Boot Disk Tips"
|
||||||
printf " - Use a USB drive (8GB or higher).\n"
|
printf "%s\n" " - Use a USB drive (8GB or higher)."
|
||||||
printf " - Use Disk Utility to format the USB drive as \"APSF\".\n"
|
printf "%s\n" " - Use Disk Utility to format the USB drive as \"APSF\"."
|
||||||
printf " - Use Disk Utility to label the USB drive as \"Untitled\".\n"
|
printf "%s\n" " - Use Disk Utility to label the USB drive as \"Untitled\"."
|
||||||
printf "\nmacOS Boot Disk Usage:\n"
|
printf "\n%s\n" "macOS Boot Disk Usage:"
|
||||||
printf " 1. Insert the USB boot disk into the machine to be upgraded.\n"
|
printf "%s\n" " 1. Insert the USB boot disk into the machine to be upgraded."
|
||||||
printf " 2. Reboot the machine.\n"
|
printf "%s\n" " 2. Reboot the machine."
|
||||||
printf " 3. Press and hold the POWER key before the Apple logo appears.\n"
|
printf "%s\n" " 3. Press and hold the POWER key before the Apple logssssso appears."
|
||||||
printf " 4. Select the USB boot disk from the menu.\n"
|
printf "%s\n" " 4. Select the USB boot disk from the menu."
|
||||||
printf " 5. Use Disk Utility to delete and/or erase the hard drive including associated partitions.\n"
|
printf "%s\n" " 5. Use Disk Utility to delete and/or erase the hard drive including associated partitions."
|
||||||
printf " 6. Use Disk Utility to create a single \"APFS\" drive.\n"
|
printf "%s\n" " 6. Use Disk Utility to create a single \"APFS\" drive."
|
||||||
printf " 7. Install the new operating system.\n"
|
printf "%s\n" " 7. Install the new operating system."
|
||||||
printf "\nmacOS Boot Disk Recovery:\n"
|
printf "\n%s\n" "macOS Boot Disk Recovery:"
|
||||||
printf " 1. Start/restart the machine.\n"
|
printf "%s\n" " 1. Start/restart the machine."
|
||||||
printf " 2. Press and hold the POWER key before the Apple logo appears.\n"
|
printf "%s\n" " 2. Press and hold the POWER key before the Apple logo appears."
|
||||||
printf " 3. Wait for the macOS installer to load from the recovery partition.\n"
|
printf "%s\n" " 3. Wait for the macOS installer to load from the recovery partition."
|
||||||
printf " 4. Use the dialog options to launch Disk Utility, reinstall the system, etc.\n"
|
printf "%s\n" " 4. Use the dialog options to launch Disk Utility, reinstall the system, etc."
|
||||||
|
|
||||||
printf "\nCreating macOS boot disk...\n"
|
printf "\n%s\n" "Creating macOS boot disk..."
|
||||||
|
|
||||||
if [[ ! -e "$MAC_OS_BOOT_DISK_CREATOR" ]]; then
|
if [[ ! -e "$MAC_OS_BOOT_DISK_CREATOR" ]]; then
|
||||||
printf "ERROR: macOS installer does not exist: $MAC_OS_BOOT_DISK_CREATOR. Use System Preferences → Software Update to download.\n"
|
printf "%s\n" "ERROR: macOS installer does not exist: $MAC_OS_BOOT_DISK_CREATOR. Use System Preferences → Software Update to download."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -d "$MAC_OS_BOOT_DISK_PATH" ]]; then
|
if [[ ! -d "$MAC_OS_BOOT_DISK_PATH" ]]; then
|
||||||
printf "ERROR: Boot disk must be mounted at: $MAC_OS_BOOT_DISK_PATH.\n"
|
printf "%s\n" "ERROR: Boot disk must be mounted at: $MAC_OS_BOOT_DISK_PATH."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -13,5 +13,5 @@ if [[ -x "$SCRIPT_PATH" ]]; then
|
|||||||
check_mas_install
|
check_mas_install
|
||||||
"$SCRIPT_PATH"
|
"$SCRIPT_PATH"
|
||||||
else
|
else
|
||||||
printf "WARNING: App Store install script does not exist or is not executable.\n"
|
printf "%s\n" "WARNING: App Store install script does not exist or is not executable."
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -12,5 +12,5 @@ SCRIPT_PATH="$MAC_OS_CONFIG_PATH/bin/install_applications"
|
|||||||
if [[ -x "$SCRIPT_PATH" ]]; then
|
if [[ -x "$SCRIPT_PATH" ]]; then
|
||||||
"$SCRIPT_PATH"
|
"$SCRIPT_PATH"
|
||||||
else
|
else
|
||||||
printf "WARNING: Applications install script does not exist or is not executable.\n"
|
printf "%s\n" "WARNING: Applications install script does not exist or is not executable."
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -12,5 +12,5 @@ SCRIPT_PATH="$MAC_OS_CONFIG_PATH/bin/install_basics"
|
|||||||
if [[ -x "$SCRIPT_PATH" ]]; then
|
if [[ -x "$SCRIPT_PATH" ]]; then
|
||||||
"$SCRIPT_PATH"
|
"$SCRIPT_PATH"
|
||||||
else
|
else
|
||||||
printf "WARNING: Basic settings script does not exist or is not executable.\n"
|
printf "%s\n" "WARNING: Basic settings script does not exist or is not executable."
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -12,5 +12,5 @@ SCRIPT_PATH="$MAC_OS_CONFIG_PATH/bin/install_defaults"
|
|||||||
if [[ -x "$SCRIPT_PATH" ]]; then
|
if [[ -x "$SCRIPT_PATH" ]]; then
|
||||||
"$SCRIPT_PATH"
|
"$SCRIPT_PATH"
|
||||||
else
|
else
|
||||||
printf "WARNING: Default settings script does not exist or is not executable.\n"
|
printf "%s\n" "WARNING: Default settings script does not exist or is not executable."
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
#! /usr/bin/env bash
|
#! /usr/bin/env bash
|
||||||
|
|
||||||
Installs development tooling requirements.
|
# Installs development tooling requirements.
|
||||||
|
|
||||||
printf "Installing Xcode CLI tools...\n"
|
printf "%s\n" "Installing Xcode CLI tools..."
|
||||||
xcode-select --install
|
xcode-select --install
|
||||||
|
|
||||||
printf "%s\n" "💡 ALT+TAB to view and accept Xcode license window."
|
printf "%s\n" "💡 ALT+TAB to view and accept Xcode license window."
|
||||||
read -p "Have you completed the Xcode CLI tools install (y/n)? " xcode_response
|
read -p "Have you completed the Xcode CLI tools install (y/n)? " xcode_response
|
||||||
if [[ "$xcode_response" != "y" ]]; then
|
if [[ "$xcode_response" != "y" ]]; then
|
||||||
printf "ERROR: Xcode CLI tools must be installed before proceeding.\n"
|
printf "%s\n" "ERROR: Xcode CLI tools must be installed before proceeding."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -12,5 +12,5 @@ SCRIPT_PATH="$MAC_OS_CONFIG_PATH/bin/install_extensions"
|
|||||||
if [[ -x "$SCRIPT_PATH" ]]; then
|
if [[ -x "$SCRIPT_PATH" ]]; then
|
||||||
"$SCRIPT_PATH"
|
"$SCRIPT_PATH"
|
||||||
else
|
else
|
||||||
printf "WARNING: Application extensions install script does not exist or is not executable.\n"
|
printf "%s\n" "WARNING: Application extensions install script does not exist or is not executable."
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -13,5 +13,5 @@ if [[ -x "$SCRIPT_PATH" ]]; then
|
|||||||
install_homebrew
|
install_homebrew
|
||||||
"$SCRIPT_PATH"
|
"$SCRIPT_PATH"
|
||||||
else
|
else
|
||||||
printf "WARNING: Homebrew Casks install script does not exist or is not executable.\n"
|
printf "%s\n" "WARNING: Homebrew Casks install script does not exist or is not executable."
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -13,5 +13,5 @@ if [[ -x "$SCRIPT_PATH" ]]; then
|
|||||||
install_homebrew
|
install_homebrew
|
||||||
"$SCRIPT_PATH"
|
"$SCRIPT_PATH"
|
||||||
else
|
else
|
||||||
printf "WARNING: Homebrew Formulas install script does not exist or is not executable.\n"
|
printf "%s\n" "WARNING: Homebrew Formulas install script does not exist or is not executable."
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -13,5 +13,5 @@ if [[ -x "$SCRIPT_PATH" ]]; then
|
|||||||
install_node
|
install_node
|
||||||
"$SCRIPT_PATH"
|
"$SCRIPT_PATH"
|
||||||
else
|
else
|
||||||
printf "WARNING: Node packages install script does not exist or is not executable.\n"
|
printf "%s\n" "WARNING: Node packages install script does not exist or is not executable."
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -13,5 +13,5 @@ if [[ -x "$SCRIPT_PATH" ]]; then
|
|||||||
install_ruby
|
install_ruby
|
||||||
"$SCRIPT_PATH"
|
"$SCRIPT_PATH"
|
||||||
else
|
else
|
||||||
printf "WARNING: Ruby gems install script does not exist or is not executable.\n"
|
printf "%s\n" "WARNING: Ruby gems install script does not exist or is not executable."
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -13,5 +13,5 @@ if [[ -x "$SCRIPT_PATH" ]]; then
|
|||||||
install_rust
|
install_rust
|
||||||
"$SCRIPT_PATH"
|
"$SCRIPT_PATH"
|
||||||
else
|
else
|
||||||
printf "WARNING: Rust crates install script does not exist or is not executable.\n"
|
printf "%s\n" "WARNING: Rust crates install script does not exist or is not executable."
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -12,5 +12,5 @@ SCRIPT_PATH="$MAC_OS_CONFIG_PATH/bin/install_shell"
|
|||||||
if [[ -x "$SCRIPT_PATH" ]]; then
|
if [[ -x "$SCRIPT_PATH" ]]; then
|
||||||
"$SCRIPT_PATH"
|
"$SCRIPT_PATH"
|
||||||
else
|
else
|
||||||
printf "WARNING: Shell script does not exist or is not executable.\n"
|
printf "%s\n" "WARNING: Shell script does not exist or is not executable."
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -12,5 +12,5 @@ SCRIPT_PATH="$MAC_OS_CONFIG_PATH/bin/restore_backup"
|
|||||||
if [[ -x "$SCRIPT_PATH" ]]; then
|
if [[ -x "$SCRIPT_PATH" ]]; then
|
||||||
"$SCRIPT_PATH"
|
"$SCRIPT_PATH"
|
||||||
else
|
else
|
||||||
printf "WARNING: Restore backup script does not exist or is not executable.\n"
|
printf "%s\n" "WARNING: Restore backup script does not exist or is not executable."
|
||||||
fi
|
fi
|
||||||
|
|||||||
70
bin/run
70
bin/run
@@ -11,13 +11,13 @@ source lib/verifiers.sh
|
|||||||
if [[ -e "$MAC_OS_CONFIG_PATH" ]]; then
|
if [[ -e "$MAC_OS_CONFIG_PATH" ]]; then
|
||||||
source "$MAC_OS_CONFIG_PATH/lib/settings.sh"
|
source "$MAC_OS_CONFIG_PATH/lib/settings.sh"
|
||||||
else
|
else
|
||||||
printf "ERROR: Unable to load macOS configuration: $MAC_OS_CONFIG_PATH.\n\n"
|
printf "%s\n\n" "ERROR: Unable to load macOS configuration: $MAC_OS_CONFIG_PATH."
|
||||||
printf "Please check the following before continuing:\n"
|
printf "%s\n" "Please check the following before continuing:"
|
||||||
printf " • Download the default macOS configuration here: https://github.com/bkuhlmann/mac_os-config.\n"
|
printf "%s\n" " • Download the default macOS configuration here: https://github.com/bkuhlmann/mac_os-config."
|
||||||
printf " • Customize as necessary for your setup or fork the project and make your own configuration.\n"
|
printf "%s\n" " • Customize as necessary for your setup or fork the project and make your own configuration."
|
||||||
printf " • When finished, your folder structure should look like this:\n"
|
printf "%s\n" " • When finished, your folder structure should look like this:"
|
||||||
printf " • <root path>/mac_os:\n"
|
printf "%s\n" " • <root path>/mac_os:"
|
||||||
printf " • <root path>/mac_os-config:\n"
|
printf "%s\n" " • <root path>/mac_os-config:"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -25,37 +25,37 @@ configure_environment
|
|||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
if [[ $# == 0 ]]; then
|
if [[ $# == 0 ]]; then
|
||||||
printf "\nUsage: run OPTION\n"
|
printf "\n%s\n" "Usage: run OPTION"
|
||||||
printf "\nOSX Options:\n"
|
printf "\n%s\n" "OSX Options:"
|
||||||
printf " Boot:\n"
|
printf "%s\n" " Boot:"
|
||||||
printf " B: Create boot disk.\n"
|
printf "%s\n" " B: Create boot disk."
|
||||||
printf " Install:\n"
|
printf "%s\n" " Install:"
|
||||||
printf " b: Install basics.\n"
|
printf "%s\n" " b: Install basics."
|
||||||
printf " t: Install development tools.\n"
|
printf "%s\n" " t: Install development tools."
|
||||||
printf " hf: Install Homebrew Formulas.\n"
|
printf "%s\n" " hf: Install Homebrew Formulas."
|
||||||
printf " hc: Install Homebrew Casks.\n"
|
printf "%s\n" " hc: Install Homebrew Casks."
|
||||||
printf " m: Install Mac App Store software.\n"
|
printf "%s\n" " m: Install Mac App Store software."
|
||||||
printf " a: Install application software.\n"
|
printf "%s\n" " a: Install application software."
|
||||||
printf " x: Install application software extensions.\n"
|
printf "%s\n" " x: Install application software extensions."
|
||||||
printf " d: Install defaults.\n"
|
printf "%s\n" " d: Install defaults."
|
||||||
printf " s: Install shell.\n"
|
printf "%s\n" " s: Install shell."
|
||||||
printf " r: Restore backups.\n"
|
printf "%s\n" " r: Restore backups."
|
||||||
printf " i: Install all (i.e. executes all of the above steps in order listed).\n"
|
printf "%s\n" " i: Install all (i.e. executes all of the above steps in order listed)."
|
||||||
printf " Libraries:\n"
|
printf "%s\n" " Libraries:"
|
||||||
printf " np: Install Node packages.\n"
|
printf "%s\n" " np: Install Node packages."
|
||||||
printf " rg: Install Ruby gems.\n"
|
printf "%s\n" " rg: Install Ruby gems."
|
||||||
printf " rc: Install Rust crates.\n"
|
printf "%s\n" " rc: Install Rust crates."
|
||||||
printf " l: Install libraries (i.e. executes all of the above steps in order listed).\n"
|
printf "%s\n" " l: Install libraries (i.e. executes all of the above steps in order listed)."
|
||||||
printf " Manage:\n"
|
printf "%s\n" " Manage:"
|
||||||
printf " c: Check status of managed software.\n"
|
printf "%s\n" " c: Check status of managed software."
|
||||||
printf " C: Caffeinate machine.\n"
|
printf "%s\n" " C: Caffeinate machine."
|
||||||
printf " w: Clean work (temp) directory.\n"
|
printf "%s\n" " w: Clean work (temp) directory."
|
||||||
printf " q: Quit/Exit.\n\n"
|
printf "%s\n\n" " q: Quit/Exit."
|
||||||
read -p "Enter selection: " response
|
read -p "Enter selection: " response
|
||||||
printf "\n"
|
printf "\n"
|
||||||
process_option $response
|
process_option "$response"
|
||||||
else
|
else
|
||||||
process_option $1
|
process_option "$1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
break
|
break
|
||||||
|
|||||||
Reference in New Issue
Block a user