1

Currently I'm running this helper function in my synced shell environments on all my Linux/macOS devices;

install_mariadb() {
    local mariadb_version_test
    local mariadb_version
    local repo_arch
    local distro
mariadb_version_test="$(which mariadb)"
readonly mariadb_version_test

if [[ -f "${mariadb_version_test}" && "${1}" != "--reinstall" ]]; then
    return
fi

if $IS_LINUX; then
    mariadb_version="$(get_latest_mariadb_version)"
    readonly mariadb_version

    if $IS_PI; then
        distro="debian"
        repo_arch="arm64"
    else
        distro="$(grep -Eo "^ID=(.*?)$" "/etc/os-release" | tr -d 'ID=')"
        repo_arch="amd64"
    fi
    readonly distro
    readonly repo_arch

    sudo apt update -y
    sudo apt install -y build-essential software-properties-common gnupg2 ufw
    sudo apt-key adv --fetch-keys "https://mariadb.org/mariadb_release_signing_key.asc"

    # TODO :: Cleanup old entries from the /etc/apt/sources.list.d/* file(s)?
    sudo add-apt-repository "deb [arch=${repo_arch}] http://mariadb.mirror.globo.tech/repo/${mariadb_version}/${distro} ${VERSION_CODENAME} main"

    sudo apt update -y
    sudo apt install mariadb-server mariadb-client
elif $IS_MACOS; then
    brew install mariadb
fi

mariadb --version

}

I would prefer to install it on the Raspberry Pi 3 Model B+ properly as well, but even with arm64 (can't find any correct armv7l builds in their repo listing), but then it fails because it refuses to use debian and forces Raspbian and then gives this error;

Traceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 95, in <module>
    sp = SoftwareProperties(options=options)
  File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 109, in __init__
    self.reload_sourceslist()
  File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 599, in reload_sourceslist
    self.distro.get_sources(self.sourceslist)    
  File "/usr/lib/python3/dist-packages/aptsources/distro.py", line 91, in get_sources
    raise NoDistroTemplateException(
aptsources.distro.NoDistroTemplateException: Error: could not find a distribution template for Raspbian/bullseye

As an easy readable aid, this is what the final add-apt-repository output is when all variables are combined;

deb [arch=arm64] http://mariadb.mirror.globo.tech/repo/10.10.2/debian bullseye main

0 Answers0