#!/bin/bash
REPO_TYPE=${1:-testing}
HOST=downloads.artix.su
URL_MAIN="http://${HOST}/static/downloads/install_scripts/${REPO_TYPE}/main"
LINUX_VERSION=$(lsb_release -s -r)
if type systemctl > /dev/null 2>&1;
then
	echo "Compatible version: " $LINUX_VERSION
  apt-get install -y curl ca-certificates gnupg || exit 1
  curl -fsSL "${URL_MAIN}/install_apt_key.sh" -o /tmp/install_apt_key.sh || exit 1
  bash /tmp/install_apt_key.sh "https://www.mongodb.org/static/pgp/server-4.4.asc" mongodb-4.4.gpg || exit 1
	echo "deb [ arch=amd64,arm64 signed-by=/etc/apt/keyrings/mongodb-4.4.gpg] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.4 multiverse" \
    | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
fi
