# Maintainer: Celestia Ludenberg <ash8820@proton.me>

pkgname=calamares-branding-antergos-next
pkgver=1.0
pkgrel=13
pkgdesc="Calamares branding for Antergos NeXT with offline/online installer support"
arch=('any')
url="https://github.com/Antergos-NeXT"
license=('GPL3')
depends=('calamares' 'yad')
optdepends=('zenity: fallback for graphical mode chooser dialog')
source=("branding.desc"
        "stylesheet.qss"
        "show.qml"
        "Dia.qml"
        "Slider.qml"
        "calamares-sidebar.qml"
        "calamares-navigation.qml"
        "background.jpg"
        "pan-up-symbolic.svg"
        "pan-end-symbolic.svg"
        "pan-start-symbolic.svg"
        "draw-rectangle.svg"
        "unpackfs.conf"
        "dracut.conf"
        "antergos-logo.png"
        "antergos-icon.png"
        "netinstall.yaml"
        "netinstall.conf"
        "welcome.conf"
        "settings_offline.conf"
        "settings_online.conf"
        "calamares-next.sh")
sha256sums=('SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP')

package() {
  # Branding data (shared between offline/online)
  local _brand="/usr/share/calamares/branding/antergos-next"
  install -dm755 "${pkgdir}${_brand}"
  cp "branding.desc" "${pkgdir}${_brand}/"
  cp "stylesheet.qss" "${pkgdir}${_brand}/"
  cp "show.qml" "${pkgdir}${_brand}/"
  cp "Dia.qml" "${pkgdir}${_brand}/"
  cp "Slider.qml" "${pkgdir}${_brand}/"
  cp "calamares-sidebar.qml" "${pkgdir}${_brand}/"
  cp "calamares-navigation.qml" "${pkgdir}${_brand}/"
  cp "background.jpg" "${pkgdir}${_brand}/"
  cp "pan-up-symbolic.svg" "${pkgdir}${_brand}/"
  cp "pan-end-symbolic.svg" "${pkgdir}${_brand}/"
  cp "pan-start-symbolic.svg" "${pkgdir}${_brand}/"
  cp "draw-rectangle.svg" "${pkgdir}${_brand}/"
  cp "antergos-logo.png" "${pkgdir}${_brand}/"
  cp "antergos-icon.png" "${pkgdir}${_brand}/"

  # Shared Calamares modules
  install -dm755 "${pkgdir}/etc/calamares/modules"
  cp "unpackfs.conf" "${pkgdir}/etc/calamares/modules/"
  cp "dracut.conf" "${pkgdir}/etc/calamares/modules/"
  cp "netinstall.conf" "${pkgdir}/etc/calamares/modules/"
  cp "netinstall.yaml" "${pkgdir}/etc/calamares/modules/"
  cp "welcome.conf" "${pkgdir}/etc/calamares/modules/"

  # Offline config directory
  install -dm755 "${pkgdir}/etc/calamares-offline"
  cp "settings_offline.conf" "${pkgdir}/etc/calamares-offline/settings.conf"
  ln -sf "/usr/share/calamares/qml" "${pkgdir}/etc/calamares-offline/qml"
  ln -sf "/usr/share/calamares/branding" "${pkgdir}/etc/calamares-offline/branding"

  # Online config directory
  install -dm755 "${pkgdir}/etc/calamares-online"
  cp "settings_online.conf" "${pkgdir}/etc/calamares-online/settings.conf"
  ln -sf "/usr/share/calamares/qml" "${pkgdir}/etc/calamares-online/qml"
  ln -sf "/usr/share/calamares/branding" "${pkgdir}/etc/calamares-online/branding"

  # Default: offline mode (for direct calamares launch)
  install -dm755 "${pkgdir}/etc/calamares"
  ln -sf "../calamares-offline/settings.conf" "${pkgdir}/etc/calamares/settings.conf"
  ln -sf "/usr/share/calamares/branding" "${pkgdir}/etc/calamares/branding"

  # Launcher script
  install -dm755 "${pkgdir}/usr/bin"
  install -m755 "calamares-next.sh" "${pkgdir}/usr/bin/calamares-next"
}
