If on Mac, restore the launchpad layout with lporg

This commit is contained in:
Alicia Sykes 2022-09-08 20:45:44 +01:00
parent a37772b4b9
commit 69cc313051

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/bash
# Dotfile setup script
# Fetches latest changes, symlinks files, and installs dependencies
@ -146,17 +146,8 @@ function apply_preferences () {
/bin/zsh -i -c "antigen update && antigen-apply"
}
# Based on system type, uses appropriate package manager to install / updates apps
function install_packages () {
read -t $PROMPT_TIMEOUT -p "$(echo -e $CYAN_B)Would you like to install / update system packages? (y/N) " -n 1 -r
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo -e "\n${PURPLE}Skipping package installs${RESET}"
return
fi
echo
# Mac OS
if [ "$system_type" = "Darwin" ]; then
# Setup Brew, install / update packages and check for macOS updates
function intall_macos_packages () {
# Homebrew not installed, ask user if they'd like to download it now
if ! command_exists brew; then
read -t $PROMPT_TIMEOUT -p "$(echo -e $CYAN_B)Would you like to install Homebrew? (y/N)" -n 1 -r
@ -173,10 +164,13 @@ function install_packages () {
echo -e "${PURPLE}Updating homebrew and packages...${RESET}"
brew update
brew upgrade
BREW_PREFIX=$(brew --prefix)
brew bundle --global --file $HOME/.Brewfile
brew cleanup
fi
# Restore launchpad structure with lporg
if ! command_exists lporg && [ -f "$DOTFILES_DIR/configs/macos/launchpad.yml" ]; then
echo -e "${PURPLE}Restoring Launchpad Layout...${RESET}"
fi
# Check for MacOS software updates, and ask user if they'd like to install
echo -e "${PURPLE}Checking for software updates...${RESET}"
pending_updates=$(softwareupdate -l 2>&1)
@ -190,6 +184,23 @@ function install_packages () {
echo -e "${GREEN}System is up-to-date."\
"Running $(sw_vers -productName) version $(sw_vers -productVersion)${RESET}"
fi
}
# Based on system type, uses appropriate package manager to install / updates apps
function install_packages () {
read -t $PROMPT_TIMEOUT -p "$(echo -e $CYAN_B)Would you like to install / update system packages? (y/N) " -n 1 -r
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo -e "\n${PURPLE}Skipping package installs${RESET}"
return
fi
# Ask for users password
echo -e "\n${PURPLE}Some install steps may require elevated permissions.${CYAN_B}\n\
You can enter your password now, to avoid typing it for each stage, or Ctrl+C to skip.${RESET}"
sudo -v
# Mac OS
if [ "$system_type" = "Darwin" ]; then
intall_macos_packages
fi
}