mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-15 03:24:29 +05:00
fix: use new method to locate printer.cfg, rework depending functions
This commit is contained in:
1
kiauh.sh
1
kiauh.sh
@@ -34,7 +34,6 @@ OCTOPRINT_SERVICE2=/etc/default/octoprint
|
||||
#misc
|
||||
INI_FILE=${HOME}/kiauh/kiauh.ini
|
||||
BACKUP_DIR=${HOME}/kiauh-backups
|
||||
PRINTER_CFG=${HOME}/printer.cfg
|
||||
|
||||
### set github repos
|
||||
KLIPPER_REPO=https://github.com/KevinOConnor/klipper.git
|
||||
|
||||
@@ -11,6 +11,20 @@ check_euid(){
|
||||
fi
|
||||
}
|
||||
|
||||
locate_printer_cfg(){
|
||||
if [ -f $KLIPPER_SERVICE2 ]; then
|
||||
#reads /etc/default/klipper and gets the default printer.cfg location
|
||||
PRINTER_CFG_LOC=$(grep "KLIPPY_ARGS=" /etc/default/klipper | cut -d" " -f2)
|
||||
if [ -e $PRINTER_CFG_LOC ]; then
|
||||
PRINTER_CFG=$(readlink -e $PRINTER_CFG_LOC)
|
||||
else
|
||||
PRINTER_CFG=""
|
||||
fi
|
||||
else
|
||||
PRINTER_CFG=""
|
||||
fi
|
||||
}
|
||||
|
||||
source_ini(){
|
||||
source ${HOME}/kiauh/kiauh.ini
|
||||
}
|
||||
|
||||
@@ -4,9 +4,7 @@ install_dwc2(){
|
||||
#ask user for customization
|
||||
get_user_selections_dwc2
|
||||
#dwc2 main installation
|
||||
check_for_folder_dwc2
|
||||
tornado_setup
|
||||
dwc2fk_setup
|
||||
dwc2_setup
|
||||
#setup config
|
||||
write_printer_cfg_dwc2
|
||||
@@ -25,10 +23,11 @@ install_dwc2(){
|
||||
system_check_dwc2(){
|
||||
status_msg "Initializing DWC2 installation ..."
|
||||
stop_klipper
|
||||
check_for_folder_dwc2
|
||||
#check for existing printer.cfg
|
||||
if [ -e ${HOME}/printer.cfg ]; then
|
||||
locate_printer_cfg
|
||||
if [ ! -z $PRINTER_CFG ]; then
|
||||
PRINTER_CFG_FOUND="true"
|
||||
PRINTER_CFG_LOC="${HOME}/printer.cfg"
|
||||
else
|
||||
PRINTER_CFG_FOUND="false"
|
||||
fi
|
||||
@@ -59,8 +58,8 @@ get_user_selections_dwc2(){
|
||||
echo -e "| option or error will prevent DWC2 from loading and |"
|
||||
echo -e "| you need to check klippy.log to resolve the error. |"
|
||||
echo -e "| |"
|
||||
echo -e "| Neither option 1 or 2 of this script will create a |"
|
||||
echo -e "| fully working printer.cfg for you! |"
|
||||
echo -e "| ${red}Neither option 1 or 2 of this script will create a |"
|
||||
echo -e "| fully working printer.cfg for you!${default} |"
|
||||
hr
|
||||
echo -e "| 1) [Create default configuration] |"
|
||||
echo -e "| 2) [Create custom configuration] |"
|
||||
@@ -142,32 +141,40 @@ tornado_setup(){
|
||||
fi
|
||||
}
|
||||
|
||||
dwc2fk_setup(){
|
||||
dwc2_setup(){
|
||||
#check dependencies
|
||||
dep=(git wget gzip tar curl)
|
||||
dependency_check
|
||||
#get dwc2-for-klipper
|
||||
cd ${HOME}
|
||||
status_msg "Cloning DWC2-for-Klipper repository ..."
|
||||
git clone $DWC2FK_REPO && ok_msg "DWC2-for-Klipper successfully cloned!"
|
||||
git clone $DWC2FK_REPO
|
||||
ok_msg "DWC2-for-Klipper successfully cloned!"
|
||||
#create a web_dwc2.py symlink if not already existing
|
||||
if [ -d $KLIPPER_DIR/klippy/extras ] && [ ! -e $KLIPPER_DIR/klippy/extras/web_dwc2.py ]; then
|
||||
status_msg "Creating web_dwc2.py Symlink ..."
|
||||
ln -s $DWC2FK_DIR/web_dwc2.py $KLIPPER_DIR/klippy/extras/web_dwc2.py && ok_msg "Symlink created!"
|
||||
ln -s $DWC2FK_DIR/web_dwc2.py $KLIPPER_DIR/klippy/extras/web_dwc2.py
|
||||
ok_msg "Symlink created!"
|
||||
fi
|
||||
}
|
||||
|
||||
dwc2_setup(){
|
||||
#check dependencies
|
||||
dep=(wget gzip tar curl)
|
||||
dependency_check
|
||||
#execute operation
|
||||
#get Duet Web Control
|
||||
GET_DWC2_URL=`curl -s https://api.github.com/repositories/28820678/releases/latest | grep browser_download_url | cut -d'"' -f4`
|
||||
cd $DWC2_DIR/web
|
||||
status_msg "Downloading DWC2 Web UI ..."
|
||||
wget -q $GET_DWC2_URL && ok_msg "Download complete!"
|
||||
wget -q $GET_DWC2_URL
|
||||
ok_msg "Download complete!"
|
||||
status_msg "Unzipping archive ..."
|
||||
unzip -q -o *.zip && for f_ in $(find . | grep '.gz');do gunzip -f ${f_};done && ok_msg "Done!"
|
||||
status_msg "Writing version to file ..."
|
||||
echo $GET_DWC2_URL | cut -d/ -f8 > $DWC2_DIR/web/version && ok_msg "Done!"
|
||||
unzip -q -o *.zip
|
||||
for f_ in $(find . | grep '.gz')
|
||||
do
|
||||
gunzip -f ${f_}
|
||||
done
|
||||
ok_msg "Done!"
|
||||
status_msg "Writing DWC version to file ..."
|
||||
echo $GET_DWC2_URL | cut -d/ -f8 > $DWC2_DIR/web/version
|
||||
ok_msg "Done!"
|
||||
status_msg "Do a little cleanup ..."
|
||||
rm -rf DuetWebControl-SD.zip && ok_msg "Done!"
|
||||
rm -rf DuetWebControl-SD.zip
|
||||
ok_msg "Done!"
|
||||
ok_msg "DWC2 Web UI installed!"
|
||||
}
|
||||
|
||||
@@ -182,27 +189,31 @@ setup_printer_config_dwc2(){
|
||||
fi
|
||||
if [ "$SEL_DEF_CFG" = "true" ]; then
|
||||
create_default_dwc2_printer_cfg
|
||||
locate_printer_cfg
|
||||
fi
|
||||
if [ "$SEL_CUS_CFG" = "true" ]; then
|
||||
#get user input for custom config
|
||||
create_custom_dwc2_printer_cfg
|
||||
locate_printer_cfg
|
||||
fi
|
||||
}
|
||||
|
||||
read_printer_cfg_dwc2(){
|
||||
unset SC_ENTRY
|
||||
SC="#*# <---------------------- SAVE_CONFIG ---------------------->"
|
||||
if [ ! $(grep '^\[virtual_sdcard\]$' ${HOME}/printer.cfg) ]; then
|
||||
if [ ! $(grep '^\[virtual_sdcard\]$' $PRINTER_CFG) ]; then
|
||||
VSD="false"
|
||||
fi
|
||||
if [ ! $(grep '^\[web_dwc2\]$' ${HOME}/printer.cfg) ]; then
|
||||
if [ ! $(grep '^\[web_dwc2\]$' $PRINTER_CFG) ]; then
|
||||
WEB_DWC2="false"
|
||||
fi
|
||||
#check for a SAVE_CONFIG entry
|
||||
if [[ $(grep "$SC" ${HOME}/printer.cfg) ]]; then
|
||||
SC_LINE=$(grep -n "$SC" ${HOME}/printer.cfg | cut -d ":" -f1)
|
||||
if [[ $(grep "$SC" $PRINTER_CFG) ]]; then
|
||||
SC_LINE=$(grep -n "$SC" $PRINTER_CFG | cut -d ":" -f1)
|
||||
PRE_SC_LINE=$(expr $SC_LINE - 1)
|
||||
SC_ENTRY="true"
|
||||
else
|
||||
SC_ENTRY="false"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -224,30 +235,32 @@ write_printer_cfg_dwc2(){
|
||||
PRE_SC_LINE="$(expr $SC_LINE - 1)a"
|
||||
for entry in "${write_entries[@]}"
|
||||
do
|
||||
sed -i "$PRE_SC_LINE $entry" ${HOME}/printer.cfg
|
||||
sed -i "$PRE_SC_LINE $entry" $PRINTER_CFG
|
||||
done
|
||||
fi
|
||||
if [ "$SC_ENTRY" = "false" ]; then
|
||||
LINE_COUNT="$(wc -l < ${HOME}/printer.cfg)a"
|
||||
LINE_COUNT="$(wc -l < $PRINTER_CFG)a"
|
||||
for entry in "${write_entries[@]}"
|
||||
do
|
||||
sed -i "$LINE_COUNT $entry" ${HOME}/printer.cfg
|
||||
sed -i "$LINE_COUNT $entry" $PRINTER_CFG
|
||||
done
|
||||
fi
|
||||
ok_msg "Done!"
|
||||
}
|
||||
|
||||
write_custom_printer_cfg_dwc2(){
|
||||
if [ "$CONFIRM_CUSTOM_CFG" = "true" ]; then
|
||||
echo -e "$DWC2_CFG" >> ${HOME}/printer.cfg
|
||||
#create custom config
|
||||
if [ "$PRINTER_CFG_FOUND" = "false" ] && [ "$CONFIRM_CUSTOM_CFG" = "true" ]; then
|
||||
touch $PRINTER_CFG
|
||||
echo -e "$DWC2_CFG" >> $PRINTER_CFG
|
||||
fi
|
||||
}
|
||||
|
||||
create_default_dwc2_printer_cfg(){
|
||||
#create default config
|
||||
touch ${HOME}/printer.cfg
|
||||
cat <<DEFAULT_DWC2_CFG >> ${HOME}/printer.cfg
|
||||
|
||||
#create default config
|
||||
if [ "$PRINTER_CFG_FOUND" = "false" ] && [ "$SEL_CUS_CFG" = "true" ]; then
|
||||
touch $PRINTER_CFG
|
||||
cat <<DEFAULT_DWC2_CFG >> $PRINTER_CFG
|
||||
##########################
|
||||
### CREATED WITH KIAUH ###
|
||||
##########################
|
||||
@@ -267,8 +280,8 @@ listen_adress: 0.0.0.0
|
||||
listen_port: 4750
|
||||
web_path: dwc2/web
|
||||
##########################
|
||||
##########################
|
||||
DEFAULT_DWC2_CFG
|
||||
fi
|
||||
}
|
||||
|
||||
#############################################################
|
||||
@@ -288,7 +301,6 @@ create_custom_dwc2_printer_cfg(){
|
||||
read -e -p "Web path: " -i "dwc2/web" WEB_PATH
|
||||
echo -e "${default}"
|
||||
DWC2_CFG=$(cat <<DWC2
|
||||
|
||||
##########################
|
||||
### CREATED WITH KIAUH ###
|
||||
##########################
|
||||
@@ -301,7 +313,6 @@ listen_adress: $LISTEN_ADRESS
|
||||
listen_port: $LISTEN_PORT
|
||||
web_path: $WEB_PATH
|
||||
##########################
|
||||
##########################
|
||||
DWC2
|
||||
)
|
||||
echo "The following lines will be written:"
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
install_mainsail(){
|
||||
if [ "$INST_MAINSAIL" = "true" ]; then
|
||||
if [ -d $KLIPPER_DIR ]; then
|
||||
disable_haproxy_lighttpd
|
||||
unset SET_REVERSE_PROXY && SET_REVERSE_PROXY="true" #quick and dirty hack to make mainsail reverse proxy install, needs polish
|
||||
create_reverse_proxy "mainsail"
|
||||
mainsail_setup
|
||||
test_nginx
|
||||
ok_msg "Mainsail installation complete!"; echo
|
||||
else
|
||||
ERROR_MSG=" Please install Klipper first!\n Skipping..."
|
||||
fi
|
||||
disable_haproxy_lighttpd
|
||||
unset SET_REVERSE_PROXY && SET_REVERSE_PROXY="true" #quick and dirty hack to make mainsail reverse proxy install, needs polish
|
||||
create_reverse_proxy "mainsail"
|
||||
mainsail_setup
|
||||
test_nginx
|
||||
ok_msg "Mainsail installation complete!"; echo
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -10,30 +10,31 @@ install_moonraker(){
|
||||
setup_moonraker_conf
|
||||
#execute customizations
|
||||
write_custom_trusted_clients
|
||||
symlink_moonraker_log
|
||||
symlinks_moonraker
|
||||
disable_octoprint
|
||||
install_mainsail
|
||||
set_hostname
|
||||
#after install actions
|
||||
restart_moonraker
|
||||
restart_klipper
|
||||
test_api
|
||||
install_mainsail
|
||||
}
|
||||
|
||||
system_check_moonraker(){
|
||||
status_msg "Initializing Moonraker installation ..."
|
||||
#check for existing printer.cfg and for the location
|
||||
if [ ! -e ${HOME}/printer.cfg ] && [ ! -e ${HOME}/klipper_config/printer.cfg ]; then
|
||||
PRINTER_CFG_FOUND="false"
|
||||
locate_printer_cfg
|
||||
if [ ! -z $PRINTER_CFG ]; then
|
||||
PRINTER_CFG_FOUND="true"
|
||||
PRINTER_CFG_LOC=$PRINTER_CFG
|
||||
else
|
||||
if [ -f ${HOME}/printer.cfg ]; then
|
||||
PRINTER_CFG_FOUND="true"
|
||||
PRINTER_CFG_LOC="${HOME}/printer.cfg"
|
||||
fi
|
||||
if [ -f ${HOME}/klipper_config/printer.cfg ]; then
|
||||
PRINTER_CFG_FOUND="true"
|
||||
PRINTER_CFG_LOC="${HOME}/klipper_config/printer.cfg"
|
||||
fi
|
||||
PRINTER_CFG_FOUND="false"
|
||||
fi
|
||||
#check for existing klippy.log symlink in /klipper_config
|
||||
if [ ! -e ${HOME}/klipper_config/klippy.log ]; then
|
||||
KLIPPY_SL_FOUND="false"
|
||||
else
|
||||
KLIPPY_SL_FOUND="true"
|
||||
fi
|
||||
#check for existing moonraker.log symlink in /klipper_config
|
||||
if [ ! -e ${HOME}/klipper_config/moonraker.log ]; then
|
||||
@@ -86,7 +87,15 @@ get_user_selections_moonraker(){
|
||||
unset SEL_DEF_CFG
|
||||
while true; do
|
||||
echo
|
||||
warn_msg "No printer.cfg found!"
|
||||
top_border
|
||||
echo -e "| ${red}WARNING! - No printer.cfg was found!${default} |"
|
||||
hr
|
||||
echo -e "| KIAUH can create a minimal printer.cfg with only the |"
|
||||
echo -e "| necessary Mainsail config entries if you wish. |"
|
||||
echo -e "| |"
|
||||
echo -e "| Please be aware, that this option will ${red}NOT${default} create a |"
|
||||
echo -e "| fully working printer.cfg for you! |"
|
||||
bottom_border
|
||||
read -p "${cyan}###### Create a default printer.cfg? (Y/n):${default} " yn
|
||||
case "$yn" in
|
||||
Y|y|Yes|yes|"")
|
||||
@@ -100,6 +109,22 @@ get_user_selections_moonraker(){
|
||||
done
|
||||
fi
|
||||
#user selection for moonraker.log symlink
|
||||
if [ "$KLIPPY_SL_FOUND" = "false" ]; then
|
||||
while true; do
|
||||
echo
|
||||
read -p "${cyan}###### Create klippy.log symlink? (Y/n):${default} " yn
|
||||
case "$yn" in
|
||||
Y|y|Yes|yes|"")
|
||||
echo -e "###### > Yes"
|
||||
SEL_KLIPPYLOG_SL="true";;
|
||||
N|n|No|no)
|
||||
echo -e "###### > No"
|
||||
SEL_KLIPPYLOG_SL="false";;
|
||||
esac
|
||||
break
|
||||
done
|
||||
fi
|
||||
#user selection for moonraker.log symlink
|
||||
if [ "$MOONRAKER_SL_FOUND" = "false" ]; then
|
||||
while true; do
|
||||
echo
|
||||
@@ -142,10 +167,10 @@ get_user_selections_moonraker(){
|
||||
case "$yn" in
|
||||
Y|y|Yes|yes|"")
|
||||
echo -e "###### > Yes"
|
||||
ADD_MAINSAIL_MACROS="true";;
|
||||
ADD_MS_MCAROS="true";;
|
||||
N|n|No|no)
|
||||
echo -e "###### > No"
|
||||
ADD_MAINSAIL_MACROS="false";;
|
||||
ADD_MS_MCAROS="false";;
|
||||
esac
|
||||
break
|
||||
done
|
||||
@@ -211,17 +236,14 @@ check_for_folder_moonraker(){
|
||||
setup_printer_config_mainsail(){
|
||||
if [ "$PRINTER_CFG_FOUND" = "true" ]; then
|
||||
backup_printer_cfg
|
||||
if [ "$PRINTER_CFG_LOC" != "${HOME}/klipper_config/printer.cfg" ]; then
|
||||
status_msg "Moving printer.cfg to ~/klipper_config ..."
|
||||
mv $PRINTER_CFG_LOC ${HOME}/klipper_config
|
||||
#create a printer.cfg symlink to make it accessible
|
||||
#in the mainsail config editor if the printer.cfg is not
|
||||
#located in klipper_config by default
|
||||
if [ "$PRINTER_CFG" != "${HOME}/klipper_config/printer.cfg" ] && [ ! -f ${HOME}/klipper_config/printer.cfg ]; then
|
||||
status_msg "Create printer.cfg symlink ..."
|
||||
ln -s $PRINTER_CFG ${HOME}/klipper_config
|
||||
ok_msg "Done!"
|
||||
fi
|
||||
status_msg "Create symlink in home directory ..."
|
||||
if [ -f ${HOME}/printer.cfg ]; then
|
||||
mv ${HOME}/printer.cfg ${HOME}/printer_old.cfg
|
||||
fi
|
||||
ln -s ${HOME}/klipper_config/printer.cfg ${HOME}
|
||||
ok_msg "Done!"
|
||||
#check printer.cfg for necessary mainsail entries
|
||||
read_printer_cfg_mainsail
|
||||
write_printer_cfg_mainsail
|
||||
@@ -233,7 +255,7 @@ setup_printer_config_mainsail(){
|
||||
ok_msg "Done!"
|
||||
fi
|
||||
#copy mainsail_macro.cfg
|
||||
if [ "$ADD_MAINSAIL_MACROS" = "true" ]; then
|
||||
if [ "$ADD_MS_MCAROS" = "true" ]; then
|
||||
status_msg "Create mainsail_macros.cfg ..."
|
||||
if [ ! -f ${HOME}/klipper_config/mainsail_macros.cfg ]; then
|
||||
cp ${HOME}/kiauh/resources/mainsail_macros.cfg ${HOME}/klipper_config
|
||||
@@ -246,26 +268,31 @@ setup_printer_config_mainsail(){
|
||||
|
||||
read_printer_cfg_mainsail(){
|
||||
SC="#*# <---------------------- SAVE_CONFIG ---------------------->"
|
||||
if [ ! $(grep '^\[virtual_sdcard\]$' ${HOME}/klipper_config/printer.cfg) ]; then
|
||||
if [ ! $(grep '^\[virtual_sdcard\]$' $PRINTER_CFG) ]; then
|
||||
VSD="false"
|
||||
fi
|
||||
if [ ! $(grep '^\[pause_resume\]$' ${HOME}/klipper_config/printer.cfg) ]; then
|
||||
if [ ! $(grep '^\[pause_resume\]$' $PRINTER_CFG) ]; then
|
||||
PAUSE_RESUME="false"
|
||||
fi
|
||||
if [ ! $(grep '^\[display_status\]$' ${HOME}/klipper_config/printer.cfg) ]; then
|
||||
if [ ! $(grep '^\[display_status\]$' $PRINTER_CFG) ]; then
|
||||
DISPLAY_STATUS="false"
|
||||
fi
|
||||
if [ ! "$(grep '^\[include klipper_config\/mainsail_macros\.cfg\]$' $PRINTER_CFG)" ]; then
|
||||
MS_MACRO="false"
|
||||
fi
|
||||
#check for a SAVE_CONFIG entry
|
||||
if [[ $(grep "$SC" ${HOME}/klipper_config/printer.cfg) ]]; then
|
||||
SC_LINE=$(grep -n "$SC" ${HOME}/klipper_config/printer.cfg | cut -d ":" -f1)
|
||||
if [[ $(grep "$SC" $PRINTER_CFG) ]]; then
|
||||
SC_LINE=$(grep -n "$SC" $PRINTER_CFG | cut -d ":" -f1)
|
||||
PRE_SC_LINE=$(expr $SC_LINE - 1)
|
||||
SC_ENTRY="true"
|
||||
else
|
||||
SC_ENTRY="false"
|
||||
fi
|
||||
}
|
||||
|
||||
write_printer_cfg_mainsail(){
|
||||
unset write_entries
|
||||
if [ "$ADD_MAINSAIL_MACROS" = "true" ]; then
|
||||
if [ "$MS_MACRO" = "false" ] && [ "$ADD_MS_MCAROS" = "true" ]; then
|
||||
write_entries+=("[include klipper_config/mainsail_macros.cfg]")
|
||||
fi
|
||||
if [ "$PAUSE_RESUME" = "false" ]; then
|
||||
@@ -287,14 +314,14 @@ write_printer_cfg_mainsail(){
|
||||
PRE_SC_LINE="$(expr $SC_LINE - 1)a"
|
||||
for entry in "${write_entries[@]}"
|
||||
do
|
||||
sed -i "$PRE_SC_LINE $entry" ${HOME}/klipper_config/printer.cfg
|
||||
sed -i "$PRE_SC_LINE $entry" $PRINTER_CFG
|
||||
done
|
||||
fi
|
||||
if [ "$SC_ENTRY" = "false" ]; then
|
||||
LINE_COUNT="$(wc -l < ${HOME}/klipper_config/printer.cfg)a"
|
||||
LINE_COUNT="$(wc -l < $PRINTER_CFG)a"
|
||||
for entry in "${write_entries[@]}"
|
||||
do
|
||||
sed -i "$LINE_COUNT $entry" ${HOME}/klipper_config/printer.cfg
|
||||
sed -i "$LINE_COUNT $entry" $PRINTER_CFG
|
||||
done
|
||||
fi
|
||||
ok_msg "Done!"
|
||||
@@ -358,7 +385,7 @@ write_default_trusted_clients(){
|
||||
#write the ip range in the first line below "trusted clients"
|
||||
#example: 192.168.1.0/24
|
||||
sed -i "/trusted_clients\:/a \ \ \ \ $DEFAULT_IP_RANGE" ${HOME}/moonraker.conf
|
||||
ok_msg "IP range of ${cyan}$DEFAULT_IP_RANGE${default} written to moonraker.conf!"
|
||||
ok_msg "IP range of ● $DEFAULT_IP_RANGE written to moonraker.conf!"
|
||||
}
|
||||
|
||||
#############################################################
|
||||
@@ -431,11 +458,17 @@ write_custom_trusted_clients(){
|
||||
fi
|
||||
}
|
||||
|
||||
symlink_moonraker_log(){
|
||||
#create a moonraker.log symlink in klipper_config-dir just for convenience
|
||||
if [ "$SEL_MRLOG_SL" = "true" ]; then
|
||||
symlinks_moonraker(){
|
||||
#create a klippy.log/moonraker.log symlink in
|
||||
#klipper_config-dir just for convenience
|
||||
if [ "$SEL_KLIPPYLOG_SL" = "true" ] && [ ! -e ${HOME}/klipper_config/klippy.log ]; then
|
||||
status_msg "Creating klippy.log symlink ..."
|
||||
ln -s /tmp/klippy.log ${HOME}/klipper_config
|
||||
ok_msg "Symlink created!"
|
||||
fi
|
||||
if [ "$SEL_MRLOG_SL" = "true" ] && [ ! -e ${HOME}/klipper_config/moonraker.log ]; then
|
||||
status_msg "Creating moonraker.log symlink ..."
|
||||
ln -s /tmp/moonraker.log ${HOME}/klipper_config/moonraker.log
|
||||
ln -s /tmp/moonraker.log ${HOME}/klipper_config
|
||||
ok_msg "Symlink created!"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -67,6 +67,7 @@ remove_moonraker(){
|
||||
${HOME}/moonraker.conf
|
||||
${HOME}/moonraker.log
|
||||
${HOME}/klipper_config/moonraker.log
|
||||
${HOME}/klipper_config/klippy.log
|
||||
${HOME}/.klippy_api_key
|
||||
${HOME}/.moonraker_api_key
|
||||
)
|
||||
@@ -89,17 +90,10 @@ remove_moonraker(){
|
||||
status_msg "Removing moonraker.conf ..."
|
||||
rm -rf ${HOME}/moonraker.conf && ok_msg "File removed!"
|
||||
fi
|
||||
#remove printer.cfg symlink, copy printer.cfg back into home dir
|
||||
if [ -L ${HOME}/printer.cfg ]; then
|
||||
status_msg "Removing printer.cfg symlink ..."
|
||||
rm -rf ${HOME}/printer.cfg && ok_msg "Symlink removed!"
|
||||
status_msg "Copy printer.cfg back into '${HOME}' ..."
|
||||
cp ${HOME}/klipper_config/printer.cfg ${HOME} && ok_msg "File copied!"
|
||||
fi
|
||||
#remove moonraker.log and symlink
|
||||
if [[ -L ${HOME}/moonraker.log || -L ${HOME}/klipper_config/moonraker.log || -e /tmp/moonraker.log ]]; then
|
||||
status_msg "Removing moonraker.log and Symlink ..."
|
||||
rm -rf ${HOME}/moonraker.log ${HOME}/klipper_config/moonraker.log /tmp/moonraker.log
|
||||
if [[ -L ${HOME}/moonraker.log || -L ${HOME}/klipper_config/moonraker.log || -L ${HOME}/klipper_config/klippy.log || -e /tmp/moonraker.log ]]; then
|
||||
status_msg "Removing Logs and Symlinks ..."
|
||||
rm -rf ${HOME}/moonraker.log ${HOME}/klipper_config/moonraker.log ${HOME}/klipper_config/klippy.log /tmp/moonraker.log
|
||||
ok_msg "Files removed!"
|
||||
fi
|
||||
#remove legacy api key
|
||||
|
||||
Reference in New Issue
Block a user