1
1
Fork 0

cosmetic changes and updated README.md

This commit is contained in:
david 2023-12-21 12:25:16 +01:00
parent 1b3c18243c
commit b5dd0f64f2
3 changed files with 71 additions and 45 deletions

View File

@ -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> <git-repo>
Options:
-s, --scripts <DIR> Specify the scripts directory (default: /root/ci-scripts)
-c, --checks <URL> Enable healthchecks.io integration
-n, --ntfy <URL> 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

2
ci.sh
View File

@ -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

77
lib.sh
View File

@ -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
##