#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json

packaging_format = 2

id = "hotspot"
name = "Wifi Hotspot"
description.en = "Create and configure a WiFi hotspot"
description.fr = "Créez et gérez un point d'accès WiFi"

version = "2.3.1~ynh1"

maintainers = []

[upstream]
license = "AGPL-3.0"
website = "https://internetcu.be/"

[integration]
yunohost = ">= 11.2.7"
architectures = "all"
multi_instance = true
ldap = "not_relevant"
sso = "not_relevant"
disk = "50M"
ram.build = "50M"
ram.runtime = "50M"

[install]
    [install.wifi_ssid]
    ask.en = "Choose a wifi name (SSID)"
    ask.fr = "Choisissez un nom pour le wifi (SSID)"
    type = "string"
    example = "myNeutralNetwork"
    default = "myNeutralNetwork"

    [install.wifi_passphrase]
    ask.en = "Choose a wifi password (at least 8 characters for WPA2)"
    ask.fr = "Choisissez un mot de passe wifi (au minimum 8 caractères pour le WPA2)"
    type = "password"

    [install.firmware_nonfree]
    ask.en = "Install non-free WiFi firmwares? (Only needed if you're using a proprietary WiFi antenna/dongle)"
    ask.fr = "Installer des firmwares WiFi non-libres ? (Nécessaire seulement si vous utilisez une antenne/clé WiFi propriétaire)"
    type = "boolean"
    default = false

[resources]
    [resources.system_user]

    [resources.permissions]

    [resources.apt]
    packages = "sipcalc, hostapd, iw, kmod"
    packages_from_raw_bash = '[[ "$firmware_nonfree" -eq 0 ]] && echo "firmware-ath9k-htc" || true'

    [resources.apt.extras.nonfree]
    repo = "deb http://deb.debian.org/debian bullseye non-free"
    key = "https://ftp-master.debian.org/keys/archive-key-11.asc"
    packages_from_raw_bash = """
        # Proprietary USB Wireless Device firmwares, based on https://wiki.debian.org/WiFi#USB_Devices
        if [[ "$firmware_nonfree" -eq 1 ]]; then
            # if armbian-firmware is detected, we dont include ra-link which is known to conflict....
            if dpkg --list | grep -q armbian-firmware; then
                echo "firmware-atheros firmware-realtek firmware-libertas atmel-firmware firmware-zd1211"
            else
                echo "firmware-atheros firmware-realtek firmware-ralink firmware-libertas atmel-firmware firmware-zd1211"
            fi
        else
            echo " "
        fi"""