refactor: fix #194

Signed-off-by: Dominik Willner th33xitus@gmail.com
This commit is contained in:
th33xitus
2022-05-14 14:04:39 +02:00
parent 1f6745cc7b
commit 1d16235c24
11 changed files with 21 additions and 21 deletions

View File

@@ -333,7 +333,7 @@ function fluidd_port_check(){
select_fluidd_port
fi
else
DEFAULT_PORT=$(grep listen "${SRCDIR}/kiauh/resources/klipper_webui_nginx.cfg" | head -1 | sed 's/^\s*//' | cut -d" " -f2 | cut -d";" -f1)
DEFAULT_PORT=$(grep listen "${KIAUH_SRCDIR}/resources/klipper_webui_nginx.cfg" | head -1 | sed 's/^\s*//' | cut -d" " -f2 | cut -d";" -f1)
SET_LISTEN_PORT=${DEFAULT_PORT}
fi
SET_NGINX_CFG="true"

View File

@@ -68,7 +68,7 @@ function setup_gcode_shell_command(){
function install_gcode_shell_command(){
do_action_service "stop" "klipper"
status_msg "Copy 'gcode_shell_command.py' to '${KLIPPER_DIR}/klippy/extras' ..."
if cp "${SRCDIR}/kiauh/resources/gcode_shell_command.py" "${KLIPPER_DIR}/klippy/extras"; then
if cp "${KIAUH_SRCDIR}/resources/gcode_shell_command.py" "${KLIPPER_DIR}/klippy/extras"; then
ok_msg "Done!"
else
error_msg "Cannot copy file to target destination...Exiting!"
@@ -102,7 +102,7 @@ function create_example_shell_command() {
path=$(echo "${cfg}" | rev | cut -d"/" -f2- | rev)
if [ ! -f "${path}/shell_command.cfg" ]; then
status_msg "Copy shell_command.cfg to ${path} ..."
cp "${SRCDIR}/kiauh/resources/shell_command.cfg" "${path}"
cp "${KIAUH_SRCDIR}/resources/shell_command.cfg" "${path}"
ok_msg "${path}/shell_command.cfg created!"
### write the include to the very first line of the printer.cfg
sed -i "1 i [include shell_command.cfg]" "${cfg}"

View File

@@ -27,7 +27,7 @@ function set_globals(){
white=$(echo -en "\e[39m")
INI_FILE="${HOME}/.kiauh.ini"
LOGFILE="/tmp/kiauh.log"
RESOURCES="${SRCDIR}/kiauh/resources"
RESOURCES="${KIAUH_SRCDIR}/resources"
BACKUP_DIR="${HOME}/kiauh-backups"
#================== KLIPPER ===================#

View File

@@ -250,7 +250,7 @@ function klipper_setup(){
function write_klipper_service(){
local i=${1} cfg=${2} log=${3} printer=${4} uds=${5} service=${6}
local service_template="${SRCDIR}/kiauh/resources/klipper.service"
local service_template="${KIAUH_SRCDIR}/resources/klipper.service"
### replace all placeholders
if [ ! -f "${service}" ]; then
status_msg "Creating Klipper Service ${i} ..."
@@ -264,7 +264,7 @@ function write_klipper_service(){
function write_example_printer_cfg(){
local cfg_dir=${1} cfg=${2}
local cfg_template="${SRCDIR}/kiauh/resources/printer.cfg"
local cfg_template="${KIAUH_SRCDIR}/resources/printer.cfg"
### create a config directory if it doesn't exist
if ! [[ -d "${cfg_dir}" ]]; then

View File

@@ -449,7 +449,7 @@ function mainsail_port_check(){
select_mainsail_port
fi
else
DEFAULT_PORT=$(grep listen "${SRCDIR}/kiauh/resources/klipper_webui_nginx.cfg" | head -1 | sed 's/^\s*//' | cut -d" " -f2 | cut -d";" -f1)
DEFAULT_PORT=$(grep listen "${KIAUH_SRCDIR}/resources/klipper_webui_nginx.cfg" | head -1 | sed 's/^\s*//' | cut -d" " -f2 | cut -d";" -f1)
SET_LISTEN_PORT=${DEFAULT_PORT}
fi
SET_NGINX_CFG="true"

View File

@@ -19,7 +19,7 @@ function install_mjpg-streamer(){
local webcamd="https://raw.githubusercontent.com/mainsail-crew/MainsailOS/master/src/modules/mjpgstreamer/filesystem/root/usr/local/bin/webcamd"
local webcam_txt="https://raw.githubusercontent.com/mainsail-crew/MainsailOS/master/src/modules/mjpgstreamer/filesystem/home/pi/klipper_config/webcam.txt"
local repo="https://github.com/jacksonliam/mjpg-streamer.git"
local service="${SRCDIR}/kiauh/resources/webcamd.service"
local service="${KIAUH_SRCDIR}/resources/webcamd.service"
### return early if webcamd.service already exists
if [ -f "${SYSTEMD}/webcamd.service" ]; then

View File

@@ -260,7 +260,7 @@ function create_telegram_bot_service(){
function write_telegram_bot_service(){
local i=${1} cfg=${2} service=${3}
local service_template="${SRCDIR}/kiauh/resources/moonraker-telegram-bot.service"
local service_template="${KIAUH_SRCDIR}/resources/moonraker-telegram-bot.service"
### replace all placeholders
if ! [[ -f "${service}" ]]; then

View File

@@ -239,7 +239,7 @@ function create_moonraker_conf(){
function write_moonraker_conf(){
local cfg_dir=${1} cfg=${2} port=${3} log=${4} db=${5} uds=${6} lan=${7}
local conf_template="${SRCDIR}/kiauh/resources/moonraker.conf"
local conf_template="${KIAUH_SRCDIR}/resources/moonraker.conf"
[ ! -d "${cfg_dir}" ] && mkdir -p "${cfg_dir}"
if [ ! -f "${cfg}" ]; then
@@ -310,7 +310,7 @@ function create_moonraker_service(){
function write_moonraker_service(){
local i=${1} cfg_dir=${2} cfg=${3} log=${4} service=${5}
local service_template="${SRCDIR}/kiauh/resources/moonraker.service"
local service_template="${KIAUH_SRCDIR}/resources/moonraker.service"
### replace all placeholders
if [ ! -f "${service}" ]; then

View File

@@ -12,11 +12,11 @@
set -e
function change_klipper_repo_menu(){
local repo_file="${SRCDIR}/kiauh/klipper_repos.txt"
local repo_file="${KIAUH_SRCDIR}/klipper_repos.txt"
local repo branch repos=() branches=()
if [[ ! -f ${repo_file} ]]; then
print_error "File not found:\n '${SRCDIR}/kiauh/klipper_repos.txt'"
print_error "File not found:\n '${KIAUH_SRCDIR}/klipper_repos.txt'"
return
fi

View File

@@ -31,7 +31,7 @@ function main_ui(){
function get_kiauh_version(){
local version
cd "${SRCDIR}/kiauh"
cd "${KIAUH_SRCDIR}"
version="$(git describe HEAD --always --tags | cut -d "-" -f 1,2)"
echo "${version}"
}