You are not logged in.

#1 2023-12-05 03:38:13

myyc
Member
Registered: 2021-05-17
Posts: 13

PKGBUILD review: zen-adblocker-bin

a couple of notes on this.

1. the actual app is called "zen" but there is a "zen" package in the aur already so i changed the name
2. the binary is called Zen, i am not a fan of having possible Zen/zen confusions so the appname will be officially "zen-adblocker" under the hood everywhere
3. i set up a "conflicts" to zen-adblocker in case someone posts the source package to the aur (said package does not exist yet)
4. there are three additional files: license, icon, .desktop file. the first two i pulled from git and the last one i made myself

appname="zen-adblocker"
pkgname="${appname}"-bin
pkgver="0.1.1"
pkgrel=2
pkgdesc="An open-source system-wide ad-blocker and privacy guard"
arch=('x86_64')
url="https://github.com/anfragment/zen"
license=('MIT')
conflicts=('zen-adblocker')
source_x86_64=("https://github.com/anfragment/zen/releases/latest/download/Zen_linux_amd64.tar.gz")
sha256sums_x86_64=('f2f446a484cea79333a08a6c7297ae5f3505eed52dc5ead67945a514639d641d')

package() {
    install -Dm755 "${srcdir}/Zen" "${pkgdir}/usr/bin/${appname}"
    install -Dm644 "${startdir}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"

    install -Dm644 "${startdir}/${appname}.desktop" "${pkgdir}/usr/share/applications/${appname}.desktop"
    install -Dm644 "${startdir}/appicon.png" "${pkgdir}/usr/share/pixmaps/${appname}.png"
}

Last edited by myyc (2023-12-05 03:38:41)

Offline

#2 2023-12-05 03:43:56

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,808

Re: PKGBUILD review: zen-adblocker-bin

Do not use $startdir. Anything you use should be in the source array, and will then be available in $srcdir.

If you pulled them from git, why is that address not in the source array anyway?

You need to rename the source file, adding a version, probably $pkgver. As is, you'll have to delete the source file every time the package is updated so makepkg will redownload it. Don't use the 'latest' url if you don't have to.

The conflicts is correct, it should also have a provides, though.

Last edited by Scimmia (2023-12-05 03:47:38)

Online

#3 2023-12-05 05:17:19

myyc
Member
Registered: 2021-05-17
Posts: 13

Re: PKGBUILD review: zen-adblocker-bin

Scimmia wrote:

Do not use $startdir. Anything you use should be in the source array, and will then be available in $srcdir.

If you pulled them from git, why is that address not in the source array anyway?

You need to rename the source file, adding a version, probably $pkgver. As is, you'll have to delete the source file every time the package is updated so makepkg will redownload it. Don't use the 'latest' url if you don't have to.

The conflicts is correct, it should also have a provides, though.

thanks for the feedback. a couple of questions:
1. is it fine to get git blob URLs to download stuff? e.g. https://github.com/anfragment/zen/blob/ … g?raw=true
2. i think there's something basic i don't get about the source array. what is the correct way to serve the .desktop file? as i said, i made it myself, it's not available on git never mind, sorted this out.

looks better now

appname="zen-adblocker"
pkgname="${appname}"-bin
pkgver="0.1.1"
pkgrel=3
pkgdesc="An open-source system-wide ad-blocker and privacy guard"
arch=('x86_64')
url="https://github.com/anfragment/zen"
license=('MIT')
conflicts=('zen-adblocker')
provides=('zen-adblocker')
source=("Zen_linux_amd64_${pkgver}.tar.gz::https://github.com/anfragment/zen/releases/download/v${pkgver}/Zen_linux_amd64.tar.gz"
        "${appname}.desktop"
        "appicon.png"
        "LICENSE")
sha256sums=("f2f446a484cea79333a08a6c7297ae5f3505eed52dc5ead67945a514639d641d"
            "b8fd4a272875b236b953bbeca99459cfcd6d6e10a1d00cf50eaadf742db27fc2"
            "86c811ab545ee63d398ddc2da04a75d968d349102a4b73a087e01cebc346f1e2"
            "1e4ebb38d821a58a947f130589016932e39f0ddb8a7b71eddb23859188c41768")

package() {
    install -Dm755 "${srcdir}/Zen" "${pkgdir}/usr/bin/${appname}"
    install -Dm644 "./LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"

    install -Dm644 "./${appname}.desktop" "${pkgdir}/usr/share/applications/${appname}.desktop"
    install -Dm644 "./appicon.png" "${pkgdir}/usr/share/pixmaps/${appname}.png"
}

Last edited by myyc (2023-12-05 05:25:12)

Offline

#4 2023-12-05 05:25:49

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,808

Re: PKGBUILD review: zen-adblocker-bin

Yes, it's fine to use git blob urls, but I would use one of the tag instead of the commit hash, ie https://github.com/anfragment/zen/blob/ … g?raw=true. That way you can use $pkgver in the url and only have to update it once.

Online

#5 2023-12-05 05:36:16

myyc
Member
Registered: 2021-05-17
Posts: 13

Re: PKGBUILD review: zen-adblocker-bin

Scimmia wrote:

Yes, it's fine to use git blob urls, but I would use one of the tag instead of the commit hash, ie https://github.com/anfragment/zen/blob/ … g?raw=true. That way you can use $pkgver in the url and only have to update it once.

ah yeah. good idea. thanks for the help!

Offline

Board footer

Powered by FluxBB