#!/bin/sh loggerName=neighbor_update.sh GetFwVersion="cat /etc/version" Exe1="/etc/fwupdate/1-before-Upload.sh" Exe2="/etc/fwupdate/2-after-Upload.sh" neighbor_Nexo=$1 # Pruefe ob Nexo erreichbar ping -w 1 $neighbor_Nexo if [ $? -eq 0 ]; then logger -s -t $loggerName "Info: PING SUCCESS Nexo <$neighbor_Nexo>" Neighbour_Version=`/usr/bin/dbclient -t -y -i /home/tool/.ssh/did_rsa root@$neighbor_Nexo "$GetFwVersion" < /dev/ptmx` logger -s -t $loggerName "Info: Firmware Version Nachbar <$Neighbour_Version>" /usr/bin/dbclient -t -y -i /home/tool/.ssh/did_rsa root@$neighbor_Nexo $Exe1 < /dev/ptmx if [ "$?" -ne "0" ]; then logger -s -t $loggerName "Err: $Exe1 FAILED" exit -1 fi dbus-send --system --print-reply --dest=com.rexroth.akku.GUIService /GUI com.rexroth.akku.gui.fpopupString string:"FW Update" string:"$neighbor_Nexo
Upload Image" int32:2 int32:0 /usr/bin/rsync -Pavzk -e "dbclient -y -i /home/tool/.ssh/did_rsa" /mnt/data/fw/ root@$neighbor_Nexo:/mnt/data/fw if [ "$?" -ne "0" ]; then logger -s -t $loggerName "Err: rsync FAILED" exit -1 fi dbus-send --system --print-reply --dest=com.rexroth.akku.GUIService /GUI com.rexroth.akku.gui.fpopupString string:"FW Update" string:"$neighbor_Nexo
Flashing Image" int32:2 int32:0 /usr/bin/dbclient -t -y -i /home/tool/.ssh/did_rsa root@$neighbor_Nexo $Exe2 < /dev/ptmx if [ "$?" -ne "0" ]; then logger -s -t $loggerName "Err: rsync FAILED" exit -1 fi dbus-send --system --print-reply --dest=com.rexroth.akku.GUIService /GUI com.rexroth.akku.gui.fpopupString string:"FW Update" string:"$neighbor_Nexo
SUCCESS" int32:2 int32:0 exit 0 else logger -s -t $loggerName "Err: PING FAILED Nexo nicht erreichbar <$neighbor_Nexo>" exit -1 fi