From 2286bc30614ad2b1827651ce3ded83335adf30b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20GUEZO?= Date: Wed, 30 Jul 2025 21:32:12 +0200 Subject: [PATCH] chore: libs file removed --- scripts/common.sh | 75 ---------------------------------------- scripts/notifications.sh | 11 ------ 2 files changed, 86 deletions(-) delete mode 100644 scripts/common.sh delete mode 100644 scripts/notifications.sh diff --git a/scripts/common.sh b/scripts/common.sh deleted file mode 100644 index b8a092f..0000000 --- a/scripts/common.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/bash - -FILENAME="serverconfig" - -ETC_DIR="/etc/$FILENAME" -ENV_FILE="$ETC_DIR/.env" -LOG="/var/log/$FILENAME.log" -SCRIPT_FILE="/usr/local/bin" - -INFO="\e[34mINFO\e[0m" -SUCCESS="\e[32mSUCCESS\e[0m" -WARN="\e[33mWARN\e[0m" -ERROR="\e[31mERROR\e[0m" -DEBUG="\e[35mDEBUG\e[0m" -ACTION="\e[36mACTION\e[0m" - -DATETIME_FORMAT="%d-%m-%Y %H:%M:%S" - -info_print() { - local message="$1" - local level="${2:-1}" - local write_log="${3:-true}" - - case $level in - 1|--) local level=$INFO;; - 2) local level=$WARN;; - 3) local level=$ERROR;; - 4) local level=$DEBUG;; - 5) local level=$ACTION;; - 6) local level=$SUCCESS;; - *);; - esac - - local output="[$(date +"$DATETIME_FORMAT")] - $level: $message" - - if [ "$write_log" = true ]; then echo -e "$output" | tee -a "$LOG" - else echo -e "$output" - fi -} - -create_env_variable() { - local key="$1" - local value="$2" - local file="${3:-$ENV_FILE}" - - if [[ -z "$value" ]]; then - if grep -q "^$key=*" "$file" 2>/dev/null; then - info_print "$key not updated." - return - else - info_print "$key not set (empty input)." - return - fi - fi - - if grep -q "^$key=" "$file" 2>/dev/null; then - if $AUTO_CONFIRM; then - yn="y" - else - read -p "$key already set, overwrite? (y/N): " yn - fi - case "$yn" in - [Yy]*) - sed -i "s/^$key=.*/$key=$value/" "$file" - info_print "$key updated." - ;; - *) - info_print "$key not changed." - ;; - esac - else - echo "$key=$value" >> "$file" - info_print "$key \e[32mset\e[0m." - fi -} \ No newline at end of file diff --git a/scripts/notifications.sh b/scripts/notifications.sh deleted file mode 100644 index bebbf22..0000000 --- a/scripts/notifications.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -source /etc/serverconfig/.env - -send_notification() { - local message="$1" - curl -X POST "https://api.telegram.org/bot$TELEGRAM_TOKEN/sendMessage" \ - -d "chat_id=$TELEGRAM_CHAT_ID" \ - -d "text=$message" \ - -d "parse_mode=HTML" -} \ No newline at end of file