Skip to content

Instantly share code, notes, and snippets.

@alt-romes
Last active September 18, 2021 00:50
Show Gist options
  • Save alt-romes/4a01cab88641d441eab4dfc3b6957d0c to your computer and use it in GitHub Desktop.
Save alt-romes/4a01cab88641d441eab4dfc3b6957d0c to your computer and use it in GitHub Desktop.
Mirrors system-zero-setup private file to a public gist
#!/usr/bin/env bash
# ----- --- -----
echo "Installing developer command line tools..."
xcode-select --install
echo "Installing Homebrew..."
if ! command -v brew >/dev/null 2>&1; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)";
fi;
brew update
BREW_PREFIX=$(brew --prefix)
echo
echo "Installing latest bash with completion, and setting it as the default shell..."
brew install bash
brew install bash-completion@2
if ! grep -Fq "${BREW_PREFIX}/bin/bash" /etc/shells; then
# brew_prefix/bin/bash must be in the /etc/shells file to be a valid shell to change to with chsh (`man chsh`)
echo "${BREW_PREFIX}/bin/bash" | sudo tee -a /etc/shells;
chsh -s "${BREW_PREFIX}/bin/bash";
fi;
# ----- --- -----
function prompt_optinstall {
read -r -p "Do you want to install $1? (y/n) "
if [[ $REPLY =~ ^[Yy]$ ]]
then
echo "Installing..."
return 0
else
echo "Not installed."
return 1
fi
}
# ----- --- -----
echo
echo "Installing tools for control..."
brew install gnupg # privacy/encryptation tools, used to decrypt the private dotfiles
# ----- --- -----
echo
echo "Setting up control..."
echo "To clone the -control- repository, a valid private ssh key is required."
read -r -p "Do you want to load a valid private ssh key? (y/n) "
if [[ $REPLY =~ ^[Yy]$ ]]
then
echo "Move the ssh private key to ~/keys/sshkey"
read -r -p "Input any key afterwards... "
ssh-add ~/keys/sshkey
fi
if [[ ! -d "$HOME/control" ]]
then
git clone --recursive [email protected]:alt-romes/control.git
fi
echo "To decrypt the private dotfiles (which include, e.g., cryptographic keys),"
echo "a valid gnupg secret key is required."
read -r -p "Do you want to load a secret gnupg key? (y/n) "
if [[ $REPLY =~ ^[Yy]$ ]]
then
echo "Move the gnupg secret key to ~/keys/gnupgkey.asc"
read -r -p "Input any key afterwards... "
gpg --import ~/keys/gnupgkey.asc
fi
cd control || exit 1
git pull
source control-setup.sh
# ----- --- -----
echo
echo "Highly recommended installations..."
echo "1) coreutils and updated tools:"
prompt_optinstall "GNU coreutils" && brew install coreutils
echo "Current git version: $(/usr/bin/git --version)"
prompt_optinstall "a possibly more recent git" && brew install git
echo "Current ssh version: $(/usr/bin/ssh -V)"
prompt_optinstall "a possibly more recent openssh" && brew install openssh
echo "2) recommended terminal programs:"
echo "(WARNING: 'ls' is set as an alias to 'exa' in .bash_profile, either it's installed or the alias is deleted):"
prompt_optinstall "exa (modern ls replacement)" && brew install exa # modern ls replacement, 'ls' is set as an alias for it
prompt_optinstall "pass -- the unix password manager" && brew install pass # unix like password manager
prompt_optinstall "pywal (to set colors according to the wallpaper)" && pip3 install https://github.com/dylanaraps/pywal/archive/master.zip # pywal
prompt_optinstall "translate-shell" && brew install translate-shell
prompt_optinstall "weechat" && brew install weechat
prompt_optinstall "ticker" && brew install achannarasappa/tap/ticker
echo "3) recommended programs:"
prompt_optinstall "iterm" && brew install --cask iterm2
prompt_optinstall "anki" && brew install --cask anki
prompt_optinstall "vlc" && brew install --cask vlc
prompt_optinstall "webtorrent" && brew install --cask webtorrent
prompt_optinstall "flycut" && brew install --cask flycut
prompt_optinstall "f.lux" && brew install --cask flux
prompt_optinstall "lyricsx" && brew install --cask lyricsx
echo "4) recommended fonts:"
if prompt_optinstall "the IBM Plex typeface (used by an iTerm profile)"; then
brew tap homebrew/cask-fonts;
brew install --cask font-ibm-plex;
fi;
# ----- --- -----
echo
echo "Other recommended instalations..."
prompt_optinstall "imagemagick (the default pywal backend)" && brew install imagemagick
echo "Current vim version: $(/usr/bin/vim --version)"
echo "(WARNING: The following installation might break pywal):"
echo "If it does, run 'brew uninstall vim' to attempt a fix"
prompt_optinstall "a possibly more recent vim (from --HEAD)" && brew install vim --HEAD
echo "Current python version: $(/usr/bin/python3 -V)"
prompt_optinstall "and set up a possibly more recent python" && {
brew install python
ln -si /usr/local/bin/python3 /usr/local/bin/python # create a symlink for python to shadow /usr/bin/python
ln -si /usr/local/bin/pip3 /usr/local/bin/pip # create a symlink to write pip instead of pip3
}
prompt_optinstall "the Haskell Platform" && ( curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh )
prompt_optinstall "rust (and its toolchain)" && ( curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh )
prompt_optinstall "node" && brew install node
prompt_optinstall "go" && brew install go
# ----- --- -----
echo "Suggested for installation:"
echo "brew install --cask discord"
echo "brew install --cask steam"
echo "brew install tldr"
echo "brew install ffmpeg"
echo "brew install youtube-dl"
echo "brew install --cask mactex-no-gui"
echo "brew install --cask font-cozette"
echo "azuki font: http://azukifont.com/font/azuki.html"
echo "brew install --cask krita (alternatively: gimp)"
echo "brew install balenaetcher"
echo "brew install retroarch # retroarch-metal is the alternative metal graphics API version, however some emulator cores don't support metal."
echo "curl -L https://nixos.org/nix/install | sh # install Nix"
echo "Vielleicht: Things3, Minecraft, Baba Is You, NVIDIA GeForce"
# ----- --- -----
echo "Complete. Restart your session (on iTerm). Optionally set colors and background by running 'wal -i background.png'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment