Add autoinstall command
This commit is contained in:
parent
d6985ded7e
commit
b5eaaead9b
14 changed files with 344 additions and 4 deletions
42
autoinstall/lib/colors.sh
Normal file
42
autoinstall/lib/colors.sh
Normal file
|
@ -0,0 +1,42 @@
|
|||
## Color functions [@bashly-upgrade colors]
|
||||
## This file is a part of Bashly standard library
|
||||
##
|
||||
## Usage:
|
||||
## Use any of the functions below to color or format a portion of a string.
|
||||
##
|
||||
## echo "before $(red this is red) after"
|
||||
## echo "before $(green_bold this is green_bold) after"
|
||||
##
|
||||
## Color output will be disabled if `NO_COLOR` environment variable is set
|
||||
## in compliance with https://no-color.org/
|
||||
##
|
||||
print_in_color() {
|
||||
local color="$1"
|
||||
shift
|
||||
if [[ -z ${NO_COLOR+x} ]]; then
|
||||
printf "$color%b\e[0m\n" "$*"
|
||||
else
|
||||
printf "%b\n" "$*"
|
||||
fi
|
||||
}
|
||||
|
||||
red() { print_in_color "\e[31m" "$*"; }
|
||||
green() { print_in_color "\e[32m" "$*"; }
|
||||
yellow() { print_in_color "\e[33m" "$*"; }
|
||||
blue() { print_in_color "\e[34m" "$*"; }
|
||||
magenta() { print_in_color "\e[35m" "$*"; }
|
||||
cyan() { print_in_color "\e[36m" "$*"; }
|
||||
bold() { print_in_color "\e[1m" "$*"; }
|
||||
underlined() { print_in_color "\e[4m" "$*"; }
|
||||
red_bold() { print_in_color "\e[1;31m" "$*"; }
|
||||
green_bold() { print_in_color "\e[1;32m" "$*"; }
|
||||
yellow_bold() { print_in_color "\e[1;33m" "$*"; }
|
||||
blue_bold() { print_in_color "\e[1;34m" "$*"; }
|
||||
magenta_bold() { print_in_color "\e[1;35m" "$*"; }
|
||||
cyan_bold() { print_in_color "\e[1;36m" "$*"; }
|
||||
red_underlined() { print_in_color "\e[4;31m" "$*"; }
|
||||
green_underlined() { print_in_color "\e[4;32m" "$*"; }
|
||||
yellow_underlined() { print_in_color "\e[4;33m" "$*"; }
|
||||
blue_underlined() { print_in_color "\e[4;34m" "$*"; }
|
||||
magenta_underlined() { print_in_color "\e[4;35m" "$*"; }
|
||||
cyan_underlined() { print_in_color "\e[4;36m" "$*"; }
|
20
autoinstall/lib/common.sh
Normal file
20
autoinstall/lib/common.sh
Normal file
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
_http_client() {
|
||||
if [ -x "$(command -v curl)" ]
|
||||
then
|
||||
curl -fsSL "$1"
|
||||
elif [ -x "$(command -v wget)" ]
|
||||
then
|
||||
wget -qO - "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
_run_hook() {
|
||||
hook=${args[--hook]:-}
|
||||
if [ -n "$hook" ]
|
||||
then
|
||||
yellow "Running hook: $hook"
|
||||
bash -c "$hook"
|
||||
fi
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue