#!/bin/sh # # instl.sh installer for github.com/installer/demo # # curl -fsSL https://instl.sh/installer/demo/linux | sh # # Installs the latest release for the current user, without admin rights. # This script was generated for this repository; read it before you run it. # Docs: https://instl.sh/docs # Source: https://github.com/installer/installer [ -n "${ZSH_VERSION:-}" ] && emulate sh set -eu INSTL_ORIGIN='https://instl.sh' INSTL_OWNER='installer' INSTL_REPO='demo' INSTL_SLUG='installer/demo' INSTL_VERSION="${INSTL_VERSION:-}" INSTL_VERBOSE="${INSTL_VERBOSE:-0}" # Terminal output. Everything goes to stderr so stdout stays free for callers. # Colors use the 16 standard ANSI colors, so the terminal theme decides the # actual shades: green is the accent, yellow and red mark warnings and errors. NO_COLOR and FORCE_COLOR follow no-color.org and # force-color.org; glyphs fall back to ASCII outside UTF-8 locales. ui_init() { ui_color=0 if [ -n "${NO_COLOR:-}" ]; then ui_color=0 elif [ -n "${FORCE_COLOR:-}" ] && [ "${FORCE_COLOR}" != "0" ]; then ui_color=1 elif [ -t 2 ] && [ "${TERM:-dumb}" != "dumb" ]; then ui_color=1 fi if [ "$ui_color" = 1 ]; then esc=$(printf '\033') c_reset="${esc}[0m" c_bold="${esc}[1m" c_dim="${esc}[2m" c_red="${esc}[31m" c_green="${esc}[32m" c_yellow="${esc}[33m" c_clear_line="$(printf '\r')${esc}[2K" else c_reset="" c_bold="" c_dim="" c_red="" c_green="" c_yellow="" c_clear_line="" fi # shellcheck disable=SC2034 # Not every script uses every glyph. case "${LC_ALL:-${LC_CTYPE:-${LANG:-}}}" in *UTF-8* | *utf-8* | *UTF8* | *utf8*) g_head="◆" g_step="◇" g_wait="◒" g_bar="│" g_end="└" g_warn="▲" g_error="■" g_dot="·" g_arrow="→" ;; *) g_head="*" g_step="o" g_wait="~" g_bar="|" g_end="'-" g_warn="!" g_error="x" g_dot="-" g_arrow="->" ;; esac ui_waiting=0 } ui_print() { ui_settle printf '%s\n' "$1" >&2 } # Removes a pending "working on it" line before the next line replaces it. ui_settle() { if [ "$ui_waiting" = 1 ]; then printf '%s' "$c_clear_line" >&2 ui_waiting=0 fi } ui_header() { ui_print "${c_green}${g_head}${c_reset} ${c_bold}instl.sh${c_reset} ${c_dim}${g_dot}${c_reset} $1" ui_bar } ui_bar() { ui_print "${c_dim}${g_bar}${c_reset}" } # A finished step: ui_step