diff --git a/README.md b/README.md index 5260720..9dd745f 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Tested on and compatible with: ## Install - wget -qO - https://raw.githubusercontent.com/andrejusk/dotfiles/master/bootstrap.sh | bash + wget https://raw.githubusercontent.com/andrejusk/dotfiles/master/bootstrap.sh -qO - | bash _Running the above without reading through repository is strongly discouraged._ diff --git a/bootstrap.sh b/bootstrap.sh index 56b630b..d4d850e 100644 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env bash -o pipefail # # Script to set up dotfiles repository and run installer. # @@ -11,38 +11,45 @@ # i. Run in new bash shell. # # $ bash bootstrap.sh -# $ bash path/to/bootstrap.sh -# $ wget -O - path.to/bootstrap.sh | bash +# $ bash /path/to/bootstrap.sh +# $ wget path.to/bootstrap.sh -qO - | bash # # ii. Source into existing bash shell. # # $ source bootstrap.sh -# $ source path/to/bootstrap.sh -# $ source <(wget path.to/bootstrap.sh) +# $ source /path/to/bootstrap.sh +# $ source <(wget -q path.to/bootstrap.sh) # # # Configuration: # -# $REPOSITORY - GitHub repository to clone and run $dir/install.sh of +# $REPOSITORY - GitHub repository to clone # @default "andrejusk/dotfiles" # -# $WORKSPACE - parent directory to clone repository in to +# $WORKSPACE - parent directory to clone repository into # @default "$HOME/workspace" # +# $INSTALLER - installer file name +# @default "install.sh" +# # -set -o pipefail echo "setting up..." -# Variables: git +# Variables: $REPOSITORY if [ -z "$REPOSITORY" ]; then export REPOSITORY="andrejusk/dotfiles"; fi readonly repository_url="https://github.com/$REPOSITORY.git" echo "using repository: $repository_url" -# Variables: workspace +# Variables: $WORKSPACE if [ -z "$WORKSPACE" ]; then export WORKSPACE="$HOME/workspace"; fi readonly dotfiles_dir="$WORKSPACE/dotfiles" echo "using dir: $dotfiles_dir" +# Variables: $INSTALLER +if [ -z "$INSTALLER" ]; then export INSTALLER="install.sh"; fi +readonly installer="$dotfiles_dir/$INSTALLER" +echo "using installer: $installer" + # Ensure git is installed if ! [ -x "$(command -v git)" ]; then echo "installing git..." @@ -60,5 +67,6 @@ else fi # Install dotfiles -cd $dotfiles_dir -source "$dotfiles_dir/install.sh" +cd "$dotfiles_dir" +chmod +x "$installer" +"$installer" diff --git a/install.sh b/install.sh index ccc24a2..5e1bda6 100755 --- a/install.sh +++ b/install.sh @@ -1,9 +1,7 @@ -#!/usr/bin/env bash +#!/usr/bin/env bash -euo pipefail # # Invokes all install scripts. # -set -euo pipefail - source "$dotfiles_dir/utils.sh" printf "Installing ${C_CYAN}$REPOSITORY${C_NC}" printf " as ${C_YELLOW}$USER${C_NC}\n\n"