#!/usr/bin/env bash # ShellTeam one-line installer, served at https://shellteam.sh/install # # curl -fsSL https://shellteam.sh/install | bash # curl -fsSL https://shellteam.sh/install | bash -s -- --full --remote # # It clones (or updates) https://github.com/sebderhy/shellteam into ~/shellteam # (SHELLTEAM_DIR to change it), then runs that checkout's ./install.sh with your # flags. That is all it does; the real work, and every flag, is install.sh. # # Privacy: shellteam.sh's web server logs the download of this file, like any # web page. That is how we count installs. Nothing else is sent, now or later. set -euo pipefail REPO_URL="https://github.com/sebderhy/shellteam" DIR="${SHELLTEAM_DIR:-$HOME/shellteam}" say() { printf '\033[1;33m==>\033[0m %s\n' "$*"; } die() { printf '\033[1;31mError:\033[0m %s\n' "$*" >&2; exit 1; } main() { if ! command -v git >/dev/null 2>&1; then command -v apt-get >/dev/null 2>&1 || die "git is missing and this is not a Debian/Ubuntu box. Install git, then re-run." say "Installing git" sudo apt-get update -qq && sudo apt-get install -y -qq git fi if [ -d "$DIR/.git" ]; then local origin origin="$(git -C "$DIR" remote get-url origin 2>/dev/null || true)" case "${origin%.git}" in "$REPO_URL"|git@github.com:sebderhy/shellteam) ;; *) die "$DIR is a git checkout of '$origin', not ShellTeam. Set SHELLTEAM_DIR to another folder." ;; esac say "Updating $DIR" git -C "$DIR" pull --ff-only elif [ -e "$DIR" ]; then die "$DIR already exists and is not a ShellTeam checkout. Set SHELLTEAM_DIR to another folder." else say "Downloading ShellTeam into $DIR" git clone "$REPO_URL" "$DIR" fi cd "$DIR" # Piped into bash, our stdin is this script, so install.sh would skip its # first-run questions. Hand it the terminal when there is one. if (: /dev/null; then exec ./install.sh "$@"