Giter Site home page Giter Site logo

mediawiki-updater's People

Contributors

gpunktschmitz avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

pitchke msmolarz

mediawiki-updater's Issues

Great idea, here is my first contribution

Dear Guenther,

I found your script few days ago searching to ... automate few mediawiki upgrades and it motivates me to bring some suggestions and adapt to my use cases and generic solutions.
Allow me to attach the current script which shows most changes in itself and as comments in code.
I just saw that you updated your current script, thanks again ;-), I will have a look and continue to improve it if I can (I am not a Shell script expert).

mediawiki-updater v2017-11-21.sh.txt

Pleased to contribute ...

mediawiki-update script

Hi,

i try to update and adapt your mediawiki-update script to my wiki installation (I can also share the updates at the end.). But I don't really understand how you compare the version numbers. So how do the following two functions (vercomp and testvercomp) work? I always get an error message.

#get releases from https://github.com/wikimedia/mediawiki/releases.atom
LATEST_RELEASES=$(${WGETEXECUTABLE} -q -O- "https://github.com/wikimedia/mediawiki/releases.atom" | ${GREPEXECUTABLE} -o -P '<title>[^"]*' | ${SEDEXECUTABLE} "s/<title>//g" | ${SEDEXECUTABLE} "s/<\/title>//g")
for RELEASE in ${LATEST_RELEASES}; do
    if [[ "${RELEASE}" =~ [0-9] ]]; then
	#skip if release candidate
        if ! ${GREPEXECUTABLE} "\-rc\." <<< ${RELEASE} &>/dev/null; then
            if testvercomp ${RELEASE} "<" ${LATEST_RELEASE}; then
                LATEST_RELEASE=${RELEASE}
            fi
        fi
    fi
done

echo "latest release found: ${LATEST_RELEASE}"

#check if latest version is newer
if testvercomp ${LATEST_RELEASE} ">" ${INSTALLED_VERSION}; then
    echo "no newer version found on the interweb -> exiting"
    exit 1
fi

vercomp () {
    if [[ $1 == $2 ]]
    then
        return 0
    fi
    local IFS=.
    local i ver1=($1) ver2=($2)
    # fill empty fields in ver1 with zeros
    for ((i=${#ver1[@]}; i<${#ver2[@]}; i++))
    do
        ver1[i]=0
    done
    for ((i=0; i<${#ver1[@]}; i++))
    do
        if [[ -z ${ver2[i]} ]]
        then
            # fill empty fields in ver2 with zeros
            ver2[i]=0
        fi
        if ((10#${ver1[i]} > 10#${ver2[i]}))
        then
            return 1
        fi
        if ((10#${ver1[i]} < 10#${ver2[i]}))
        then
            return 2
        fi
    done
    return 0
}

testvercomp () {
    vercomp $1 $3
    case $? in
        0) op='=';;
        1) op='>';;
        2) op='<';;
    esac
    if [[ $op != $2 ]]
    then
        return 0
        echo 0
    else
        return 1
        echo 1
    fi
}
currently installed version: 1.35.0
test.sh: line 49: ((: 10#wmf: value too great for base (error token is "10#wmf")
test.sh: line 53: ((: 10#wmf: value too great for base (error token is "10#wmf")
test.sh: line 49: ((: 10#1 > 10#wmf: value too great for base (error token is "10#wmf")
test.sh: line 53: ((: 10#1 < 10#wmf: value too great for base (error token is "10#wmf")
test.sh: line 49: ((: 10#1 > 10#wmf: value too great for base (error token is "10#wmf")
test.sh: line 53: ((: 10#1 < 10#wmf: value too great for base (error token is "10#wmf")
test.sh: line 49: ((: 10#1 > 10#wmf: value too great for base (error token is "10#wmf")
test.sh: line 53: ((: 10#1 < 10#wmf: value too great for base (error token is "10#wmf")
test.sh: line 49: ((: 10#1 > 10#wmf: value too great for base (error token is "10#wmf")
test.sh: line 53: ((: 10#1 < 10#wmf: value too great for base (error token is "10#wmf")
test.sh: line 49: ((: 10#1 > 10#wmf: value too great for base (error token is "10#wmf")
test.sh: line 53: ((: 10#1 < 10#wmf: value too great for base (error token is "10#wmf")
latest release found: wmf-1.36.0-wmf.31-testing:
test.sh: line 49: ((: 10#wmf: value too great for base (error token is "10#wmf")
test.sh: line 53: ((: 10#wmf: value too great for base (error token is "10#wmf")

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.