feat: outsource globals in own file

Signed-off-by: Dominik Willner th33xitus@gmail.com
This commit is contained in:
th33xitus
2022-04-05 12:14:01 +02:00
parent 114684030b
commit 8f3af54251
13 changed files with 69 additions and 66 deletions

View File

@@ -78,6 +78,7 @@ function kiauh_update_avail(){
#}
check_euid
set_globals
init_ini
kiauh_update_avail
main_menu

View File

@@ -11,10 +11,6 @@
set -e
### global variables
BACKUP_DIR="${HOME}/kiauh-backups"
KLIPPER_CONFIG="$(get_klipper_cfg_dir)"
function get_date(){
current_date=$(date +"%y%m%d-%H%M")
echo "${current_date}"

View File

@@ -11,11 +11,6 @@
set -e
### global variables
FLUIDD_DIR="${HOME}/fluidd"
FLUIDD_REPO_API="https://api.github.com/repos/fluidd-core/fluidd/releases"
KLIPPER_CONFIG="$(get_klipper_cfg_dir)"
#===================================================#
#================== INSTALL FLUIDD =================#
#===================================================#

68
scripts/globals.sh Normal file
View File

@@ -0,0 +1,68 @@
#!/bin/bash
#=======================================================================#
# Copyright (C) 2020 - 2022 Dominik Willner <th33xitus@gmail.com> #
# #
# This file is part of KIAUH - Klipper Installation And Update Helper #
# https://github.com/th33xitus/kiauh #
# #
# This file may be distributed under the terms of the GNU GPLv3 license #
#=======================================================================#
set -e
function set_globals(){
#=================== SYSTEM ===================#
SYSTEMD="/etc/systemd/system"
INITD="/etc/init.d"
ETCDEF="/etc/default"
#=================== KIAUH ====================#
green=$(echo -en "\e[92m")
yellow=$(echo -en "\e[93m")
red=$(echo -en "\e[91m")
cyan=$(echo -en "\e[96m")
white=$(echo -en "\e[39m")
INI_FILE="${HOME}/.kiauh.ini"
LOGFILE="/tmp/kiauh.log"
BACKUP_DIR="${HOME}/kiauh-backups"
#================== KLIPPER ===================#
KLIPPY_ENV="${HOME}/klippy-env"
KLIPPER_DIR="${HOME}/klipper"
KLIPPER_REPO="https://github.com/Klipper3d/klipper.git"
KLIPPER_CONFIG="$(get_klipper_cfg_dir)"
#================= MOONRAKER ==================#
MOONRAKER_ENV="${HOME}/moonraker-env"
MOONRAKER_DIR="${HOME}/moonraker"
MOONRAKER_REPO="https://github.com/Arksine/moonraker.git"
#================= MAINSAIL ===================#
MAINSAIL_DIR="${HOME}/mainsail"
MAINSAIL_REPO_API="https://api.github.com/repos/mainsail-crew/mainsail/releases"
MAINSAIL_TAGS="https://api.github.com/repos/mainsail-crew/mainsail/tags"
#================== FLUIDD ====================#
FLUIDD_DIR="${HOME}/fluidd"
FLUIDD_REPO_API="https://api.github.com/repos/fluidd-core/fluidd/releases"
#=============== KLIPPERSCREEN ================#
KLIPPERSCREEN_ENV_DIR="${HOME}/.KlipperScreen-env"
KLIPPERSCREEN_DIR="${HOME}/KlipperScreen"
KLIPPERSCREEN_REPO=https://github.com/jordanruthe/KlipperScreen.git
#================ OCTOPRINT ===================#
OCTOPRINT_ENV="${HOME}/OctoPrint"
#========== MOONRAKER-TELEGRAM-BOT ============#
MOONRAKER_TELEGRAM_BOT_ENV_DIR=${HOME}/moonraker-telegram-bot-env
MOONRAKER_TELEGRAM_BOT_DIR=${HOME}/moonraker-telegram-bot
NLEF_REPO=https://github.com/nlef/moonraker-telegram-bot.git
#=============== PRETTY-GCODE =================#
PGC_FOR_KLIPPER_REPO="https://github.com/Kragrathea/pgcode"
PGC_DIR="${HOME}/pgcode"
}

View File

@@ -11,15 +11,6 @@
set -e
### global variables
SYSTEMD="/etc/systemd/system"
INITD="/etc/init.d"
ETCDEF="/etc/default"
KLIPPY_ENV="${HOME}/klippy-env"
KLIPPER_DIR="${HOME}/klipper"
KLIPPER_REPO="https://github.com/Klipper3d/klipper.git"
KLIPPER_CONFIG="$(get_klipper_cfg_dir)"
#=================================================#
#================ INSTALL KLIPPER ================#
#=================================================#

View File

@@ -11,13 +11,6 @@
set -e
### global variables
SYSTEMD="/etc/systemd/system"
KLIPPERSCREEN_ENV_DIR="${HOME}/.KlipperScreen-env"
KLIPPERSCREEN_DIR="${HOME}/KlipperScreen"
KLIPPERSCREEN_REPO=https://github.com/jordanruthe/KlipperScreen.git
KLIPPER_CONFIG="$(get_klipper_cfg_dir)"
#===================================================#
#============== INSTALL KLIPPERSCREEN ==============#
#===================================================#

View File

@@ -11,12 +11,6 @@
set -e
### global variables
MAINSAIL_DIR="${HOME}/mainsail"
MAINSAIL_REPO_API="https://api.github.com/repos/mainsail-crew/mainsail/releases"
MAINSAIL_TAGS="https://api.github.com/repos/mainsail-crew/mainsail/tags"
KLIPPER_CONFIG="$(get_klipper_cfg_dir)"
#===================================================#
#================= INSTALL MAINSAIL ================#
#===================================================#

View File

@@ -11,8 +11,6 @@
set -e
### base variables
SYSTEMD="/etc/systemd/system"
WEBCAMD_SRC="https://raw.githubusercontent.com/mainsail-crew/MainsailOS/master/src/modules/mjpgstreamer/filesystem/root/usr/local/bin/webcamd"
WEBCAM_TXT_SRC="https://raw.githubusercontent.com/mainsail-crew/MainsailOS/master/src/modules/mjpgstreamer/filesystem/home/pi/klipper_config/webcam.txt"

View File

@@ -11,13 +11,6 @@
set -e
### global variables
SYSTEMD="/etc/systemd/system"
MOONRAKER_TELEGRAM_BOT_ENV_DIR=${HOME}/moonraker-telegram-bot-env
MOONRAKER_TELEGRAM_BOT_DIR=${HOME}/moonraker-telegram-bot
NLEF_REPO=https://github.com/nlef/moonraker-telegram-bot.git
KLIPPER_CONFIG="$(get_klipper_cfg_dir)"
#===================================================#
#=========== REMOVE MOONRAKERTELEGRAMBOT ===========#
#===================================================#

View File

@@ -11,14 +11,6 @@
set -e
### global variables
SYSTEMD="/etc/systemd/system"
INITD="/etc/init.d"
ETCDEF="/etc/default"
MOONRAKER_ENV="${HOME}/moonraker-env"
MOONRAKER_DIR="${HOME}/moonraker"
MOONRAKER_REPO="https://github.com/Arksine/moonraker.git"
#===================================================#
#================ INSTALL MOONRAKER ================#
#===================================================#

View File

@@ -11,10 +11,6 @@
set -e
### global variables
SYSTEMD="/etc/systemd/system"
OCTOPRINT_ENV="${HOME}/OctoPrint"
#=================================================#
#=============== INSTALL OCTOPRINT ===============#
#=================================================#

View File

@@ -11,10 +11,6 @@
set -e
### base variables
PGC_FOR_KLIPPER_REPO="https://github.com/Kragrathea/pgcode"
PGC_DIR="${HOME}/pgcode"
#=================================================#
#================== INSTALL PGC ==================#
#=================================================#

View File

@@ -11,11 +11,6 @@
set -e
### global variables
SYSTEMD="/etc/systemd/system"
INI_FILE="${HOME}/.kiauh.ini"
LOGFILE="/tmp/kiauh.log"
#================================================#
#=================== STARTUP ====================#
#================================================#
@@ -35,11 +30,6 @@ function check_euid(){
#================================================#
#============= MESSAGE FORMATTING ===============#
#================================================#
green=$(echo -en "\e[92m")
yellow=$(echo -en "\e[93m")
red=$(echo -en "\e[91m")
cyan=$(echo -en "\e[96m")
white=$(echo -en "\e[39m")
function select_msg() {
echo -e "${white}>>>>>> $1"