Skip to content

Die KW 20/2022 im Link-Rückblick

Upgrade gitea via bash on an uberspace webspace

I've just finished writing a little bash script to almost automatically upgrade my gitea instance on my uberspace webspace.

Hope it will help you.

    cat > "${HOME}/upgrade_gitea.sh" <<DELIM
#!/bin/bash
####
# @see: https://lab.uberspace.de/guide_gitea/
# @since: 2022-05-16
# @author: stev leibelt <artodeto@bazzline.net>
####

function _do_the_update () {
    local PATH_TO_GITEA="${HOME}/gitea/gitea"

    if [[ -f "\${PATH_TO_GITEA}" ]];
    then
        echo ":: Stopping all running gitea process."

        killall gitea

        echo ":: Moving >>\${PATH_TO_GITEA}<< to >>\${PATH_TO_GITEA}.previous<<"

        mv "\${PATH_TO_GITEA}" "\${PATH_TO_GITEA}.previous"
    fi

    echo ":: Please visit >>https://github.com/go-gitea/gitea/releases/tag/latest<<."
    echo ""

    echo ":: Please insert latest Version number without the v."
    read LATEST_GITEAVERSION

    wget -O "\${PATH_TO_GITEA}" https://github.com/go-gitea/gitea/releases/download/v\${LATEST_GITEAVERSION}/gitea-\${LATEST_GITEAVERSION}-linux-amd64

    if [[ -f "\${PATH_TO_GITEA}" ]];
    then
        wget --output-document "\${PATH_TO_GITEA}.asc" https://github.com/go-gitea/gitea/releases/download/v\${LATEST_GITEAVERSION}/gitea-\${LATEST_GITEAVERSION}-linux-amd64.asc

        curl --silent https://keys.openpgp.org/vks/v1/by-fingerprint/7C9E68152594688862D62AF62D9AE806EC1592E2 | gpg --import

        gpg --verify "\${PATH_TO_GITEA}.asc" "\${PATH_TO_GITEA}"

        chmod u+x "\${PATH_TO_GITEA}"

        echo ":: Starting migration"

        \${PATH_TO_GITEA} migrate

        echo ":: Starting gitea"

        \${PATH_TO_GITEA} web
    else
        echo ":: Something went wrong."

        if [[ -f "\${PATH_TO_GITEA}.previous" ]];
        then
            echo ":: Restoring previous gitea."

            mv "\${PATH_TO_GITEA}.previous" \"${PATH_TO_GITEA}"

            echo ":: Starting gitea"

            \${PATH_TO_GITEA} web
        fi
    fi
}

_do_the_update
DELIM

    chmod +x ${HOME}/upgrade_gitea.sh

Best regards, artodeto.

Translate to de es fr it pt ja

Die KW 19/2022 im Link-Rückblick

Translate to de es fr it pt ja

Die KW 18/2022 im Link-Rückblick