summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 7e2bb18f762bb42806c996c9305fa620521778b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# Maintainer: Adrian Baumgart <adrian at abmgrt dot dev>
# Co-Maintainer: Noctiro <noctiro@gmail.com>

pkgname=keyguard
pkgver=20260415
pkgrel=2
pkgdesc="Keyguard is an alternative client for the Bitwarden® platform & KeePass (KDBX), created to provide the best user experience possible."
arch=('any')
url='https://github.com/AChep/keyguard-app'
license=('custom')
depends=()
makedepends=('java-environment>=21')
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/AChep/keyguard-app/archive/refs/tags/r${pkgver}.tar.gz")
sha256sums=('81198e407378f90b1f158c635393852def7c1423a045b85f840cc554c49c299d')
options=('!strip' '!debug')

build() {
    cd "${pkgname}-app-r${pkgver}"

    # Configure build properties (matching the GitHub workflow)
    echo "" >> gradle.properties
    cat >> gradle.properties << EOF
versionDate=${pkgver}
versionRef=${pkgver}-${pkgrel}
buildkonfig.flavor=release
EOF

    # Build distributable package
    ./gradlew :desktopApp:packageReleaseDistributable --no-daemon
}

package() {
    cd "${pkgname}-app-r${pkgver}"

    # Find the generated .tar.gz file
    local tarfile=$(find desktopApp/build/distributions -name "*.tar.gz" -type f)

    if [[ -z "$tarfile" ]]; then
        error "No .tar.gz file found"
        return 1
    fi

    # Extract tar.gz to temporary directory
    mkdir -p "${srcdir}/extracted"
    tar -xzf "$tarfile" -C "${srcdir}/extracted" --strip-components=1

    # Install application files
    install -dm755 "${pkgdir}/opt"
    cp -r "${srcdir}/extracted" "${pkgdir}/opt/keyguard"

    # Create symlink to binary
    install -dm755 "${pkgdir}/usr/bin"
    ln -s /opt/keyguard/bin/Keyguard "${pkgdir}/usr/bin/keyguard"

    # Fix permissions for executables
    chmod +x "${pkgdir}/opt/keyguard/bin/Keyguard"
    if [[ -f "${pkgdir}/opt/keyguard/bin/keyguard" ]]; then
        chmod +x "${pkgdir}/opt/keyguard/bin/keyguard"
    fi

    # Install icon from extracted build
    install -Dm644 "${srcdir}/extracted/lib/Keyguard.png" \
        "${pkgdir}/usr/share/icons/hicolor/512x512/apps/keyguard.png"

    # Create and install .desktop file
    install -Dm644 /dev/stdin "${pkgdir}/usr/share/applications/keyguard.desktop" << EOF
[Desktop Entry]
Type=Application
Name=Keyguard
Comment=Alternative client for Bitwarden and KeePass
Exec=keyguard
Icon=keyguard
Terminal=false
Categories=Utility;Security;
StartupWMClass=com-artemchep-keyguard-MainKt
Keywords=password;bitwarden;keepass;vault;credentials;
EOF

    # Install license if available
    if [[ -f LICENSE ]]; then
        install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
    fi
}