From 8e45775f1430f8fe04cc8c4b44a0d19c491061f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anti=20R=C3=A4is?= Date: Fri, 19 Jan 2024 10:15:15 +0200 Subject: [PATCH 1/2] add color util script --- install.sh | 151 +++++++++++++++++++------------------- scripts/general/colors.sh | 33 +++++++++ 2 files changed, 108 insertions(+), 76 deletions(-) create mode 100755 scripts/general/colors.sh diff --git a/install.sh b/install.sh index a9e1e040..02e7e272 100755 --- a/install.sh +++ b/install.sh @@ -2,27 +2,24 @@ set -e # exit when any command fails -C_RED="\033[31m" -C_GREEN="\033[32m" -C_YELLOW="\033[33m" -C_MAGENTA="\033[95m" -C_RST="\033[0m" +# shellcheck disable=SC1091 +source ./scripts/general/colors.sh # Check if script is run with sudo if [ $EUID -eq 0 ]; then - echo -e "${C_RED}" - echo -e "Don't run this script with sudo, it will ask for sudo password when needed." + print_nl "${C_RED}" + print_nl "Don't run this script with sudo, it will ask for sudo password when needed." read -rp $'\n'"Press Ctrl + C to cancel or Press any key to continue..." - echo -e "${C_RST}" + print_nl "${C_RST}" fi makerc-vars-creator() { # Checking if .makerc-vars already exists and asking for an overwrite if [ -f .makerc-vars ]; then - echo -e "${C_RED}" - echo -e "$(pwd)/.makerc-vars already exists, do you want to overwrite it with $(pwd)/.makerc-vars.example?" - echo -e "${C_YELLOW}" + print_nl "${C_RED}" + print_nl "$(pwd)/.makerc-vars already exists, do you want to overwrite it with $(pwd)/.makerc-vars.example?" + print_nl "${C_YELLOW}" options=( "Yes" @@ -31,22 +28,22 @@ makerc-vars-creator() { select _ in "${options[@]}"; do case "$REPLY" in yes|y|1) cp -f .makerc-vars.example .makerc-vars; break;; - no|n|2) echo -e "Not overwriting .makerc-vars"$'\n'; break;; + no|n|2) print_nl "Not overwriting .makerc-vars"$'\n'; break;; esac done - echo -n -e "${C_RST}" + print "${C_RST}" else cp -f .makerc-vars.example .makerc-vars fi } if [ ! -f .makerc-vars ]; then - echo -e "${C_RED}" - echo -e "$(pwd)/.makerc-vars not found" - echo -e "${C_YELLOW}" - echo -e "Do you want to create your .makerc-vars file from the $(pwd)/.makerc-vars.example file?" - echo -e + print_nl "${C_RED}" + print_nl "$(pwd)/.makerc-vars not found" + print_nl "${C_YELLOW}" + print_nl "Do you want to create your .makerc-vars file from the $(pwd)/.makerc-vars.example file?" + print_nl options=( "Yes" @@ -59,47 +56,47 @@ if [ ! -f .makerc-vars ]; then esac done - echo -n -e "$C_RST" + print "$C_RST" else makerc-vars-creator fi # MacOS if [[ $(uname) == "Darwin" ]]; then - echo -n -e "${C_MAGENTA}" - echo -e "Removing MacOS sudo requirement for Catapult..." - echo -e "${C_RST}" + print "${C_MAGENTA}" + print_nl "Removing MacOS sudo requirement for Catapult..." + print_nl "${C_RST}" sed -i "" "s#MAKEVAR_SUDO_COMMAND.*#MAKEVAR_SUDO_COMMAND :=#" .makerc-vars brew-install() { - echo -n -e "${C_MAGENTA}" - echo -e "Installing Homebrew..." - echo -n -e "${C_RST}" + print "${C_MAGENTA}" + print_nl "Installing Homebrew..." + print "${C_RST}" /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" } brew-packages-install() { if [[ -x "$(command -v brew)" ]]; then - echo -n -e "${C_MAGENTA}" - echo -e "Installing MacOS packages with homebrew..." - echo -n -e "${C_RST}" + print "${C_MAGENTA}" + print_nl "Installing MacOS packages with homebrew..." + print "${C_RST}" # shellcheck disable=SC2086 brew install $PACKAGES else - echo -n -e "${C_RED}" - echo -e "Homebrew not installed, cannot install:" - echo -e "$PACKAGES" - echo -n -e "${C_RST}" + print "${C_RED}" + print_nl "Homebrew not installed, cannot install:" + print_nl "$PACKAGES" + print "${C_RST}" exit 0 fi } PACKAGES="git git-lfs make jq curl md5sha1sum" - echo -n -e "${C_YELLOW}" - echo -e "Installing homebrew?" + print "${C_YELLOW}" + print_nl "Installing homebrew?" echo options=( @@ -114,9 +111,9 @@ if [[ $(uname) == "Darwin" ]]; then esac done - echo -n -e "${C_YELLOW}" - echo -e "Installing following packages with homebrew:" - echo -e "$PACKAGES" + print "${C_YELLOW}" + print_nl "Installing following packages with homebrew:" + print_nl "$PACKAGES" echo options=( @@ -126,19 +123,19 @@ if [[ $(uname) == "Darwin" ]]; then select _ in "${options[@]}"; do case "$REPLY" in yes|y|1) brew-packages-install; break;; - no|n|2) read -rp $'\n'"Make sure $BREW_PACKAGES are installed - Press any key to continue"$'\n'; break;; + no|n|2) read -rp $'\n'"Make sure $PACKAGES are installed - Press any key to continue"$'\n'; break;; esac done - echo -e "${C_RST}" + print_nl "${C_RST}" fi # Linux if [[ $(uname) == "Linux" ]]; then if ! [ -x "$(command -v sudo)" ]; then - echo -e "${C_RED}" - echo -e "sudo is not installed, install it and run this script again." - echo -e "${C_RST}" + print_nl "${C_RED}" + print_nl "sudo is not installed, install it and run this script again." + print_nl "${C_RST}" exit 0 fi @@ -147,22 +144,22 @@ if [[ $(uname) == "Linux" ]]; then PACKAGES="git git-lfs make jq curl sudo gpg ssh" debian-packages-install() { - echo -n -e "${C_MAGENTA}" - echo -e "Installing required deb packages..." - echo -n -e "${C_RST}" + print "${C_MAGENTA}" + print_nl "Installing required deb packages..." + print "${C_RST}" sudo -E apt-get update - # shellcheck disable=SC2086 - sudo -E apt-get install ${PACKAGES} -y + # shellcheck disable=SC2068,SC2086 + sudo -E apt-get install $PACKAGES -y if [ -n "$WSL_DISTRO_NAME" ]; then sudo -E apt-get install keychain -y fi } - echo -e "${C_YELLOW}" - echo -e "Installing following packages:" - echo -e "$PACKAGES" + print_nl "${C_YELLOW}" + print_nl "Installing following packages:" + print_nl "$PACKAGES" echo options=( @@ -181,18 +178,18 @@ if [[ $(uname) == "Linux" ]]; then PACKAGES="git git-lfs make jq curl sudo" arch-packages-install() { - echo -n -e "${C_MAGENTA}" - echo -e "Installing required pacman packages..." - echo -n -e "${C_RST}" + print "${C_MAGENTA}" + print_nl "Installing required pacman packages..." + print "${C_RST}" # shellcheck disable=SC2086 sudo -E pacman -S $PACKAGES --noconfirm } - echo -e "${C_YELLOW}" - echo -e "Installing following packages:" - echo -e "$PACKAGES" - echo -e + print_nl "${C_YELLOW}" + print_nl "Installing following packages:" + print_nl "$PACKAGES" + print_nl options=( "Yes" @@ -210,18 +207,18 @@ if [[ $(uname) == "Linux" ]]; then PACKAGES="git git-lfs make jq curl sudo gpg openssh-server dnf-plugins-core" rhel-packages-install() { - echo -n -e "${C_MAGENTA}" - echo -e "Installing required rhel packages..." - echo -n -e "${C_RST}" + print "${C_MAGENTA}" + print_nl "Installing required rhel packages..." + print "${C_RST}" sudo -E dnf makecache # shellcheck disable=SC2086 sudo -E dnf install $PACKAGES -y } - echo -e "${C_YELLOW}" - echo -e "Installing following packages:" - echo -e "$PACKAGES" + print_nl "${C_YELLOW}" + print_nl "Installing following packages:" + print_nl "$PACKAGES" echo options=( @@ -237,24 +234,26 @@ if [[ $(uname) == "Linux" ]]; then # Other else - echo -n -e "${C_RED}" - echo -e - echo -e "You are using unsupported or untested (Linux) operating system. Catapult may still work if you configure it manually" - echo -e - echo -e "You'll need to follow these steps:" - echo -e - echo -e "1) Install following packages: ${C_YELLOW}git git-lfs make jq curl sudo gpg ssh${C_RED}" - echo -e "2) Initialize git LFS with: ${C_YELLOW}git lfs install${C_RED}" - echo -e + PACKAGES="git git-lfs make jq curl sudo gpg ssh" + PACKAGES_LFS="git lfs install" + + print_nl "${C_RED}" + print_nl "You are using unsupported or untested (Linux) operating system. Catapult may still work if you configure it manually" + print_nl + print_nl "You'll need to follow these steps:" + print_nl + print_nl "1) Install following packages: ${C_YELLOW}$PACKAGES${C_RED}" + print_nl "2) Initialize git LFS with: ${C_YELLOW}$PACKAGES_LFS${C_RED}" + print_nl read -rp $'\n'"Once you have installed the required packages press any key to continue..."$'\n' fi - echo -e "${C_RST}" + print_nl "${C_RST}" fi -echo -n -e "${C_MAGENTA}" -echo -e "Configuring githooks & LFS..." -echo -n -e "${C_RST}" +print "${C_MAGENTA}" +echo "Configuring githooks & LFS..." +print "${C_RST}" touch ~/.gitconfig git config core.hooksPath .githooks diff --git a/scripts/general/colors.sh b/scripts/general/colors.sh new file mode 100755 index 00000000..2c7de240 --- /dev/null +++ b/scripts/general/colors.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +export C_RED="\x1b[91m" +export C_GREEN="\x1b[92m" +export C_YELLOW="\x1b[93m" +export C_BLUE="\x1b[94m" +export C_MAGENTA="\x1b[95m" +export C_CYAN="\x1b[96m" +export C_WHITE="\x1b[97m" +export CB_RED="\x1b[91;1m" +export CB_GREEN="\x1b[92;1m" +export CB_YELLOW="\x1b[93;1m" +export CB_BLUE="\x1b[94;1m" +export CB_MAGENTA="\x1b[95;1m" +export CB_CYAN="\x1b[96;1m" +export CB_WHITE="\x1b[97;1m" +export C_RST="\x1b[0m" + +print_nl() { + echo -e "$@" +} + +print() { + echo -ne "$@" +} + +error_nl() { + echo -e "$@" >&2 +} + +error() { + echo -ne "$@" >&2 +} From 68679e54837f0091ed00942732b6c30ac67c228e Mon Sep 17 00:00:00 2001 From: Catapult CI/CD Bot Date: Mon, 12 Feb 2024 11:17:45 +0000 Subject: [PATCH 2/2] Set Catapult version to 3.4.4 --- version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.yml b/version.yml index 04ac0c64..5b11b8c5 100644 --- a/version.yml +++ b/version.yml @@ -1 +1 @@ -version: 3.4.3 +version: 3.4.4