From b5dd0f64f27ac58a37b455dec5675da959a188ca Mon Sep 17 00:00:00 2001 From: david Date: Thu, 21 Dec 2023 12:25:16 +0100 Subject: [PATCH] cosmetic changes and updated README.md --- README.md | 37 ++++++++++++++++++++------ ci.sh | 2 ++ lib.sh | 77 +++++++++++++++++++++++++++++-------------------------- 3 files changed, 71 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index f0981a8..49359d2 100644 --- a/README.md +++ b/README.md @@ -2,17 +2,38 @@ My personal collection of handy scripts. mostly bash. -- [restic-backup.sh](#restic-backup.sh) -- [restic-repos.sh](#restic-repos.sh) -- [btrfs-snapshots.sh](#btrfs-snapshots.sh) -- [odroid-fancontrol.sh](#odroid-fancontrol.sh) +| Name | Description | +| :--- | :---------- | +| [ci.sh](#ci.sh) | A poor man's CI system | +| [restic-backup.sh](#restic-backup.sh) | Simple wrapper script for [Restic](https://github.com/restic/restic) | -More: -- [lib.sh](#lib.sh) -- [template.sh](#template.sh) +## ci.sh +### Install ---- +Clone this repository anywhere on your system and link it into your `$PATH`. + +```bash +sudo su; cd +git clone https://git.socialnerds.org/david/scripts.git +ln -s /root/scripts/ci.sh /usr/local/bin/ci +``` + +### Usage + +```bash +Usage: +ci + +Options: + -s, --scripts Specify the scripts directory (default: /root/ci-scripts) + -c, --checks Enable healthchecks.io integration + -n, --ntfy Enable ntfy.sh integration + -h, --help Print help screen and exit + -i, --info Print script information and exit + -v, --verbose More verbose output + -q, --quiet No output except errors (overrides -v) +``` ## restic-backup.sh diff --git a/ci.sh b/ci.sh index 2981dd3..57ed34b 100755 --- a/ci.sh +++ b/ci.sh @@ -199,6 +199,8 @@ else nohup "$SCRIPTS_DIR/$GIT_HOST/$GIT_USER/$GIT_REPO.sh" > "$TEMP_DIR/$GIT_HOST/$GIT_USER/$GIT_REPO.log" 2>&1 & echo $! > "$TEMP_DIR/$GIT_HOST/$GIT_USER/$GIT_REPO.pid" + # Inform user of a successful job execution + lib_print "CI job has been triggered [$GIT_HOST/$GIT_USER/$GIT_REPO]" lib_ntfy "$NTFY_URL" "CI job has been triggered [$GIT_HOST/$GIT_USER/$GIT_REPO]" lib_checks "$CHECKS_URL" "CI job has been triggered [$GIT_HOST/$GIT_USER/$GIT_REPO]" fi diff --git a/lib.sh b/lib.sh index 3b46a32..021caaf 100644 --- a/lib.sh +++ b/lib.sh @@ -28,48 +28,51 @@ LIB_WEBSITE="https://git.socialnerds.org/david/scripts" ## Variables ## -# Reset text formatting -LIB_CLEAR="\e[0m" -# Text settings -LIB_BOLD="\e[1m" -LIB_UNDERLINE="\e[4m" +# Text formatting +if [[ -t 1 ]]; then + LIB_CLEAR="\e[0m" -# Text color -LIB_RED="\e[31m" -LIB_GREEN="\e[32m" -LIB_YELLOW="\e[33m" -LIB_BLUE="\e[34m" -LIB_MAGENTA="\e[35m" -LIB_CYAN="\e[36m" -LIB_LIGHTGREY="\e[37m" + # Text settings + LIB_BOLD="\e[1m" + LIB_UNDERLINE="\e[4m" -# Text color with bold font -LIB_RED_BOLD="\e[1;31m" -LIB_GREEN_BOLD="\e[1;32m" -LIB_YELLOW_BOLD="\e[1;33m" -LIB_BLUE_BOLD="\e[1;34m" -LIB_MAGENTA_BOLD="\e[1;35m" -LIB_CYAN_BOLD="\e[1;36m" -LIB_LIGHTGREY_BOLD="\e[1;37m" + # Text color + LIB_RED="\e[31m" + LIB_GREEN="\e[32m" + LIB_YELLOW="\e[33m" + LIB_BLUE="\e[34m" + LIB_MAGENTA="\e[35m" + LIB_CYAN="\e[36m" + LIB_LIGHTGREY="\e[37m" -# Background color -LIB_RED_BG="\e[41m" -LIB_GREEN_BG="\e[42m" -LIB_YELLOW_BG="\e[43m" -LIB_BLUE_BG="\e[44m" -LIB_MAGENTA_BG="\e[45m" -LIB_CYAN_BG="\e[46m" -LIB_LIGHTGREY_BG="\e[47m" + # Text color with bold font + LIB_RED_BOLD="\e[1;31m" + LIB_GREEN_BOLD="\e[1;32m" + LIB_YELLOW_BOLD="\e[1;33m" + LIB_BLUE_BOLD="\e[1;34m" + LIB_MAGENTA_BOLD="\e[1;35m" + LIB_CYAN_BOLD="\e[1;36m" + LIB_LIGHTGREY_BOLD="\e[1;37m" -# Background color with bold font -LIB_RED_BG_BOLD="\e[1;41m" -LIB_GREEN_BG_BOLD="\e[1;42m" -LIB_YELLOW_BG_BOLD="\e[1;43m" -LIB_BLUE_BG_BOLD="\e[1;44m" -LIB_MAGENTA_BG_BOLD="\e[1;45m" -LIB_CYAN_BG_BOLD="\e[1;46m" -LIB_LIGHTGREY_BG_BOLD="\e[1;47m" + # Background color + LIB_RED_BG="\e[41m" + LIB_GREEN_BG="\e[42m" + LIB_YELLOW_BG="\e[43m" + LIB_BLUE_BG="\e[44m" + LIB_MAGENTA_BG="\e[45m" + LIB_CYAN_BG="\e[46m" + LIB_LIGHTGREY_BG="\e[47m" + + # Background color with bold font + LIB_RED_BG_BOLD="\e[1;41m" + LIB_GREEN_BG_BOLD="\e[1;42m" + LIB_YELLOW_BG_BOLD="\e[1;43m" + LIB_BLUE_BG_BOLD="\e[1;44m" + LIB_MAGENTA_BG_BOLD="\e[1;45m" + LIB_CYAN_BG_BOLD="\e[1;46m" + LIB_LIGHTGREY_BG_BOLD="\e[1;47m" +fi ##