Issue with version comparison
Closed this issue · 1 comments
lucasmontec commented
These lines are throwing an exception when trying to run:
if [ $RDLATEST == $RDCURRENT ]; then
echo "Same version no need to update."
exit 0
fi
I have printed the variables and their value are:
$RDLATEST = 1.1.8
$RDCURRENT = hbbr 1.1.8
I have written a fix:
# Extract version numbers from the variables
RDLATEST_VERSION=$(echo "$RDLATEST" | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+')
RDCURRENT_VERSION=$(echo "$RDCURRENT" | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+')
# Compare the extracted version numbers as strings
if [ "$RDLATEST_VERSION" = "$RDCURRENT_VERSION" ]; then
echo "Same version, no need to update."
exit 0
fi
echo "New version available ($RDLATEST_VERSION), your current version is ($RDCURRENT_VERSION). Beginning update..."
dinger1986 commented
I have fixed the script with /opt/rustdesk/hbbr --version | sed -r 's/hbbr (.*).*/\1/'
I have also added curl https://api.github.com/repos/rustdesk/rustdesk-server/releases/latest -s | grep "tag_name"| awk '{print substr($2, 2, length($2)-3) }'