File indexing completed on 2024-11-10 05:11:10
0001 #!/usr/bin/env bash 0002 0003 # Utility to synchronize skills from a remote instance of Mycroft to 0004 # this local instance of the mycroft-gui. This allows the QML files 0005 # and resources to be specified using "file://..." URLs, which must 0006 # be exactly the same for both machines. 0007 0008 remote_username=pi 0009 0010 function sync_from() { 0011 ping -q -w 1 -c 1 "$1" > /dev/null 0012 if [ $? -eq 0 ]; then 0013 rsync -r -I -q --delete --delete-after ${remote_username}@$1:/opt/mycroft/skills/ /opt/mycroft/skills/ 0014 if [ $? -eq 0 ]; then 0015 echo "Skills synched! ($1)" 0016 else 0017 echo "Error synching" 0018 fi 0019 return 0 0020 else 0021 echo "Unable to sync, machine at $1 not online." 0022 return 1 0023 fi 0024 } 0025 0026 # Read the IP from the mycroft-gui-app 0027 FILE=~/.config/Unknown\ Organization/mycroft-gui-app.conf 0028 if test -f "$FILE"; then 0029 ip=$( sed -nr "/^\[General\]/ { :l /^webSocketAddress[ ]*=/ { s/.*=[ ]*ws:\/\///; p; q;}; n; b l;}" $FILE ) 0030 sync_from $ip 0031 fi