Merge pull request 'Install requirements via install script' (#198) from requirements-install-script into main
continuous-integration/drone/push Build is passing Details

Reviewed-on: #198
This commit is contained in:
decentral1se 2021-07-05 23:49:26 +02:00
commit cc4efe69bf
6 changed files with 264 additions and 59 deletions

View File

@ -3,21 +3,29 @@ kind: pipeline
name: linters
steps:
- name: run shellcheck
image: koalaman/shellcheck-alpine:v0.7.1
image: koalaman/shellcheck-alpine
commands:
- shellcheck abra
- shellcheck bin/*.sh
- shellcheck deploy/install.abra.coopcloud.tech/installer
- name: run flake8
image: alpine/flake8:3.9.0
image: alpine/flake8
commands:
- flake8 --max-line-length 100 bin/app-json.py
- flake8 --max-line-length 100 bin/*.py
- name: run unit tests
image: decentral1se/docker-dind-bats-kcov
commands:
- bats tests
- name: test installation script
image: debian:buster
commands:
- apt update && apt install -yqq sudo lsb-release
- deploy/install.abra.coopcloud.tech/installer --no-prompt
- ~/.local/bin/abra version
- name: publish image
image: plugins/docker
settings:
@ -31,6 +39,7 @@ steps:
- run shellcheck
- run flake8
- run unit tests
- test installation script
when:
event:
exclude:
@ -49,6 +58,7 @@ steps:
- run shellcheck
- run flake8
- run unit tests
- test installation script
- publish image
when:
event:
@ -67,6 +77,7 @@ steps:
- run shellcheck
- run flake8
- run unit tests
- test installation script
- publish image
- trigger downstream builds
when:

View File

@ -19,6 +19,7 @@
- Fix logging for chaos deploys and recipe selection logic ([#185](https://git.autonomic.zone/coop-cloud/abra/issues/185))
- Improve reliability of selectig when to download a new `apps.json` ([#170](https://git.autonomic.zone/coop-cloud/abra/issues/170))
- Remove `pwgen`/`pwqgen` as password generator requirements ([#167](https://git.autonomic.zone/coop-cloud/abra/issues/167))
- `abra` installer script will now try to install system requirements ([#196](https://git.autonomic.zone/coop-cloud/abra/issues/196))
# abra 9.0.0 (2021-06-10)

View File

@ -39,13 +39,18 @@ Install the latest stable release:
curl https://install.abra.coopcloud.tech | bash
```
or the bleeding-edge development version:
The source for this script is [here](./deploy/install.abra.coopcloud.tech/installer).
You can pass options to the script like so (e.g. install the bleeding edge development version):
```sh
curl https://install.abra.coopcloud.tech | bash -s -- --dev
```
The source for this script is [here](./deploy/install.abra.coopcloud.tech/installer).
Other options available are as follows:
- **--no-prompt**: non-interactive installation
- **--no-deps**: do not attempt to install [requirements](#requirements)
## Container

89
abra
View File

@ -1,5 +1,7 @@
#!/usr/bin/env bash
# shellcheck disable=SC2154
GIT_URL="https://git.autonomic.zone/coop-cloud/"
ABRA_APPS_URL="https://apps.coopcloud.tech"
ABRA_DIR="${ABRA_DIR:-$HOME/.abra}"
@ -13,7 +15,7 @@ ABRA_APPS_JSON="${ABRA_DIR}/apps.json"
#######################################
DOC="
The cooperative cloud utility belt 🎩🐇
The Co-op Cloud utility belt 🎩🐇
Usage:
abra [options] app (list|ls) [--status] [--server=<server>] [--type=<type>]
@ -167,15 +169,15 @@ eval "var_$1+=($value)"; else eval "var_$1=$value"; fi; return 0; fi; done
return 1; }; stdout() { printf -- "cat <<'EOM'\n%s\nEOM\n" "$1"; }; stderr() {
printf -- "cat <<'EOM' >&2\n%s\nEOM\n" "$1"; }; error() {
[[ -n $1 ]] && stderr "$1"; stderr "$usage"; _return 1; }; _return() {
printf -- "exit %d\n" "$1"; exit "$1"; }; set -e; trimmed_doc=${DOC:1:2451}
usage=${DOC:40:1842}; digest=c7bae
shorts=(-C -n -U -e -b -d -h -s -v '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '')
longs=(--skip-check --no-prompt --skip-update --env --branch --debug --help --stack --verbose --status --server --type --domain --app-name --pass --secrets --all --update --force --fast --chaos --volumes --no-tty --user --bump --dev)
argcounts=(0 0 0 1 1 0 0 1 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 1 0 0); node_0(){
switch __skip_check 0; }; node_1(){ switch __no_prompt 1; }; node_2(){
switch __skip_update 2; }; node_3(){ value __env 3; }; node_4(){
value __branch 4; }; node_5(){ switch __debug 5; }; node_6(){ switch __help 6; }
node_7(){ value __stack 7; }; node_8(){ switch __verbose 8; }; node_9(){
printf -- "exit %d\n" "$1"; exit "$1"; }; set -e; trimmed_doc=${DOC:1:2445}
usage=${DOC:34:1842}; digest=d420c
shorts=(-d -C -h -U -e -s -v -n -b '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '')
longs=(--debug --skip-check --help --skip-update --env --stack --verbose --no-prompt --branch --status --server --type --domain --app-name --pass --secrets --all --update --force --fast --chaos --volumes --no-tty --user --bump --dev)
argcounts=(0 0 0 0 1 1 0 0 1 0 1 1 1 1 0 0 0 0 0 0 0 0 0 1 0 0); node_0(){
switch __debug 0; }; node_1(){ switch __skip_check 1; }; node_2(){
switch __help 2; }; node_3(){ switch __skip_update 3; }; node_4(){ value __env 4
}; node_5(){ value __stack 5; }; node_6(){ switch __verbose 6; }; node_7(){
switch __no_prompt 7; }; node_8(){ value __branch 8; }; node_9(){
switch __status 9; }; node_10(){ value __server 10; }; node_11(){
value __type 11; }; node_12(){ value __domain 12; }; node_13(){
value __app_name 13; }; node_14(){ switch __pass 14; }; node_15(){
@ -244,9 +246,9 @@ node_154(){ optional 153; }; node_155(){ required 80 78 154; }; node_156(){
required 80; }; node_157(){
either 86 91 94 100 101 102 103 104 106 107 108 112 114 118 119 124 125 128 129 130 133 135 136 137 139 140 143 144 145 146 147 148 150 151 152 155 156
}; node_158(){ required 157; }; cat <<<' docopt_exit() {
[[ -n $1 ]] && printf "%s\n" "$1" >&2; printf "%s\n" "${DOC:40:1842}" >&2
exit 1; }'; unset var___skip_check var___no_prompt var___skip_update var___env \
var___branch var___debug var___help var___stack var___verbose var___status \
[[ -n $1 ]] && printf "%s\n" "$1" >&2; printf "%s\n" "${DOC:34:1842}" >&2
exit 1; }'; unset var___debug var___skip_check var___help var___skip_update \
var___env var___stack var___verbose var___no_prompt var___branch var___status \
var___server var___type var___domain var___app_name var___pass var___secrets \
var___all var___update var___force var___fast var___chaos var___volumes \
var___no_tty var___user var___bump var___dev var__type_ var__app_ \
@ -258,36 +260,37 @@ var_cp var_logs var_ps var_restore var_rm var_delete var_run var_rollback \
var_secret var_generate var_insert var_undeploy var_volume var_recipe \
var_create var_release var_versions var_server var_add var___ var_init \
var_apps var_upgrade var_doctor var_help; parse 158 "$@"
local prefix=${DOCOPT_PREFIX:-''}; unset "${prefix}__skip_check" \
"${prefix}__no_prompt" "${prefix}__skip_update" "${prefix}__env" \
"${prefix}__branch" "${prefix}__debug" "${prefix}__help" "${prefix}__stack" \
"${prefix}__verbose" "${prefix}__status" "${prefix}__server" "${prefix}__type" \
"${prefix}__domain" "${prefix}__app_name" "${prefix}__pass" \
"${prefix}__secrets" "${prefix}__all" "${prefix}__update" "${prefix}__force" \
"${prefix}__fast" "${prefix}__chaos" "${prefix}__volumes" "${prefix}__no_tty" \
"${prefix}__user" "${prefix}__bump" "${prefix}__dev" "${prefix}_type_" \
"${prefix}_app_" "${prefix}_service_" "${prefix}_version_" "${prefix}_src_" \
"${prefix}_dst_" "${prefix}_backup_file_" "${prefix}_args_" \
"${prefix}_secret_" "${prefix}_cmd_" "${prefix}_data_" "${prefix}_volume_" \
"${prefix}_command_" "${prefix}_recipe_" "${prefix}_host_" "${prefix}_user_" \
"${prefix}_port_" "${prefix}_provider_" "${prefix}_subcommands_" \
"${prefix}app" "${prefix}list" "${prefix}ls" "${prefix}new" "${prefix}backup" \
"${prefix}deploy" "${prefix}check" "${prefix}version" "${prefix}config" \
"${prefix}cp" "${prefix}logs" "${prefix}ps" "${prefix}restore" "${prefix}rm" \
local prefix=${DOCOPT_PREFIX:-''}; unset "${prefix}__debug" \
"${prefix}__skip_check" "${prefix}__help" "${prefix}__skip_update" \
"${prefix}__env" "${prefix}__stack" "${prefix}__verbose" \
"${prefix}__no_prompt" "${prefix}__branch" "${prefix}__status" \
"${prefix}__server" "${prefix}__type" "${prefix}__domain" \
"${prefix}__app_name" "${prefix}__pass" "${prefix}__secrets" "${prefix}__all" \
"${prefix}__update" "${prefix}__force" "${prefix}__fast" "${prefix}__chaos" \
"${prefix}__volumes" "${prefix}__no_tty" "${prefix}__user" "${prefix}__bump" \
"${prefix}__dev" "${prefix}_type_" "${prefix}_app_" "${prefix}_service_" \
"${prefix}_version_" "${prefix}_src_" "${prefix}_dst_" \
"${prefix}_backup_file_" "${prefix}_args_" "${prefix}_secret_" \
"${prefix}_cmd_" "${prefix}_data_" "${prefix}_volume_" "${prefix}_command_" \
"${prefix}_recipe_" "${prefix}_host_" "${prefix}_user_" "${prefix}_port_" \
"${prefix}_provider_" "${prefix}_subcommands_" "${prefix}app" "${prefix}list" \
"${prefix}ls" "${prefix}new" "${prefix}backup" "${prefix}deploy" \
"${prefix}check" "${prefix}version" "${prefix}config" "${prefix}cp" \
"${prefix}logs" "${prefix}ps" "${prefix}restore" "${prefix}rm" \
"${prefix}delete" "${prefix}run" "${prefix}rollback" "${prefix}secret" \
"${prefix}generate" "${prefix}insert" "${prefix}undeploy" "${prefix}volume" \
"${prefix}recipe" "${prefix}create" "${prefix}release" "${prefix}versions" \
"${prefix}server" "${prefix}add" "${prefix}__" "${prefix}init" "${prefix}apps" \
"${prefix}upgrade" "${prefix}doctor" "${prefix}help"
eval "${prefix}"'__debug=${var___debug:-false}'
eval "${prefix}"'__skip_check=${var___skip_check:-false}'
eval "${prefix}"'__no_prompt=${var___no_prompt:-false}'
eval "${prefix}"'__help=${var___help:-false}'
eval "${prefix}"'__skip_update=${var___skip_update:-false}'
eval "${prefix}"'__env=${var___env:-}'
eval "${prefix}"'__branch=${var___branch:-}'
eval "${prefix}"'__debug=${var___debug:-false}'
eval "${prefix}"'__help=${var___help:-false}'
eval "${prefix}"'__stack=${var___stack:-}'
eval "${prefix}"'__verbose=${var___verbose:-false}'
eval "${prefix}"'__no_prompt=${var___no_prompt:-false}'
eval "${prefix}"'__branch=${var___branch:-}'
eval "${prefix}"'__status=${var___status:-false}'
eval "${prefix}"'__server=${var___server:-}'
eval "${prefix}"'__type=${var___type:-}'
@ -355,9 +358,9 @@ eval "${prefix}"'upgrade=${var_upgrade:-false}'
eval "${prefix}"'doctor=${var_doctor:-false}'
eval "${prefix}"'help=${var_help:-false}'; local docopt_i=1
[[ $BASH_VERSION =~ ^4.3 ]] && docopt_i=2; for ((;docopt_i>0;docopt_i--)); do
declare -p "${prefix}__skip_check" "${prefix}__no_prompt" \
"${prefix}__skip_update" "${prefix}__env" "${prefix}__branch" \
"${prefix}__debug" "${prefix}__help" "${prefix}__stack" "${prefix}__verbose" \
declare -p "${prefix}__debug" "${prefix}__skip_check" "${prefix}__help" \
"${prefix}__skip_update" "${prefix}__env" "${prefix}__stack" \
"${prefix}__verbose" "${prefix}__no_prompt" "${prefix}__branch" \
"${prefix}__status" "${prefix}__server" "${prefix}__type" "${prefix}__domain" \
"${prefix}__app_name" "${prefix}__pass" "${prefix}__secrets" "${prefix}__all" \
"${prefix}__update" "${prefix}__force" "${prefix}__fast" "${prefix}__chaos" \
@ -2562,18 +2565,6 @@ sub_network() {
abra() {
require_bash_4
# TODO (3wc): we either need to do this, or add 'shellcheck disable' all over
# the place to handle the dynamically-defined vars
declare abra___stack abra___env abra__command_ abra__args_ \
abra__secret_ abra__version_ abra__data_ abra___user abra__host_ \
abra__type_ abra__port_ abra__user_ abra__service_ abra__src_ abra__dst_ \
abra___server abra___domain abra___pass abra___secrets abra___status \
abra___no_tty abra___app_name abra__subcommands_ abra___skip_update \
abra___skip_check abra__backup_file_ abra___verbose abra___debug \
abra___help abra___branch abra___volumes abra__provider_ abra___type \
abra___dev abra___update abra___no_prompt abra___force \
abra__recipe_ abra___fast abra__volume_ abra___bump abra___chaos
if ! type tput > /dev/null 2>&1; then
tput() {
echo -n
@ -2637,7 +2628,7 @@ abra() {
# Use abra__command_ in case `command` is provided (i.e. `volume` or `stack`)
CMD="sub_${abra__command_}"
if type "$CMD" > /dev/null 2>&1; then
# shellcheck disable=SC2086
# shellcheck disable=SC2086,SC2048
"$CMD" ${abra__args_[*]}
else
docopt_exit

View File

@ -1,10 +1,180 @@
#!/bin/bash
#!/usr/bin/env bash
# shellcheck disable=SC2154,SC2034
ABRA_VERSION="9.0.0"
GIT_URL="https://git.autonomic.zone/coop-cloud/abra"
ABRA_SRC="$GIT_URL/raw/tag/$ABRA_VERSION/abra"
ABRA_DIR="${ABRA_DIR:-$HOME/.abra}"
DOC="
abra command-line installer script
Usage:
installer [options]
Options:
-h, --help Show this message and exit
-d, --dev Install bleeding edge development version
-n, --no-prompt Don't prompt for input and run non-interactively
-p, --no-deps Don't attempt to install system dependencies
"
# docopt parser below, refresh this parser with `docopt.sh installer`
# shellcheck disable=2016,1075
docopt() { parse() { if ${DOCOPT_DOC_CHECK:-true}; then local doc_hash
if doc_hash=$(printf "%s" "$DOC" | (sha256sum 2>/dev/null || shasum -a 256)); then
if [[ ${doc_hash:0:5} != "$digest" ]]; then
stderr "The current usage doc (${doc_hash:0:5}) does not match \
what the parser was generated with (${digest})
Run \`docopt.sh\` to refresh the parser."; _return 70; fi; fi; fi
local root_idx=$1; shift; argv=("$@"); parsed_params=(); parsed_values=()
left=(); testdepth=0; local arg; while [[ ${#argv[@]} -gt 0 ]]; do
if [[ ${argv[0]} = "--" ]]; then for arg in "${argv[@]}"; do
parsed_params+=('a'); parsed_values+=("$arg"); done; break
elif [[ ${argv[0]} = --* ]]; then parse_long
elif [[ ${argv[0]} = -* && ${argv[0]} != "-" ]]; then parse_shorts
elif ${DOCOPT_OPTIONS_FIRST:-false}; then for arg in "${argv[@]}"; do
parsed_params+=('a'); parsed_values+=("$arg"); done; break; else
parsed_params+=('a'); parsed_values+=("${argv[0]}"); argv=("${argv[@]:1}"); fi
done; local idx; if ${DOCOPT_ADD_HELP:-true}; then
for idx in "${parsed_params[@]}"; do [[ $idx = 'a' ]] && continue
if [[ ${shorts[$idx]} = "-h" || ${longs[$idx]} = "--help" ]]; then
stdout "$trimmed_doc"; _return 0; fi; done; fi
if [[ ${DOCOPT_PROGRAM_VERSION:-false} != 'false' ]]; then
for idx in "${parsed_params[@]}"; do [[ $idx = 'a' ]] && continue
if [[ ${longs[$idx]} = "--version" ]]; then stdout "$DOCOPT_PROGRAM_VERSION"
_return 0; fi; done; fi; local i=0; while [[ $i -lt ${#parsed_params[@]} ]]; do
left+=("$i"); ((i++)) || true; done
if ! required "$root_idx" || [ ${#left[@]} -gt 0 ]; then error; fi; return 0; }
parse_shorts() { local token=${argv[0]}; local value; argv=("${argv[@]:1}")
[[ $token = -* && $token != --* ]] || _return 88; local remaining=${token#-}
while [[ -n $remaining ]]; do local short="-${remaining:0:1}"
remaining="${remaining:1}"; local i=0; local similar=(); local match=false
for o in "${shorts[@]}"; do if [[ $o = "$short" ]]; then similar+=("$short")
[[ $match = false ]] && match=$i; fi; ((i++)) || true; done
if [[ ${#similar[@]} -gt 1 ]]; then
error "${short} is specified ambiguously ${#similar[@]} times"
elif [[ ${#similar[@]} -lt 1 ]]; then match=${#shorts[@]}; value=true
shorts+=("$short"); longs+=(''); argcounts+=(0); else value=false
if [[ ${argcounts[$match]} -ne 0 ]]; then if [[ $remaining = '' ]]; then
if [[ ${#argv[@]} -eq 0 || ${argv[0]} = '--' ]]; then
error "${short} requires argument"; fi; value=${argv[0]}; argv=("${argv[@]:1}")
else value=$remaining; remaining=''; fi; fi; if [[ $value = false ]]; then
value=true; fi; fi; parsed_params+=("$match"); parsed_values+=("$value"); done
}; parse_long() { local token=${argv[0]}; local long=${token%%=*}
local value=${token#*=}; local argcount; argv=("${argv[@]:1}")
[[ $token = --* ]] || _return 88; if [[ $token = *=* ]]; then eq='='; else eq=''
value=false; fi; local i=0; local similar=(); local match=false
for o in "${longs[@]}"; do if [[ $o = "$long" ]]; then similar+=("$long")
[[ $match = false ]] && match=$i; fi; ((i++)) || true; done
if [[ $match = false ]]; then i=0; for o in "${longs[@]}"; do
if [[ $o = $long* ]]; then similar+=("$long"); [[ $match = false ]] && match=$i
fi; ((i++)) || true; done; fi; if [[ ${#similar[@]} -gt 1 ]]; then
error "${long} is not a unique prefix: ${similar[*]}?"
elif [[ ${#similar[@]} -lt 1 ]]; then
[[ $eq = '=' ]] && argcount=1 || argcount=0; match=${#shorts[@]}
[[ $argcount -eq 0 ]] && value=true; shorts+=(''); longs+=("$long")
argcounts+=("$argcount"); else if [[ ${argcounts[$match]} -eq 0 ]]; then
if [[ $value != false ]]; then
error "${longs[$match]} must not have an argument"; fi
elif [[ $value = false ]]; then
if [[ ${#argv[@]} -eq 0 || ${argv[0]} = '--' ]]; then
error "${long} requires argument"; fi; value=${argv[0]}; argv=("${argv[@]:1}")
fi; if [[ $value = false ]]; then value=true; fi; fi; parsed_params+=("$match")
parsed_values+=("$value"); }; required() { local initial_left=("${left[@]}")
local node_idx; ((testdepth++)) || true; for node_idx in "$@"; do
if ! "node_$node_idx"; then left=("${initial_left[@]}"); ((testdepth--)) || true
return 1; fi; done; if [[ $((--testdepth)) -eq 0 ]]; then
left=("${initial_left[@]}"); for node_idx in "$@"; do "node_$node_idx"; done; fi
return 0; }; optional() { local node_idx; for node_idx in "$@"; do
"node_$node_idx"; done; return 0; }; switch() { local i
for i in "${!left[@]}"; do local l=${left[$i]}
if [[ ${parsed_params[$l]} = "$2" ]]; then
left=("${left[@]:0:$i}" "${left[@]:((i+1))}")
[[ $testdepth -gt 0 ]] && return 0; if [[ $3 = true ]]; then
eval "((var_$1++))" || true; else eval "var_$1=true"; fi; return 0; fi; done
return 1; }; stdout() { printf -- "cat <<'EOM'\n%s\nEOM\n" "$1"; }; stderr() {
printf -- "cat <<'EOM' >&2\n%s\nEOM\n" "$1"; }; error() {
[[ -n $1 ]] && stderr "$1"; stderr "$usage"; _return 1; }; _return() {
printf -- "exit %d\n" "$1"; exit "$1"; }; set -e; trimmed_doc=${DOC:1:333}
usage=${DOC:37:28}; digest=36916; shorts=(-h -d -n -p)
longs=(--help --dev --no-prompt --no-deps); argcounts=(0 0 0 0); node_0(){
switch __help 0; }; node_1(){ switch __dev 1; }; node_2(){ switch __no_prompt 2
}; node_3(){ switch __no_deps 3; }; node_4(){ optional 0 1 2 3; }; node_5(){
optional 4; }; node_6(){ required 5; }; node_7(){ required 6; }
cat <<<' docopt_exit() { [[ -n $1 ]] && printf "%s\n" "$1" >&2
printf "%s\n" "${DOC:37:28}" >&2; exit 1; }'; unset var___help var___dev \
var___no_prompt var___no_deps; parse 7 "$@"; local prefix=${DOCOPT_PREFIX:-''}
unset "${prefix}__help" "${prefix}__dev" "${prefix}__no_prompt" \
"${prefix}__no_deps"; eval "${prefix}"'__help=${var___help:-false}'
eval "${prefix}"'__dev=${var___dev:-false}'
eval "${prefix}"'__no_prompt=${var___no_prompt:-false}'
eval "${prefix}"'__no_deps=${var___no_deps:-false}'; local docopt_i=1
[[ $BASH_VERSION =~ ^4.3 ]] && docopt_i=2; for ((;docopt_i>0;docopt_i--)); do
declare -p "${prefix}__help" "${prefix}__dev" "${prefix}__no_prompt" \
"${prefix}__no_deps"; done; }
# docopt parser above, complete command for generating this parser is `docopt.sh installer`
function prompt_confirm {
if [ "$no_prompt" == "true" ]; then
return
fi
read -rp "Continue? [y/N]? " choice
case "$choice" in
y|Y ) return ;;
* ) exit;;
esac
}
function show_banner {
echo ""
echo " ____ ____ _ _ "
echo " / ___|___ ___ _ __ / ___| | ___ _ _ __| |"
echo " | | / _ \ _____ / _ \| '_ \ | | | |/ _ \| | | |/ _' |"
echo " | |__| (_) |_____| (_) | |_) | | |___| | (_) | |_| | (_| |"
echo " \____\___/ \___/| .__/ \____|_|\___/ \__,_|\__,_|"
echo " |_|"
echo ""
}
function install_docker {
sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get install -yq \
apt-transport-https \
ca-certificates \
curl \
gnupg \
lsb-release
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install -yq docker-ce docker-ce-cli containerd.io
}
function install_requirements {
if [ -f "/etc/debian_version" ]; then
echo "Detected Debian based distribution, attempting to install system requirements..."
sudo apt update && sudo apt install -y \
curl \
passwdqc \
pwgen
echo "Install Docker (https://docs.docker.com/engine/install/debian/)?"
prompt_confirm
install_docker
else
echo "Sorry, we only support Debian based distributions at the moment"
echo "You'll have to install the requirements manually for your distribution"
echo "See https://git.autonomic.zone/coop-cloud/abra#requirements for more"
fi
}
function install_abra_release {
mkdir -p "$HOME/.local/bin"
curl "$ABRA_SRC" > "$HOME/.local/bin/abra"
@ -24,7 +194,25 @@ function install_abra_dev {
}
function run_installation {
if [ "$1" = "--dev" ]; then
show_banner
DOCOPT_PREFIX=installer_
DOCOPT_ADD_HELP=false
eval "$(docopt "$@")"
dev="$installer___dev"
no_prompt="$installer___no_prompt"
no_deps="$installer___no_deps"
if [ "$no_deps" == "false" ]; then
install_requirements
fi
if ! type curl > /dev/null 2>&1; then
error "'curl' program is not installed, cannot continue..."
fi
if [ "$dev" == "true" ]; then
install_abra_dev
else
install_abra_release

View File

@ -1,4 +1,4 @@
.PHONY: test shellcheck docopt release-installer build push
.PHONY: test shellcheck docopt release-installer build push deploy-docopt symlink
test:
@sudo DOCKER_CONTEXT=default docker run \
@ -21,8 +21,9 @@ shellcheck:
--rm \
-v $$(pwd):/workdir \
koalaman/shellcheck-alpine \
shellcheck /workdir/abra && \
shellcheck /workdir/bin/*.sh
sh -c "shellcheck /workdir/abra && \
shellcheck /workdir/bin/*.sh && \
shellcheck /workdir/deploy/install.abra.coopcloud.tech/installer"
docopt:
@if [ ! -d ".venv" ]; then \
@ -32,6 +33,14 @@ docopt:
fi
.venv/bin/docopt.sh abra
deploy-docopt:
@if [ ! -d ".venv" ]; then \
python3 -m venv .venv && \
.venv/bin/pip install -U pip setuptools wheel && \
.venv/bin/pip install docopt-sh; \
fi
.venv/bin/docopt.sh deploy/install.abra.coopcloud.tech/installer
release-installer:
@DOCKER_CONTEXT=swarm.autonomic.zone \
docker stack rm abra-installer-script && \