# Maintainer: paperbenni <paperbenni@gmail.com>
pkgname=ins
pkgver=0.14.23
pkgrel=1
pkgdesc="A powerful command-line tool for managing dotfiles, system diagnostics, and instantOS configurations"
arch=('x86_64')
url="https://instantos.io"
license=('GPL-2.0-only')
provides=('instantpacman' 'instantsettings' 'instantupdate' 'instantwelcome')
conflicts=('instantpacman' 'instantsettings' 'instantupdate' 'instantwelcome')
replaces=('instantpacman' 'instantsettings' 'instantupdate' 'instantwelcome')
depends=('glibc' 'gcc-libs' 'fzf' 'git' 'sqlite')
optdepends=(
    'pass: for password-store management with ins pass'
    'gnupg: for password-store encryption with ins pass'
    'pass-otp: for OTP entries with ins pass'
    'wl-clipboard: for copying passwords on Wayland'
    'xclip: for copying passwords on X11'
    'restic: for backup functionality'
    'kitty: default terminal for scratchpad'
    'ntfsprogs: for NTFS partition resize detection (dual-boot)'
    'ntfs-3g: for mounting Windows NTFS partitions (dual-boot)'
)
source=(
    "$pkgname-$pkgver.tar.gz::https://github.com/instantOS/instantCLI/archive/refs/tags/v$pkgver.tar.gz"
    "$pkgname-x86_64-unknown-linux-gnu-v$pkgver.tgz::https://github.com/instantOS/instantCLI/releases/download/v$pkgver/ins-x86_64-unknown-linux-gnu-v$pkgver.tgz"
    'ins-welcome.desktop'
)
sha256sums=(
    'd385993c73100c3181a93e8d3004cacc7e9a667fa12a8281282886d13d95c287'
    '547454fc2eaef2f046005ac4940516927470f5269c4e0238be8dde10f53ffad0'
    '8a519163986b1a5f92462790e2fd1c04dec777581f74adc8cc75a4d1d7726bfa'
)

package() {
    cd "instantCLI-$pkgver"
    install -Dm755 "$srcdir/ins-x86_64-unknown-linux-gnu-v$pkgver/ins" "$pkgdir/usr/bin/$pkgname"
    install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
    install -Dm644 README.md "$pkgdir/usr/share/doc/$pkgname/README.md"

    for desktop_file in desktop/*.desktop; do
        install -Dm644 "$desktop_file" "$pkgdir/usr/share/applications/$(basename "$desktop_file")"
    done
    install -Dm644 "$srcdir/ins-welcome.desktop" "$pkgdir/usr/share/applications/ins-welcome.desktop"
}
