#!/bin/sh

if [ "$(id -u)" = "0" ]; then
    SYSTEM="--system"
    MSG="to all users"
else
    MSG="to user $(whoami)"
fi

if [ -f /usr/bin/flatpak ]; then
    /usr/bin/flatpak remote-add $SYSTEM --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
    /usr/bin/flatpak remote-add $SYSTEM --if-not-exists fedora oci+https://registry.fedoraproject.org

    echo "Added flathub and fedoraproject flatpak repos $MSG"
fi
