mirror of
https://github.com/Lissy93/dotfiles.git
synced 2025-02-10 04:29:14 +01:00
Refactors install script, and adds MacOS-specific symlinks
This commit is contained in:
parent
da21f2690f
commit
8b90d2cc99
@ -17,8 +17,15 @@
|
||||
~/.local/share/tmux: tpm
|
||||
~/.config/utils: utils
|
||||
~/.gitconfig: configs/.gitconfig
|
||||
~/.config/curl/.curlrc: configs/.curlrc
|
||||
~/.Brewfile:
|
||||
if: '[ `uname` = Darwin ]'
|
||||
path: installs/.Brewfile
|
||||
~/.macos:
|
||||
if: '[ `uname` = Darwin ]'
|
||||
path: configs/.macos
|
||||
~/.finicky.js:
|
||||
if: '[ `uname` = Darwin ]'
|
||||
path: configs/.finicky.js
|
||||
- shell:
|
||||
- git submodule sync --recursive
|
||||
|
28
configs/.finicky.js
Normal file
28
configs/.finicky.js
Normal file
@ -0,0 +1,28 @@
|
||||
// Config file for Finicky
|
||||
// Specifies which browser to open based on the URL
|
||||
// Docs: https://github.com/johnste/finicky
|
||||
module.exports = {
|
||||
defaultBrowser: "Firefox",
|
||||
rewrite: [
|
||||
{ // Redirect all urls to use https
|
||||
match: ({ url }) => url.protocol === "http",
|
||||
url: { protocol: "https" }
|
||||
}
|
||||
],
|
||||
handlers: [
|
||||
{ // Open work non-coding stuff in Chromium
|
||||
browser: "/Applications/Chromium.app",
|
||||
match: [
|
||||
"*zoom.com/*",
|
||||
"google.com/*",
|
||||
"*.google.com/*",
|
||||
"*and-digital.zoom.us/*",
|
||||
"*luna.and-digital.com/*",
|
||||
"*and-digital.okta.com/*",
|
||||
"*docs.google.com/*",
|
||||
"*calendar.google.com/*",
|
||||
"*miro.com/*"
|
||||
],
|
||||
},
|
||||
]
|
||||
};
|
133
install.sh
133
install.sh
@ -67,72 +67,89 @@ system_verify () {
|
||||
fi
|
||||
}
|
||||
|
||||
# Show starting banner
|
||||
make_banner "${TITLE}" "${CYAN_B}" 1
|
||||
function pre_setup_tasks () {
|
||||
# Show starting banner
|
||||
make_banner "${TITLE}" "${CYAN_B}" 1
|
||||
|
||||
# Verify required packages are installed
|
||||
system_verify "git" true
|
||||
system_verify "zsh" false
|
||||
system_verify "vim" false
|
||||
system_verify "nvim" false
|
||||
system_verify "tmux" false
|
||||
# Verify required packages are installed
|
||||
system_verify "git" true
|
||||
system_verify "zsh" false
|
||||
system_verify "vim" false
|
||||
system_verify "nvim" false
|
||||
system_verify "tmux" false
|
||||
}
|
||||
|
||||
# If on Mac, offer to install Brew
|
||||
if [ "$system_type" = "Darwin" ] && ! command_exists brew; then
|
||||
read -p "Would you like to install Homebrew? (y/N)" -n 1 -r
|
||||
echo
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
echo -en "🍺 ${YELLOW_B}Installing Homebrew...${RESET}\n"
|
||||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||
function setup_dot_files () {
|
||||
|
||||
# If ZSH not the default shell, ask user if they'd like to set it
|
||||
if [[ $SHELL != *"zsh"* ]] && command_exists zsh; then
|
||||
read -p "Would you like to set ZSH as your default shell? (y/N)" -n 1 -r
|
||||
echo
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
chsh -s $(which zsh) $USER
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# If ZSH not the default shell, ask user if they'd like to set it
|
||||
if [[ $SHELL != *"zsh"* ]] && command_exists zsh; then
|
||||
read -p "Would you like to set ZSH as your default shell? (y/N)" -n 1 -r
|
||||
echo
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
chsh -s $(which zsh) $USER
|
||||
# Download / update dotfiles repo with git
|
||||
if [[ ! -d "$DOTFILES_DIR" ]]
|
||||
then
|
||||
echo "${PURPLE}Dotfiles not yet present. Will download ${REPO_NAME} into ${DOTFILES_DIR}"
|
||||
mkdir -p "${DOTFILES_DIR}"
|
||||
git clone --recursive ${REPO_PATH} ${DOTFILES_DIR}
|
||||
else
|
||||
echo -e "${PURPLE}Pulling changes from ${REPO_NAME} into ${DOTFILES_DIR}"
|
||||
cd "${DOTFILES_DIR}" && git pull && git submodule update --recursive
|
||||
fi
|
||||
fi
|
||||
|
||||
# Download / update dotfiles repo with git
|
||||
if [[ ! -d "$DOTFILES_DIR" ]]
|
||||
then
|
||||
echo "${PURPLE}Dotfiles not yet present. Will download ${REPO_NAME} into ${DOTFILES_DIR}"
|
||||
mkdir -p "${DOTFILES_DIR}"
|
||||
git clone --recursive ${REPO_PATH} ${DOTFILES_DIR}
|
||||
else
|
||||
echo -e "${PURPLE}Pulling changes from ${REPO_NAME} into ${DOTFILES_DIR}"
|
||||
cd "${DOTFILES_DIR}" && git pull && git submodule update --recursive
|
||||
fi
|
||||
# If git clone / pull failed, then exit with error
|
||||
ret=$?
|
||||
if ! test "$ret" -eq 0
|
||||
then
|
||||
echo >&2 "${RED_B}Failed to fetch dotfiels $ret${RESET}"
|
||||
terminate
|
||||
fi
|
||||
|
||||
# If git clone / pull failed, then exit with error
|
||||
ret=$?
|
||||
if ! test "$ret" -eq 0
|
||||
then
|
||||
echo >&2 "${RED_B}Failed to fetch dotfiels $ret${RESET}"
|
||||
terminate
|
||||
fi
|
||||
# Set up symlinks with dotbot
|
||||
cd "${DOTFILES_DIR}"
|
||||
git -C "${DOTBOT_DIR}" submodule sync --quiet --recursive
|
||||
git submodule update --init --recursive "${DOTBOT_DIR}"
|
||||
chmod +x dotbot/bin/dotbot
|
||||
"${DOTFILES_DIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" -d "${DOTFILES_DIR}" -c "${CONFIG}" "${@}"
|
||||
}
|
||||
|
||||
# # If on Mac, update Brew bundle
|
||||
if [ "$system_type" = "Darwin" ] && command_exists brew && [ -f "$HOME/.Brewfile" ]
|
||||
then
|
||||
echo "Updating homebrew bundle"
|
||||
brew bundle --global
|
||||
fi
|
||||
function install_packages () {
|
||||
# If on Mac, offer to install Brew
|
||||
if [ "$system_type" = "Darwin" ] && ! command_exists brew; then
|
||||
read -p "Would you like to install Homebrew? (y/N)" -n 1 -r
|
||||
echo
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
echo -en "🍺 ${YELLOW_B}Installing Homebrew...${RESET}\n"
|
||||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||
export PATH=/opt/homebrew/bin:$PATH
|
||||
fi
|
||||
fi
|
||||
|
||||
# Set up symlinks with dotbot
|
||||
cd "${DOTFILES_DIR}"
|
||||
git -C "${DOTBOT_DIR}" submodule sync --quiet --recursive
|
||||
git submodule update --init --recursive "${DOTBOT_DIR}"
|
||||
chmod +x dotbot/bin/dotbot
|
||||
"${DOTFILES_DIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" -d "${DOTFILES_DIR}" -c "${CONFIG}" "${@}"
|
||||
# If on Mac, update Brew bundle
|
||||
if [ "$system_type" = "Darwin" ] && command_exists brew && [ -f "$HOME/.Brewfile" ]
|
||||
then
|
||||
echo -e "${PURPLE}Updating homebrew bundle${RESET}"
|
||||
brew bundle --global
|
||||
fi
|
||||
}
|
||||
|
||||
# Update source to ZSH entry point
|
||||
source "${HOME}/.zshenv"
|
||||
function finishing_up () {
|
||||
# Update source to ZSH entry point
|
||||
source "${HOME}/.zshenv"
|
||||
|
||||
# Print success message, and time taken
|
||||
total_time=$((`date +%s`-start_time))
|
||||
make_banner "✨ Dotfiles configured succesfully in $total_time seconds" ${GREEN_B} 1
|
||||
exit 0
|
||||
# Print success message, and time taken
|
||||
total_time=$((`date +%s`-start_time))
|
||||
make_banner "✨ Dotfiles configured succesfully in $total_time seconds" ${GREEN_B} 1
|
||||
exit 0
|
||||
}
|
||||
|
||||
# Begin!
|
||||
pre_setup_tasks # Print start message, and check requirements are met
|
||||
setup_dot_files # Clone / updatae dotfiles, and setup symlinks
|
||||
install_packages # Prompt to install / update OS-dependant packages
|
||||
finishing_up # Re-source .zshenv, and print summary
|
||||
# All done!
|
||||
|
Loading…
Reference in New Issue
Block a user