Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Jayashakthi28/e182043672a8f396543f6f6d204f3b31 to your computer and use it in GitHub Desktop.
Save Jayashakthi28/e182043672a8f396543f6f6d204f3b31 to your computer and use it in GitHub Desktop.
#!/usr/bin/env zsh
# Note: This script is specific to my setup and not useful for others.
# You can run this script using this command:
# curl -L https://gist.github.com/Jayashakthi28/e182043672a8f396543f6f6d204f3b31/raw --create-dirs -o ${HOME}/.bin/macos/fresh-install-jsv.sh; chmod +x ${HOME}/.bin/macos/fresh-install-jsv.sh; ${HOME}/.bin/macos/fresh-install-jsv.sh
# These env vars are duplicated intentionally since this script would bootstrap the installation
USERNAME=${USERNAME:-$(whoami)}
PERSONAL_PROFILES_DIR=${PERSONAL_PROFILES_DIR:-"${HOME}/personal/${USERNAME}/profiles"}
PERSONAL_BIN_DIR=${PERSONAL_BIN_DIR:-"${HOME}/.bin"}
rm -rf "${HOME}/.gitconfig-template.inc"
# utility functions
source "${HOME}/.aliases"
override_prompt() {
printf "$(green 'Downloading') $2 : "
if [ ! -f "$2" ]; then
echo "" # Dummy echo for new line
curl -L "$1" --create-dirs -o "$2"
else
read "yn?$(red 'already present'). Should I override [yn]? "
case $yn in
[Yy]*) curl -L "$1" --create-dirs -o "$2" ;;
[Nn]*) echo "$(yellow 'skipping')";;
esac
fi
}
# override_prompt https://gist.github.com/vraravam/eb2161236d78fc0bda77/raw "${HOME}/.gemrc"
#######################
# Install bin scripts #
#######################
override_prompt https://gist.github.com/Jayashakthi28/2bf65034c07d081e8fd661549edf3ad8/raw "${HOME}/.bin/macos/capture-defauts.sh"
override_prompt https://gist.github.com/Jayashakthi28/1cd6f312e1b96b60b540df527216830b/raw "${HOME}/.bin/macos/approve-fingerprint-sudo.sh"
override_prompt https://gist.github.com/Jayashakthi28/1dd3fef4274e63a4ce8281be50d85100/raw "${HOME}/.bin/macos/osx-defaults.sh"
override_prompt https://gist.github.com/vraravam/a066466fec75187e9baba9ee52f3a3e9/raw "${HOME}/.bin/git/resurrect-repositories.rb"
chmod +x ${HOME}/.bin/macos/*
chmod +x ${HOME}/.bin/git/*
#######################
# Clone the home repo #
#######################
if [ ! -d "${HOME}/.git" ]; then
rm -rf "${HOME}/tmp"
mkdir -p "${HOME}/tmp"
git clone --depth=1 keybase://private/jayashakthi28/mac-home-backup "${HOME}/tmp"
mv "${HOME}/tmp/.git" "${HOME}/"
rm -rf "${HOME}/tmp"
############################################################################################################################
# Checkout some of the common dotfiles (these should not have any modifications/conflicts with what is in the remote repo) #
############################################################################################################################
git -C "${HOME}" checkout ".[a-zA-Z]*" personal
git -C "${HOME}" restore-mtime -c
fi
source "${HOME}/.aliases.${USERNAME}"
###########################
# Clone the profiles repo #
###########################
if [ ! -d "${PERSONAL_PROFILES_DIR}/.git" ]; then
rm -rf "${PERSONAL_PROFILES_DIR}"
git clone --depth=1 keybase://private/jayashakthi28/mac-browser-profile-backup "${PERSONAL_PROFILES_DIR}"
git -C "${PERSONAL_PROFILES_DIR}" siu
fi
#########################################
# Fix /etc/hosts file to block facebook #
#########################################
sudo cp "${PERSONAL_BIN_DIR}/macos/etc.hosts" /etc/hosts
##################################################
# Resurrect repositories that I am interested in #
##################################################
sudo chmod -R 600 "${HOME}"/.ssh/*
resurrect-repositories.rb -r "${PERSONAL_CONFIGS_DIR}/personal.yaml"
all restore-mtime -c
allow_all_direnv_configs
install_mise_versions
##################
# Install devbox #
##################
# curl -fsSL https://get.jetpack.io/devbox | bash
# mkdir -p ${HOME}/.config/devbox/lib/ && devbox completion zsh > ${HOME}/.config/devbox/lib/use_devbox.sh
source "${HOME}/.zprofile"
# exec zsh
##############################################
# Load the direnv config for the home folder #
##############################################
cd ..
cd -
# To install the latest versions of the hex, rebar and phoenix packages
# mix local.hex --force && mix local.rebar --force
# mix archive.install hex phx_new 1.4.1
# To install the native-image tool after graalvm is installed
# gu install native-image
# Enabling history for iex shell (might need to be done for each erl that is installed via mise)
# rm -rf tmp
# mkdir -p tmp
# cd tmp || exit
# git clone --depth=1 https://github.com/ferd/erlang-history.git
# cd erlang-history || exit
# sudo make install
# cd ../.. || exit
# rm -rf tmp
# vagrant plugin install vagrant-vbguest
# if installing jhipster for dot-net-core
# TODO: Use the next line since the released version is only for .net 2.2:
# npm i -g generator-jhipster-dotnetcore
# Note: '-g' didnt work. Had to do 'npm init' and then use '--save-dev' to install and link as a local dependency
# npm i -g jhipster/jhipster-dotnetcore
# npm link generator-jhipster-dotnetcore
# jhipster -d --blueprints dotnetcore
###################################################################
# Restore the preferences from the older machine into the new one #
###################################################################
# osx-defaults.sh i
capture-defaults.sh i
# Default tooling for dotnet projects
# dotnet tool install -g dotnet-sonarscanner
# dotnet tool install -g dotnet-format
echo "********** Finished auto installation process: Please perform these manual steps **********"
echo "1. Go to VSCodium > Command Palette (Cmd+Shift+P) > Sync Settings: Download (repository -> user)"
echo "2. Manually setup the Finder preferences for sidebar"
echo "3. Login into iCloud and setup Desktop sync"
echo "4. Login for Software Update to different ID (after iCloud login) for beta updates"
echo "5. Turn off battery in top nav bar"
echo "6. Setup cron jobs"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment