mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-15 03:24:29 +05:00
fix: check via md5sum of requirements text file if an update of the python env is necessary. if yes, do that update automatically. no user interaction anymore.
This commit is contained in:
@@ -67,22 +67,31 @@ update_klipper(){
|
|||||||
save_klipper_state
|
save_klipper_state
|
||||||
status_msg "Updating $GET_BRANCH"
|
status_msg "Updating $GET_BRANCH"
|
||||||
cd $KLIPPER_DIR
|
cd $KLIPPER_DIR
|
||||||
|
KLIPPER_OLDREQ_MD5SUM="$(md5sum $KLIPPER_DIR/scripts/klippy-requirements.txt | cut -d " " -f1)"
|
||||||
|
|
||||||
if [ "$DETACHED_HEAD" == "true" ]; then
|
if [ "$DETACHED_HEAD" == "true" ]; then
|
||||||
git checkout $GET_BRANCH
|
git checkout $GET_BRANCH
|
||||||
unset DETACHED_HEAD
|
unset DETACHED_HEAD
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
### pull latest files from github
|
||||||
git pull && ok_msg "Update successfull!"
|
git pull && ok_msg "Update successfull!"
|
||||||
|
|
||||||
#check for possible new dependencies and install them
|
### check for possible new dependencies and install them
|
||||||
status_msg "Checking for possible new dependencies ..."
|
if [[ $(md5sum $KLIPPER_DIR/scripts/klippy-requirements.txt | cut -d " " -f1) != $KLIPPER_OLDREQ_MD5SUM ]]; then
|
||||||
PKGLIST=$(grep "PKGLIST=" ~/klipper/scripts/install-octopi.sh | cut -d'"' -f2- | cut -d'"' -f1 | cut -d"}" -f2)
|
|
||||||
PYTHONDIR="${HOME}/klippy-env"
|
PYTHONDIR="${HOME}/klippy-env"
|
||||||
sudo apt-get update && sudo apt-get install --yes $PKGLIST
|
status_msg "New dependecies detected..."
|
||||||
$PYTHONDIR/bin/pip install -r ~/klipper/scripts/klippy-requirements.txt
|
|
||||||
ok_msg "Dependencies already met or have been installed!"
|
### always rebuild the pythondir from scratch if new dependencies were detected
|
||||||
|
rm -rf ${PYTHONDIR}
|
||||||
|
virtualenv -p python2 ${PYTHONDIR}
|
||||||
|
$PYTHONDIR/bin/pip install -r $KLIPPER_DIR/scripts/klippy-requirements.txt
|
||||||
|
ok_msg "Dependencies have been installed!"
|
||||||
|
fi
|
||||||
|
|
||||||
ok_msg "Update complete!"
|
ok_msg "Update complete!"
|
||||||
fi
|
fi
|
||||||
klipper_service "start"
|
klipper_service "restart"
|
||||||
}
|
}
|
||||||
|
|
||||||
update_dwc2fk(){
|
update_dwc2fk(){
|
||||||
@@ -116,51 +125,27 @@ update_fluidd(){
|
|||||||
update_moonraker(){
|
update_moonraker(){
|
||||||
bb4u "moonraker"
|
bb4u "moonraker"
|
||||||
status_msg "Updating Moonraker ..."
|
status_msg "Updating Moonraker ..."
|
||||||
while true; do
|
moonraker_service "stop"; echo
|
||||||
echo
|
cd $MOONRAKER_DIR
|
||||||
top_border
|
MOONRAKER_OLDREQ_MD5SUM=$(md5sum $MOONRAKER_DIR/scripts/moonraker-requirements.txt | cut -d " " -f1)
|
||||||
echo -e "| You can now choose how you want to update Moonraker. |"
|
|
||||||
blank_line
|
### pull latest files from github
|
||||||
echo -e "| Changes made to the Moonraker code and/or its depen- |"
|
git pull && ok_msg "Update successfull!"
|
||||||
echo -e "| dencies might require a rebuild of the python virtual |"
|
|
||||||
echo -e "| environment or downloading of additional packages. |"
|
### check for possible new dependencies and install them
|
||||||
blank_line
|
if [[ $(md5sum $MOONRAKER_DIR/scripts/moonraker-requirements.txt | cut -d " " -f1) != $MOONRAKER_OLDREQ_MD5SUM ]]; then
|
||||||
echo -e "| ${red}Check the docs in the Moonraker repository to see if${default} |"
|
PYTHONDIR="${HOME}/moonraker-env"
|
||||||
echo -e "| ${red}rebuilding is necessary (user_changes.md)!${default} |"
|
status_msg "New dependecies detected..."
|
||||||
blank_line
|
### always rebuild the pythondir from scratch if new dependencies were detected
|
||||||
echo -e "| 1) Update Moonraker (default) |"
|
rm -rf ${PYTHONDIR}
|
||||||
echo -e "| 2) Update Moonraker + rebuild virtualenv/dependencies |"
|
virtualenv -p /usr/bin/python3 ${PYTHONDIR}
|
||||||
quit_footer
|
ln -s /usr/lib/python3/dist-packages/gpiod* ${PYTHONDIR}/lib/python*/site-packages
|
||||||
read -p "${cyan}###### Please choose:${default} " action
|
${PYTHONDIR}/bin/pip install -r $MOONRAKER_DIR/scripts/moonraker-requirements.txt
|
||||||
case "$action" in
|
ok_msg "Dependencies have been installed!"
|
||||||
1|"")
|
|
||||||
echo -e "###### > Update Moonraker"
|
|
||||||
update_mr="true" && rebuild_env="false"
|
|
||||||
break;;
|
|
||||||
2)
|
|
||||||
echo -e "###### > Update Moonraker + rebuild virtualenv/dependencies"
|
|
||||||
update_mr="true" && rebuild_env="true"
|
|
||||||
break;;
|
|
||||||
Q|q)
|
|
||||||
clear; update_menu; break;;
|
|
||||||
*)
|
|
||||||
print_unkown_cmd
|
|
||||||
print_msg && clear_msg;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
stop_moonraker; echo
|
|
||||||
if [[ $update_mr = "true" ]] && [[ $rebuild_env = "false" ]]; then
|
|
||||||
unset update_mr && unset rebuild_env
|
|
||||||
cd $MOONRAKER_DIR && git pull
|
|
||||||
fi
|
fi
|
||||||
if [[ $update_mr = "true" ]] && [[ $rebuild_env = "true" ]]; then
|
|
||||||
unset update_mr && unset rebuild_env
|
|
||||||
cd $MOONRAKER_DIR && git pull && ./scripts/install-moonraker.sh -r
|
|
||||||
fi
|
|
||||||
#read printer.cfg location and patch /etc/default/klipper if entries don't match
|
|
||||||
locate_printer_cfg && patch_klipper_sysfile
|
|
||||||
ok_msg "Update complete!"
|
ok_msg "Update complete!"
|
||||||
restart_moonraker
|
moonraker_service "restart"
|
||||||
}
|
}
|
||||||
|
|
||||||
update_klipperscreen(){
|
update_klipperscreen(){
|
||||||
|
|||||||
Reference in New Issue
Block a user