dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

install.sh (1525B)


      1 #!/usr/bin/env bash
      2 # vim: foldmethod=marker:foldlevel=0
      3 
      4 # Preliminary checks {{{
      5 # Check if this directory was cloned properly
      6 if [ "$(pwd)" != "$HOME/.dotfiles" ]; then
      7   echo "Please clone this directory as $HOME/.dotfiles."
      8   exit 1
      9 fi
     10 
     11 cd "$(dirname "$0")" || { echo "Could not cd into $(dirname "$0")"; exit 1; }
     12 
     13 if ! [ -f "./install.sh" ]; then
     14   echo "Please cd into $HOME/.dotfiles before running the script."
     15   exit 1
     16 fi
     17 
     18 # Check if the OS is supported
     19 if [[ $(uname -s) == "Darwin" ]]; then
     20   echo "Setting up your Mac..."
     21   if ! command -v brew &> /dev/null; then
     22     /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
     23   fi
     24   if [ -f "Brewfile" ]; then
     25     brew bundle
     26   fi
     27 elif [[ $(uname -s) == "Linux" ]]; then
     28   echo "Setting up your Linux environment..."
     29 else
     30   echo "This OS isn't supported yet."
     31   exit 1
     32 fi
     33 
     34 #}}}
     35 
     36 export DOTFILES="$HOME/.dotfiles"
     37 
     38 read -rn 1 -p "Install all dotfiles? [Y/n]" yn
     39 echo
     40 case $yn in
     41   [Yy]* )
     42     yes | scripts/conf link
     43     echo "Dotfiles installed."
     44     echo "Run \`conf -h\` for more help."
     45     ;;
     46   * )
     47     echo "No dotfiles installed automatically."
     48     echo "Run \`scripts/conf -h\` for more help."
     49     echo "You can also add conf to your path: export PATH=$DOTFILES/scripts:$PATH"
     50     ;;
     51 esac
     52 
     53 echo "Don't forget to create a $DOTFILES/shell/secret_env with:"
     54 # Don't want these variables to expand
     55 # shellcheck disable=SC2016
     56 echo '- $DISCOGS_API_TOKEN'
     57 # shellcheck disable=SC2016
     58 echo '- $HOMEBREW_GITHUB_API_TOKEN'