diff --git a/Installers/golang.sh b/Installers/golang.sh index e400af5..6c507df 100644 --- a/Installers/golang.sh +++ b/Installers/golang.sh @@ -1,1837 +1,77 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Utils/golang.sh at main · letsnode/Utils · GitHub - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Skip to content - - - - - - - - - - - - -
- -
- - - - - - - -
- - - - -
- - - - - - - - - - - -
-
-
- - - - - - - - - - - - - - - - - - -
- - - - - - -
- - -
- - - - - - - - -Permalink - -
- -
-
- - - main - - - - -
-
-
- Switch branches/tags - -
- - - -
- -
- -
- - -
- -
- - - - - - - - - - - - - - - -
- - -
-
-
-
- -
- -
- - - Go to file - -
- - - - -
-
-
- - - - - - - - - -
- -
-
-
 
-
- -
-
 
- Cannot retrieve contributors at this time -
-
- - - - - - - - - -
- -
- - -
- - 77 lines (68 sloc) - - 2.24 KB -
- -
- - - - -
- -
-
-
-
- -
-
-
-
-
- - - Open in GitHub Desktop -
-
-
-
-
- - - -
- - - - - - - - - -
- - - -
-
- -
- -
-
- - - -
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#!/bin/bash
-
action="install"
go_version="1.18.1"
-
. <(wget -qO- https://raw.githubusercontent.com/letsnode/Utils/main/bashbuilder/colors.sh) --
-
function option_value() {
echo "$1" | sed -e 's%^--[^=]*=%%g; s%^-[^=]*=%%g';
}
-
function install() {
echo -e "${C_LGn}GO installation...${RES}"
if ! go version | grep -q $go_version; then
sed -i "s%:`which go | sed 's%/bin/go%%g'`%%g" $HOME/.bash_profile
rm -rf `which go | sed 's%/bin/go%%g'`
sudo apt update
sudo apt upgrade -y
sudo apt install tar wget git make -y
cd "$HOME"
wget -t 5 "https://go.dev/dl/go${go_version}.linux-amd64.tar.gz"
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf "go${go_version}.linux-amd64.tar.gz"
rm "go${go_version}.linux-amd64.tar.gz"
. <(wget -qO- https://raw.githubusercontent.com/letsnode/Utils/main/bashbuilder/addvar.sh) -n "PATH" -v "$PATH:/usr/local/go/bin:$HOME/go/bin"
fi
}
-
function uninstall() {
echo -e "${C_LGn}GO uninstalling...${RES}"
sed -i "s%:`which go | sed 's%/bin/go%%g'`%%g" "$HOME"/.bash_profile
rm -rf `which go | sed 's%/bin/go%%g'`
}
-
while test $# -gt 0; do
case "$1" in
-h|--help)
. <(wget -qO- https://raw.githubusercontent.com/letsnode/Utils/main/bashbuilder/logo.sh)
echo
echo -e "${C_LGn}Functionality${RES}: the script installs or uninstalls GO"
echo
echo -e "${C_LGn}Usage${RES}: script ${C_LGn}[OPTIONS]${RES}"
echo
echo -e "${C_LGn}Options${RES}:"
echo -e " -h, --help show the help page"
echo -e " -v, --version VERSION GO VERSION to install (default is ${C_LGn}${go_version}${RES})"
echo -e " -u, --uninstall uninstall GO"
echo
echo -e "You can use either \"=\" or \" \" as an option and value ${C_LGn}delimiter${RES}"
echo
echo -e "${C_LGn}Useful URLs${RES}:"
echo -e "https://raw.githubusercontent.com/letsnode/Utils/main/installers/golang.sh - script URL"
echo -e "https://t.me/letskynode — node Community"
echo -e "https://teletype.in/@letskynode — guides and articles"
echo
return 0 2>/dev/null; exit 0
;;
-v*|--version*)
if ! grep -q "=" <<< "$1"; then shift; fi
go_version=`option_value "$1"`
shift
;;
-u|--uninstall)
action="uninstall"
shift
;;
*|--)
break
;;
esac
done
-
$action
-
. "$HOME"/.bash_profile
-
echo -e "${C_LGn}Done!${RES}"
-
- - - -
- -
- - - - -
- - -
- - -
-
- - -
- -
- - -
- -
- - -
-
- -
- - - - - - - - - - - - - - - - - - - - - +#!/bin/bash + +action="install" +go_version="1.18.1" + +. <(wget -qO- https://raw.githubusercontent.com/letsnode/Utils/main/bashbuilder/colors.sh) -- + +function option_value() { + echo "$1" | sed -e 's%^--[^=]*=%%g; s%^-[^=]*=%%g'; +} + +function install() { + echo -e "${C_LGn}GO installation...${RES}" + if ! go version | grep -q $go_version; then + sed -i "s%:`which go | sed 's%/bin/go%%g'`%%g" $HOME/.bash_profile + rm -rf `which go | sed 's%/bin/go%%g'` + sudo apt update + sudo apt upgrade -y + sudo apt install tar wget git make -y + cd "$HOME" + wget -t 5 "https://go.dev/dl/go${go_version}.linux-amd64.tar.gz" + sudo rm -rf /usr/local/go + sudo tar -C /usr/local -xzf "go${go_version}.linux-amd64.tar.gz" + rm "go${go_version}.linux-amd64.tar.gz" + . <(wget -qO- https://raw.githubusercontent.com/letsnode/Utils/main/bashbuilder/addvar.sh) -n "PATH" -v "$PATH:/usr/local/go/bin:$HOME/go/bin" + fi +} + +function uninstall() { + echo -e "${C_LGn}GO uninstalling...${RES}" + sed -i "s%:`which go | sed 's%/bin/go%%g'`%%g" "$HOME"/.bash_profile + rm -rf `which go | sed 's%/bin/go%%g'` +} + +while test $# -gt 0; do + case "$1" in + -h|--help) + . <(wget -qO- https://raw.githubusercontent.com/letsnode/Utils/main/bashbuilder/logo.sh) + echo + echo -e "${C_LGn}Functionality${RES}: the script installs or uninstalls GO" + echo + echo -e "${C_LGn}Usage${RES}: script ${C_LGn}[OPTIONS]${RES}" + echo + echo -e "${C_LGn}Options${RES}:" + echo -e " -h, --help show the help page" + echo -e " -v, --version VERSION GO VERSION to install (default is ${C_LGn}${go_version}${RES})" + echo -e " -u, --uninstall uninstall GO" + echo + echo -e "You can use either \"=\" or \" \" as an option and value ${C_LGn}delimiter${RES}" + echo + echo -e "${C_LGn}Useful URLs${RES}:" + echo -e "https://raw.githubusercontent.com/letsnode/Utils/main/installers/golang.sh - script URL" + echo -e "https://t.me/letskynode — node Community" + echo -e "https://teletype.in/@letskynode — guides and articles" + echo + return 0 2>/dev/null; exit 0 + ;; + -v*|--version*) + if ! grep -q "=" <<< "$1"; then shift; fi + go_version=`option_value "$1"` + shift + ;; + -u|--uninstall) + action="uninstall" + shift + ;; + *|--) + break + ;; + esac +done + +$action + +. "$HOME"/.bash_profile + +echo -e "${C_LGn}Done!${RES}" \ No newline at end of file diff --git a/Installers/rust.sh b/Installers/rust.sh index f46cee9..f9f3ee7 100644 --- a/Installers/rust.sh +++ b/Installers/rust.sh @@ -1,1787 +1,66 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Utils/rust.sh at main · letsnode/Utils · GitHub - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Skip to content - - - - - - - - - - - - -
- -
- - - - - - - -
- - - - -
- - - - - - - - - - - -
-
-
- - - - - - - - - - - - - - - - - - -
- - - - - - -
- - -
- - - - - - - - -Permalink - -
- -
-
- - - main - - - - -
-
-
- Switch branches/tags - -
- - - -
- -
- -
- - -
- -
- - - - - - - - - - - - - - - -
- - -
-
-
-
- -
- -
- - - Go to file - -
- - - - -
-
-
- - - - - - - - - -
- -
-
-
 
-
- -
-
 
- Cannot retrieve contributors at this time -
-
- - - - - - - - - -
- -
- - -
- - 66 lines (63 sloc) - - 1.78 KB -
- -
- - - - -
- -
-
-
-
- -
-
-
-
-
- - - Open in GitHub Desktop -
-
-
-
-
- - - -
- - - - - - - - - -
- - - -
-
- -
- -
-
- - - -
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#!/bin/bash
# Default variables
function="install"
nightly="false"
-
# Options
. <(wget -qO- https://raw.githubusercontent.com/letsnode/Utils/main/bashbuilder/colors.sh) --
option_value(){ echo "$1" | sed -e 's%^--[^=]*=%%g; s%^-[^=]*=%%g'; }
while test $# -gt 0; do
case "$1" in
-h|--help)
. <(wget -qO- https://raw.githubusercontent.com/letsnode/Utils/main/bashbuilder/logo.sh)
echo
echo -e "${C_LGn}Functionality${RES}: the script installs or uninstalls Rust"
echo
echo -e "${C_LGn}Usage${RES}: script ${C_LGn}[OPTIONS]${RES}"
echo
echo -e "${C_LGn}Options${RES}:"
echo -e " -h, --help show the help page"
echo -e " -n, --nightly install nightly version of Rust"
echo -e " -u, --uninstall uninstall Rust"
echo
echo -e "${C_LGn}Useful URLs${RES}:"
echo -e "Script URL: https://raw.githubusercontent.com/letsnode/Utils/main/installers/rust.sh"
echo -e "https://www.rust-lang.org/tools/install — Rust installation"
echo -e "https://t.me/letskynode — node Community"
echo -e "https://teletype.in/@letskynode — guides and articles"
echo
return 0 2>/dev/null; exit 0
;;
-n|--nightly)
nightly="true"
shift
;;
-u|--uninstall)
function="uninstall"
shift
;;
*|--)
break
;;
esac
done
-
# Functions
install() {
echo -e "${C_LGn}Rust installation...${RES}"
sudo apt update
sudo apt upgrade -y
sudo apt install curl build-essential pkg-config libssl-dev libudev-dev clang make -y
curl --proto '=https' -sSf https://sh.rustup.rs | sh -s -- -y
echo -e "${C_R}^ X Don't do that X ^${RES}\n"
. $HOME/.cargo/env
if [ "$nightly" = "true" ]; then
rustup toolchain install nightly
rustup default nightly
fi
}
uninstall() {
echo -e "${C_LGn}Rust uninstalling...${RES}"
rustup self uninstall -y
}
-
# Actions
$function
echo -e "${C_LGn}Done!${RES}"
-
- - - -
- -
- - - - -
- - -
- - -
-
- - -
- -
- - -
- -
- - -
-
- -
- - - - - - - - - - - - - - - - - - - - - +#!/bin/bash +# Default variables +function="install" +nightly="false" + +# Options +. <(wget -qO- https://raw.githubusercontent.com/letsnode/Utils/main/bashbuilder/colors.sh) -- +option_value(){ echo "$1" | sed -e 's%^--[^=]*=%%g; s%^-[^=]*=%%g'; } +while test $# -gt 0; do + case "$1" in + -h|--help) + . <(wget -qO- https://raw.githubusercontent.com/letsnode/Utils/main/bashbuilder/logo.sh) + echo + echo -e "${C_LGn}Functionality${RES}: the script installs or uninstalls Rust" + echo + echo -e "${C_LGn}Usage${RES}: script ${C_LGn}[OPTIONS]${RES}" + echo + echo -e "${C_LGn}Options${RES}:" + echo -e " -h, --help show the help page" + echo -e " -n, --nightly install nightly version of Rust" + echo -e " -u, --uninstall uninstall Rust" + echo + echo -e "${C_LGn}Useful URLs${RES}:" + echo -e "Script URL: https://raw.githubusercontent.com/letsnode/Utils/main/installers/rust.sh" + echo -e "https://www.rust-lang.org/tools/install — Rust installation" + echo -e "https://t.me/letskynode — node Community" + echo -e "https://teletype.in/@letskynode — guides and articles" + echo + return 0 2>/dev/null; exit 0 + ;; + -n|--nightly) + nightly="true" + shift + ;; + -u|--uninstall) + function="uninstall" + shift + ;; + *|--) + break + ;; + esac +done + +# Functions +install() { + echo -e "${C_LGn}Rust installation...${RES}" + sudo apt update + sudo apt upgrade -y + sudo apt install curl build-essential pkg-config libssl-dev libudev-dev clang make -y + curl --proto '=https' -sSf https://sh.rustup.rs | sh -s -- -y + echo -e "${C_R}^ X Don't do that X ^${RES}\n" + . $HOME/.cargo/env + if [ "$nightly" = "true" ]; then + rustup toolchain install nightly + rustup default nightly + fi +} +uninstall() { + echo -e "${C_LGn}Rust uninstalling...${RES}" + rustup self uninstall -y +} + +# Actions +$function +echo -e "${C_LGn}Done!${RES}" \ No newline at end of file diff --git a/bashbuilder/addvar.sh b/bashbuilder/addvar.sh new file mode 100644 index 0000000..bb4967a --- /dev/null +++ b/bashbuilder/addvar.sh @@ -0,0 +1,117 @@ +#!/bin/bash + +name="" +value="" +type="export" +rename="" +delete_type="none" + +. <(wget -qO- https://raw.githubusercontent.com/letsnode/Utils/main/bashbuilder/colors.sh) -- + +function option_value() { + echo "$1" | sed -e 's%^--[^=]*=%%g; s%^-[^=]*=%%g'; +} + +function printf_n() { + printf "$1\n" "${@:2}"; +} + +while test $# -gt 0; do + case "$1" in + -h|--help) + . <(wget -qO- https://raw.githubusercontent.com/letsnode/Utils/main/bashbuilder/logo.sh) + echo + echo -e "${C_LGn}Functionality${RES}: the script inserts variable or alias to ${C_LGn}$HOME/.bash_profile${RES}" + echo + echo -e "${C_LGn}Usage${RES}: script ${C_LGn}[OPTIONS]${RES}" + echo + echo -e "${C_LGn}Options${RES}:" + echo -e " -h, --help show the help page" + echo -e " -n, --name NAME variable or alias NAME (mandatory)" + echo -e " -v, --value VALUE variable or alias VALUE (leave blank for manual input)" + echo -e " -a, --alias inserting an alias" + echo -e " -r, --rename NAME_2 rename NAME_2 to NAME" + echo -e " -d, --delete delete the first occurrence of a variable or alias by NAME" + echo -e " -da, --delete-all delete all occurrences of a variable or alias by NAME" + echo + echo -e "You can use either \"=\" or \" \" as an option and value ${C_LGn}delimiter${RES}" + echo + echo -e "${C_LGn}Useful URLs${RES}:" + echo -e "Script URL: https://github.com/letsnode/Utils/new/main/bashbuilder/addvar.sh" + echo -e "Telegram comunity: https://t.me/letskynode" + echo + return 0 2>/dev/null; exit 0 + ;; + -n*|--name*) + if ! grep -q "=" <<< "$1"; then shift; fi + name=`option_value "$1"` + shift + ;; + -v*|--value*) + if ! grep -q "=" <<< "$1"; then shift; fi + value=`option_value "$1"` + shift + ;; + -a|--alias) + type="alias" + shift + ;; + -r*|--rename*) + if ! grep -q "=" <<< "$1"; then shift; fi + rename=`option_value "$1"` + shift + ;; + -d|--delete) + delete_type="delete" + shift + ;; + -da|--delete-all) + delete_type="delete_all" + shift + ;; + *|--) + break + ;; + esac +done + +touch $HOME/.bash_profile +. $HOME/.bash_profile +if [ ! -n "$name" ]; then + printf_n "${C_R}You didn't specify a name via${RES} -n ${C_R}option!${RES}" + return 1 2>/dev/null; exit 1 +fi +if [ "$delete_type" != "none" ]; then + if [ "$delete_type" = "delete" ]; then + sed -i "0,/ ${name}=/{/ ${name}=/d;}" $HOME/.bash_profile + elif [ "$delete_type" = "delete_all" ]; then + sed -i "/ ${name}=/d" $HOME/.bash_profile + fi + unset "$name" + unalias "$name" 2>/dev/null +else + if [ -n "$rename" ]; then + sed -i "s%${rename}%${name}%" $HOME/.bash_profile + unset "$rename" + unalias "$rename" 2>/dev/null + if [ ! -n "$value" ]; then + return 0 2>/dev/null; exit 0 + fi + fi + if [ ! -n "$value" ]; then + printf "${C_LGn}Enter the value:${RES} " + read -r value + fi + if ! cat $HOME/.bash_profile | grep -q " ${name}="; then + echo "${type} ${name}=\"${value}\"" >> $HOME/.bash_profile + elif ! cat $HOME/.bash_profile | grep -qF "${name}=\"${value}\""; then + sed -i "s%^.*${name}*=.*%${type} ${name}=\"${value}\"%" $HOME/.bash_profile + fi + variable=`cat $HOME/.bash_profile | grep -qF "${name}=\"${value}\""` + if ! grep -q "${type}" <<< "$variable"; then + sed -i "s%^.*${name}*=.*%${type} ${name}=\"${value}\"%" $HOME/.bash_profile + fi +fi + +sed -i '/^$/d' $HOME/.bash_profile +. $HOME/.bash_profile \ No newline at end of file diff --git a/bashbuilder/colors.sh b/bashbuilder/colors.sh new file mode 100644 index 0000000..09e2b11 --- /dev/null +++ b/bashbuilder/colors.sh @@ -0,0 +1,138 @@ +#!/bin/bash +# Reset +RES='\033[0m' # Reset format + +# Base Characters +C_Bk='\033[0;30m' # Black +C_R='\033[0;31m' # Red +C_Gn='\033[0;32m' # Green +C_Y='\033[0;33m' # Yellow +C_Be='\033[0;34m' # Blue +C_P='\033[0;35m' # Purple +C_C='\033[0;36m' # Cyan +C_Gy='\033[1;37m' # Gray + +# Light Characters +C_LR='\033[1;31m' # Light Red +C_LGn='\033[1;32m' # Light Green +C_LY='\033[1;33m' # Light Yellow +C_LBe='\033[1;34m' # Light Blue +C_LP='\033[1;35m' # Light Purple +C_LC='\033[1;36m' # Light Cyan +C_LGy='\033[0;37m' # Light Gray + +# Dark Characters +C_DBk='\033[2;30m' # Dark Black +C_DR='\033[2;31m' # Dark Red +C_DGn='\033[2;32m' # Dark Green +C_DY='\033[2;33m' # Dark Yellow +C_DBe='\033[2;34m' # Dark Blue +C_DP='\033[2;35m' # Dark Purple +C_DC='\033[2;36m' # Dark Cyan +C_DGy='\033[2;37m' # Dark Gray + +# Underline Characters +U_Bk='\033[4;30m' # Black +U_R='\033[4;31m' # Red +U_Gn='\033[4;32m' # Green +U_Y='\033[4;33m' # Yellow +U_Be='\033[4;34m' # Blue +U_P='\033[4;35m' # Purple +U_C='\033[4;36m' # Cyan +U_Gy='\033[4;37m' # Gray + +# Blinking Characters +Bl_Bk='\033[5;30m' # Black +Bl_R='\033[5;31m' # Red +Bl_Gn='\033[5;32m' # Green +Bl_Y='\033[5;33m' # Yellow +Bl_Be='\033[5;34m' # Blue +Bl_P='\033[5;35m' # Purple +Bl_C='\033[5;36m' # Cyan +Bl_Gy='\033[5;37m' # Gray + +# Background +Ba_Bk='\033[40m' # Black +Ba_R='\033[41m' # Red +Ba_Gn='\033[42m' # Green +Ba_Y='\033[43m' # Yellow +Ba_Be='\033[44m' # Blue +Ba_P='\033[45m' # Purple +Ba_C='\033[46m' # Cyan +Ba_Gy='\033[47m' # Gray + +function option_value(){ + echo "$1" | sed -e 's%^--[^=]*=%%g; s%^-[^=]*=%%g'; +} + +while test $# -gt 0; do + case "$1" in + -h|--help) + . <(wget -qO- https://raw.githubusercontent.com/letsnode/Utils/main/bashbuilder/logo.sh) + echo + echo -e "${C_LGn}Functionality${RES}: the script assigns variables with colors to be used in the texts (e.g." + echo -e "in the 'echo' and 'printf' commands)" + echo + echo -e "Usage: script ${C_LGn}[OPTIONS]${RES}" + echo + echo -e "${C_LGn}Options${RES}:" + echo -e " -h, --help show the help page" + echo + echo -e "${C_LGn}Colors${RES}:" + echo -e "Reset - \${RES}" + echo -e "┌─────────────────────────────┐ ┌─────────────────────────────┐" + echo -e "│ Base Characters │ │ Underline Characters │" + echo -e "├────────┬─────────┬──────────┤ ├────────┬─────────┬──────────┤" + echo -e "│ Color │ Example │ Variable │ │ Color │ Example │ Variable │" + echo -e "├────────┼─────────┼──────────┤ ├────────┼─────────┼──────────┤" + echo -e "│ Black │ ${C_Bk}Example${RES} │ \${C_Bk} │ │ Black │ ${U_Bk}Example${RES} │ \${U_Bk} │" + echo -e "│ Red │ ${C_R}Example${RES} │ \${C_R} │ │ Red │ ${U_R}Example${RES} │ \${U_R} │" + echo -e "│ Green │ ${C_Gn}Example${RES} │ \${C_Gn} │ │ Green │ ${U_Gn}Example${RES} │ \${U_Gn} │" + echo -e "│ Yellow │ ${C_Y}Example${RES} │ \${C_Y} │ │ Yellow │ ${U_Y}Example${RES} │ \${U_Y} │" + echo -e "│ Blue │ ${C_Be}Example${RES} │ \${C_Be} │ │ Blue │ ${U_Be}Example${RES} │ \${U_Be} │" + echo -e "│ Purple │ ${C_P}Example${RES} │ \${C_P} │ │ Purple │ ${U_P}Example${RES} │ \${U_P} │" + echo -e "│ Cyan │ ${C_C}Example${RES} │ \${C_C} │ │ Cyan │ ${U_C}Example${RES} │ \${U_C} │" + echo -e "│ Gray │ ${C_Gy}Example${RES} │ \${C_Gy} │ │ Gray │ ${U_Gy}Example${RES} │ \${U_Gy} │" + echo -e "└────────┴─────────┴──────────┘ └────────┴─────────┴──────────┘" + echo + echo -e "┌─────────────────────────────┐ ┌─────────────────────────────┐" + echo -e "│ Light Characters │ │ Blinking Characters │" + echo -e "├────────┬─────────┬──────────┤ ├────────┬─────────┬──────────┤" + echo -e "│ Color │ Example │ Variable │ │ Color │ Example │ Variable │" + echo -e "├────────┼─────────┼──────────┤ ├────────┼─────────┼──────────┤" + echo -e "│ │ │ │ │ Black │ ${Bl_Bk}Example${RES} │ \${Bl_Bk} │" + echo -e "│ Red │ ${C_LR}Example${RES} │ \${C_LR} │ │ Red │ ${Bl_R}Example${RES} │ \${Bl_R} │" + echo -e "│ Green │ ${C_LGn}Example${RES} │ \${C_LGn} │ │ Green │ ${Bl_Gn}Example${RES} │ \${Bl_Gn} │" + echo -e "│ Yellow │ ${C_LY}Example${RES} │ \${C_LY} │ │ Yellow │ ${Bl_Y}Example${RES} │ \${Bl_Y} │" + echo -e "│ Blue │ ${C_LBe}Example${RES} │ \${C_LBe} │ │ Blue │ ${Bl_Be}Example${RES} │ \${Bl_Be} │" + echo -e "│ Purple │ ${C_LP}Example${RES} │ \${C_LP} │ │ Purple │ ${Bl_P}Example${RES} │ \${Bl_P} │" + echo -e "│ Cyan │ ${C_LC}Example${RES} │ \${C_LC} │ │ Cyan │ ${Bl_C}Example${RES} │ \${Bl_C} │" + echo -e "│ Gray │ ${C_LGy}Example${RES} │ \${C_LGy} │ │ Gray │ ${Bl_Gy}Example${RES} │ \${Bl_Gy} │" + echo -e "└────────┴─────────┴──────────┘ └────────┴─────────┴──────────┘" + echo + echo -e "┌─────────────────────────────┐ ┌─────────────────────────────┐" + echo -e "│ Dark Characters │ │ Background │" + echo -e "├────────┬─────────┬──────────┤ ├────────┬─────────┬──────────┤" + echo -e "│ Color │ Example │ Variable │ │ Color │ Example │ Variable │" + echo -e "├────────┼─────────┼──────────┤ ├────────┼─────────┼──────────┤" + echo -e "│ Black │ ${C_DBk}Example${RES} │ \${C_DBk} │ │ Black │ ${Ba_Bk}Example${RES} │ \${Ba_Bk} │" + echo -e "│ Red │ ${C_DR}Example${RES} │ \${C_DR} │ │ Red │ ${Ba_R}Example${RES} │ \${Ba_R} │" + echo -e "│ Green │ ${C_DGn}Example${RES} │ \${C_DGn} │ │ Green │ ${Ba_Gn}Example${RES} │ \${Ba_Gn} │" + echo -e "│ Yellow │ ${C_DY}Example${RES} │ \${C_DY} │ │ Yellow │ ${Ba_Y}Example${RES} │ \${Ba_Y} │" + echo -e "│ Blue │ ${C_DBe}Example${RES} │ \${C_DBe} │ │ Blue │ ${Ba_Be}Example${RES} │ \${Ba_Be} │" + echo -e "│ Purple │ ${C_DP}Example${RES} │ \${C_DP} │ │ Purple │ ${Ba_P}Example${RES} │ \${Ba_P} │" + echo -e "│ Cyan │ ${C_DC}Example${RES} │ \${C_DC} │ │ Cyan │ ${Ba_C}Example${RES} │ \${Ba_C} │" + echo -e "│ Gray │ ${C_DGy}Example${RES} │ \${C_DGy} │ │ Gray │ ${Ba_Gy}Example${RES} │ \${Ba_Gy} │" + echo -e "└────────┴─────────┴──────────┘ └────────┴─────────┴──────────┘" + echo + echo -e "${C_LGn}Useful URLs${RES}:" + echo -e "Script URL: https://raw.githubusercontent.com/letsnode/Utils/main/bashbuilder/colors.sh" + echo -e "Telegram community: https://t.me/letskynode" + echo + return 0 2>/dev/null; exit 0 + ;; + *|--) + break + ;; + esac +done \ No newline at end of file diff --git a/bashbuilder/logo.sh b/bashbuilder/logo.sh new file mode 100644 index 0000000..ebf530a --- /dev/null +++ b/bashbuilder/logo.sh @@ -0,0 +1,20 @@ +echo -e "\033[1;34m" +echo -e " _____________________________________________________________________________________ " +echo -e "|_____________________________________________________________________________________|" +echo -e "\033[1;36m" +echo -e " _ _ _ _ _ " +echo -e "| | _ | | | \ | | | | " +echo -e "| | | | | | | \ | | | | " +echo -e "| | ______ _| |__ |_| _____ | \ | | _____ ____| | ______ " +echo -e "| | / ____ \ |_ __| / ___/ | |\ \ | | / ___ \ / ___ | / ____ \ " +echo -e "| | | |____| | | | \ \_ | | \ \ | | | | | | | | | | | |____| |" +echo -e "| | | _____/ | | \_ \ | | \ \| | | | | | | | | | | _____/ " +echo -e "| | | / | | \ | | | \ | | | | | | | | | | / " +echo -e "| \_______ | \______ | \___ ___/ / | | \ | | |___| | | |___| | | \______ " +echo -e " \_______/ \______/ \___/ \___/ |_| \_| \_____/ \_____/ \______/ " +echo -e "\033[1;34m" +echo -e " _____________________________________________________________________________________ " +echo -e "|_____________________________________________________________________________________|" +echo +echo -e "\033[1;32mTelegram community: \033[5;31mhttps://t.me/letskynode\033[0m" +echo -e "\033[0m" \ No newline at end of file diff --git a/portainer/configure_docker.sh b/portainer/configure_docker.sh new file mode 100644 index 0000000..9e9d38d --- /dev/null +++ b/portainer/configure_docker.sh @@ -0,0 +1,10 @@ +echo '{ + "hosts": ["unix:///var/run/docker.sock", "tcp://$INTERNALIP:2376"], + "tls": true, + "tlscacert": "/root/certs/ca.crt", + "tlscert": "/root/certs/server.crt", + "tlskey": "/root/certs/server.key", + "tlsverify": true +}' > /etc/docker/daemon.json + +echo '' > \ No newline at end of file diff --git a/portainer/create_ssl.sh b/portainer/create_ssl.sh new file mode 100644 index 0000000..84af352 --- /dev/null +++ b/portainer/create_ssl.sh @@ -0,0 +1,71 @@ +#!/bin/bash + +echo "-------------------------------------" +echo "-------Создаем SSL сертификаты-------" +echo "-------------------------------------" + +CERT_LIFETIME=$1 + +function no_logs { + $1 &> /dev/null +} + +function create_key() { + openssl genrsa -out $1.key 4096 +} + +function create_cert() { + name=$1 + + openssl req -new -x509 \ + -days $CERT_LIFETIME -key $name.key \ + -sha256 -out $name.crt \ + -subj "/CN=." +} + +function sign_cert() { + name=$1 + + openssl req -sha256 -new \ + -key $name.key -out $name.csr \ + -subj "/CN=." + + openssl x509 -req -days $CERT_LIFETIME \ + -sha256 -in $name.csr \ + -CA ca.crt -CAkey ca.key \ + -CAcreateserial -out $name.crt +} + +function create_ca_pair() { + create_key ca + create_cert ca +} + +function create_server_pair() { + create_key server + create_cert server + sign_cert server +} + +function create_client_pair() { + create_key client + create_cert client + sign_cert client +} + +function cleanup() { + rm *.srl *.csr +} + +function run() { + no_logs create_ca_pair + no_logs create_server_pair + no_logs create_client_pair + cleanup +} + +run + +echo "-------------------------------------" +echo "---SSL сертификаты успешно созданы---" +echo "-------------------------------------" \ No newline at end of file