Allow to install Klippain in a given directory
Allow to install Klippain for a given Kiauh installed printer.
I did a kiauh multi install of 10 printers early last year. At the time, the installed directories were named printer_1_data to printer_10_data. It also created klipper-1.service to klipper-10.service.
When I try to run arcadien's install script with this command: './install.sh 8', the script fails because the '8_data' directory does not exist.
When I try to run the install script with this command: './install.sh printer_8', the script fails because it is looking for klipper-printer_8.service which doesn't exist.
Are you guys seeing this or do I have a 'funny' installation?
@tsk-2222 i'll double check that later. AFAIR in my install, Kiauh created /home/pi/xx_data and klipper-xx.service for each xx named printer. It looks you have an extra printer- prefix to data folder which i have not.
I'll keep PR posted.
@arcadien I can't test the kiauh scripts now but it looks like my situation happens when you tell kiauh how many printer instances to setup and DO NOT assign custom names. In this case, # by KIAUH convention, all instance names of only numbers need to be prefixed with 'printer_'
You can see this in the kiauh utilities.sh at line 700.
if [[ ${name} =~ ^[0-9]+$ ]]; then cfg_dirs+=("${HOME}/printer_${name}_data/config") else cfg_dirs+=("${HOME}/${name}_data/config")
Ok so in that case, there will be printer_xx_data folder, but klipper-xx.service
@tsk-2222 it should be fixed by last commit
@arcadien I'm not a bash pro by any means, but... If I'm not mistaken, there's still a problem. If the printer is called 'printer_8' then the directory check will succeed, but then the next check at line 56 will always fail.
I think that maybe the script should consider the full name of the printer to be 'printer_8' for example and not just '8'. Then it could be handled in a similar way as if it was manually named it something like voron_8. Then during the check for the klipper service, just strip out any name beginning with 'printer_' and search for the klipper.8 service that kiauh created.
I hope that makes sense.
What is the state of this PR. Is it ok now? @tsk-2222 can you confirm it's ok for you now? Unfortunately, I can only test it on a "single printer" host on my side.
It's still broken on my end. Something like the following snippet seems to work for the Klippain install. It just strips off any leading "printer_" characters from SERVICE_NAME and allow the script to be called as such: "./install.sh printer_8"
if [ "$FORCE_PRINTER_NAME" != "" ]; then
if [ -d "${HOME}/${FORCE_PRINTER_NAME}_data" ]; then
echo "[PRE-CHECK] Installing Klippain for printer '${FORCE_PRINTER_NAME}'"
PRINTER_NAME=$FORCE_PRINTER_NAME
# if [[ ${PRINTER_NAME} =~ ^[0-9]+$ ]]; then
# TARGET_DIR=${HOME}/printer_${PRINTER_NAME}_data
# else
TARGET_DIR=${HOME}/${PRINTER_NAME}_data
# fi
USER_CONFIG_PATH="${TARGET_DIR}/config"
SERVICE_NAME=klipper-${PRINTER_NAME#printer_} #strip off printer_ prefix to match kiauh service naming
The call to the shaketune install script will of course still fail until that gets updated also.
I made some changes to install.sh and I believe it should work but I would like some more eyeballs.
https://github.com/tsk-2222/klippain/commit/dfd8e6100666c538ca3d615bdcc517d38b1a5f50