We have a set of remote.it scripts working fine on Raspbian stretch, but want to move to Raspbian buster. When trying to install weavedconnectd on buster, I came across the following post: https://github.com/alanbjohnston/CubeSatSim/wiki/Remote-Management-of-Raspberry-P (found after not being able to install weavedconnectd)
Installing connectd works fine, I can connect our RPi to the remote.it server and run scripts. The problem is that our scripts attempt to import:
. /usr/bin/remot3_script_lib-1.1
which no longer exists. We use the following methods from it:
Translate
Status_*
Download_With_Retry
Task_Update
Task_Complete
Task_Failed
Is there a connectd equivalent wrapper to the underlying scripts? Or is there a way to update the wrapper to be agnostic to weaved vs connectd?
I notice the Send-File-Sample.sh example has some of these methods embedded within the script rather than as a separate ālibraryā. Unfortunately I have no information about the history of the remot3_script_lib so I can only guess, but I think there are two possibilities:
An earlier version of the weavedconnectd installation provided the Remot3_script_lib, for device scripts to make use of
We generated a common library of functions called Remot3_script_lib and installed/placed it in /usr/bin so we didnāt have to replicate code between all our device scripts
Sorry for the delay but I really had to think about this one. The remot3_script_lib wound up in our package originally to support an OEM customer. They had tested it, but we hadnāt, so we removed it from the connectd package. If it is working for you that is a good sign so you can continue to use it.
You can take that file (from one of your weaved devices) and send it to your connectd devices using the āsend fileā script.
To write scripts so that they will work both with weavedconnectd and connectd, include the following lines near the top (but not at the top) of your scripts. Make sure that TOOL_DIR is defined prior to this, e.g.
# the following block is included to allow compatibility with both
# the deprecated weavedconnectd package as well as the current connectd package
TOOL_DIR=/usr/bin
if [ -e "$TOOL_DIR"/task_notify.sh ]; then
NOTIFIERSCRIPT=task_notify.sh
elif [ -e "$TOOL_DIR"/connectd_task_notify ]; then
NOTIFIERSCRIPT=connectd_task_notify
fi
If TOOL_DIR is already defined then you donāt need to redefine it, but make sure that definition is BEFORE the block of code above.
Then, in your code, youāll need to replace any calls to /usr/bin/task_notify.sh to ${TOOL_DIR}/"$NOTIFIERSCRIPT", e.g.
Status()
{
ret=$(${TOOL_DIR}/"$NOTIFIERSCRIPT" $1 $api $jobID "$2")
}
# first, clear status cells a through e
Status a ""
Status b ""
Status c ""
Status d ""
Status e ""
Let me know if you have any issues getting this all to work.
We took the methods from the example scripts on your website (specifically the file transfer example), diffed them with the methods in remote3_script_lib and found there were fairly minimal differences - including your suggestion for the $NOTIFIERSCRIPT var.
Unfortunately I donāt have enough rep to upload files, otherwise Iād have attached our version of the script_lib for others to use.
So, are you good to go now? Another thing you can do is simply to include all of the functions from the library file in your script itself, which removes the dependency on a specific external library.
Fair enough. You could also develop and install your own set of library functions into a file to be included when other scripts run, and use a simpler script to install them.