• jPV
  • Yokemate of Keyboards
    Yokemate of Keyboards
    jPV
    Posts: 2026 from 2003/2/24
    From: po-RNO
    There's the handy Newer command in MorphOS. It compares version strings found in two files, so if you have a file containing a version string ("$VER: Wayfarer 3.8", for example), you can compare that against the actual executable file.

    You could have a separate version file like "https://www.morphos-storage/network/web/wayserver.version", but why not add a version string into "https://www.morphos-storage/network/web/wayfarer.install" and you could go with one download for both version checking and installing.

    Here's example(s):
    Code:
    ; Set files here, no need to modify rest of the code then:
    Set LOCALFILE "SYS:Applications/Wayfarer/Wayfarer"
    Set REMOTEURL "https://jpv.amigaaa.com/"
    Set REMOTEFILE "wayserver.version"

    ; Examples for testing newer and older version strings:
    ;Set REMOTEFILE "wayserver.version_old"
    ;Set REMOTEFILE "wayserver.version_new"

    ; If the wayfarer.install file would include a version string (no need for a separate version file):
    ;Set REMOTEURL "https://www.morphos-storage.net/network/web/"
    ;Set REMOTEFILE "wayfarer.install"



    ; The actual script:

    FailAt 21 ; Don't stop execution on fails, but handle them in the script.

    wget -q --no-check-certificate -O "RAM:$REMOTEFILE" $REMOTEURL$REMOTEFILE

    Newer "$LOCALFILE" "RAM:$REMOTEFILE"
    Set NEWRC $RC

    If $NEWRC EQ 5
    Echo "Remote is newer!"
    Else
    If $NEWRC GE 10
    Echo "Can't check the version!"
    Else
    Echo "Remote is not newer."
    EndIf
    EndIf

    Unset NEWRC
    Unset REMOTEFILE
    Unset REMOTEURL
    Unset LOCALFILE
  • »07.06.22 - 11:06
    Profile Visit Website