#!/bin/bash
set -e

REPO_DOMAIN="repo.mozihe.com"
DISTRO="stable"
COMPONENT="main"
KEY_URL="https://get.mozihe.com/public.gpg"
LIST_FILE="/etc/apt/sources.list.d/mozihe.list"
KEYRING_FILE="/usr/share/keyrings/mozihe.gpg"

sudo mkdir -p /usr/share/keyrings
curl -fsSL "$KEY_URL" | sudo gpg --dearmor -o "$KEYRING_FILE"

echo "deb [arch=amd64 signed-by=$KEYRING_FILE] https://$REPO_DOMAIN $DISTRO $COMPONENT" | \
  sudo tee "$LIST_FILE" > /dev/null

sudo apt update

