mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-14 02:54:28 +05:00
script: simplify python dependency installation during klipper and moonraker update
This commit is contained in:
@@ -223,32 +223,17 @@ update_klipper(){
|
|||||||
save_klipper_state
|
save_klipper_state
|
||||||
status_msg "Updating $GET_BRANCH"
|
status_msg "Updating $GET_BRANCH"
|
||||||
cd $KLIPPER_DIR
|
cd $KLIPPER_DIR
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
### get current klippy-requirements.txt md5sum
|
|
||||||
KLIPPER_OLDREQ_MD5SUM="$(md5sum $KLIPPER_DIR/scripts/klippy-requirements.txt | cut -d " " -f1)"
|
|
||||||
### pull latest files from github
|
### pull latest files from github
|
||||||
git pull
|
git pull
|
||||||
### read PKGLIST and install possible new dependencies
|
### read PKGLIST and install possible new dependencies
|
||||||
install_klipper_packages
|
install_klipper_packages
|
||||||
### get possible new klippy-requirements.txt md5sum
|
### install possible new python dependencies
|
||||||
KLIPPER_NEWREQ_MD5SUM="$(md5sum $KLIPPER_DIR/scripts/klippy-requirements.txt | cut -d " " -f1)"
|
KLIPPER_REQ_TXT="$KLIPPER_DIR/scripts/klippy-requirements.txt"
|
||||||
|
$KLIPPY_ENV/bin/pip install -r $KLIPPER_REQ_TXT
|
||||||
### check for possible new dependencies and install them
|
|
||||||
if [[ $KLIPPER_NEWREQ_MD5SUM != $KLIPPER_OLDREQ_MD5SUM ]]; then
|
|
||||||
PYTHONDIR="${HOME}/klippy-env"
|
|
||||||
status_msg "New dependecies detected..."
|
|
||||||
|
|
||||||
### 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
|
|
||||||
fi
|
fi
|
||||||
update_log_paths "klipper"
|
update_log_paths "klipper"
|
||||||
ok_msg "Update complete!"
|
ok_msg "Update complete!"
|
||||||
@@ -289,28 +274,13 @@ update_moonraker(){
|
|||||||
do_action_service "stop" "moonraker"
|
do_action_service "stop" "moonraker"
|
||||||
bb4u "moonraker"
|
bb4u "moonraker"
|
||||||
status_msg "Updating Moonraker ..."
|
status_msg "Updating Moonraker ..."
|
||||||
cd $MOONRAKER_DIR
|
|
||||||
|
|
||||||
### get current moonraker-requirements.txt md5sum
|
|
||||||
MOONRAKER_OLDREQ_MD5SUM=$(md5sum $MOONRAKER_DIR/scripts/moonraker-requirements.txt | cut -d " " -f1)
|
|
||||||
### pull latest files from github
|
### pull latest files from github
|
||||||
git pull
|
cd $MOONRAKER_DIR && git pull
|
||||||
### read PKGLIST and install possible new dependencies
|
### read PKGLIST and install possible new dependencies
|
||||||
install_moonraker_packages
|
install_moonraker_packages
|
||||||
### get possible new moonraker-requirements.txt md5sum
|
### install possible new python dependencies
|
||||||
MOONRAKER_NEWREQ_MD5SUM=$(md5sum $MOONRAKER_DIR/scripts/moonraker-requirements.txt | cut -d " " -f1)
|
MR_REQ_TXT="$MOONRAKER_DIR/scripts/moonraker-requirements.txt"
|
||||||
|
$MOONRAKER_ENV/bin/pip install -r $MR_REQ_TXT
|
||||||
### check for possible new dependencies and install them
|
|
||||||
if [[ $MOONRAKER_NEWREQ_MD5SUM != $MOONRAKER_OLDREQ_MD5SUM ]]; then
|
|
||||||
PYTHONDIR="${HOME}/moonraker-env"
|
|
||||||
status_msg "New dependecies detected..."
|
|
||||||
### always rebuild the pythondir from scratch if new dependencies were detected
|
|
||||||
rm -rf ${PYTHONDIR}
|
|
||||||
virtualenv -p /usr/bin/python3 ${PYTHONDIR}
|
|
||||||
ln -s /usr/lib/python3/dist-packages/gpiod* ${PYTHONDIR}/lib/python*/site-packages
|
|
||||||
${PYTHONDIR}/bin/pip install -r $MOONRAKER_DIR/scripts/moonraker-requirements.txt
|
|
||||||
ok_msg "Dependencies have been installed!"
|
|
||||||
fi
|
|
||||||
update_log_paths "moonraker"
|
update_log_paths "moonraker"
|
||||||
ok_msg "Update complete!"
|
ok_msg "Update complete!"
|
||||||
do_action_service "restart" "moonraker"
|
do_action_service "restart" "moonraker"
|
||||||
|
|||||||
Reference in New Issue
Block a user