add installer variable, update docs

This commit is contained in:
Andrejus
2020-02-26 16:11:42 +00:00
parent d3886f13e9
commit f8adc62493
3 changed files with 22 additions and 16 deletions

View File

@@ -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._

View File

@@ -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 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"

View File

@@ -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"