You are not logged in.
My goal is to create a package for the update script of The Linux Counter Project and then upload it to the AUR. This is my first PKGBUILD.
PKGBUILD:
# Maintainer: Francesco Turco <fturco@fastmail.fm>
# Contributor: Max Roder <maxroder@web.de>
# Contributor: Mathias Buren <mathias.buren@gmail.com>
pkgname='linux-counter'
pkgver='git'
pkgrel='1'
pkgdesc="Update script for The Linux Counter Project"
url="https://www.linuxcounter.net/download"
arch=('any')
license=('GPL3')
depends=('bash')
source=("https://github.com/christinloehner/linuxcounter-update-examples/raw/master/_official/lico-update.sh"
linux-counter.service
linux-counter.timer)
sha256sums=('19e1d08ee30843f17a65652b69332cec127fa69803203b47d3f1930490bf1e59'
'3b5d0f1a8e24fb9596c5fa6718a606510a30d461819c6b90209468fb74903df1'
'daf2649bb460e7e755eba8287716d18101509b0eb21ac5a961a094c70602b903')
package() {
install -D -m755 ${srcdir}/lico-update.sh ${pkgdir}/usr/bin/lico-update
install -D -m644 ${srcdir}/${pkgname}.service ${pkgdir}/usr/lib/systemd/system/${pkgname}.service
install -D -m644 ${srcdir}/${pkgname}.timer ${pkgdir}/usr/lib/systemd/system/${pkgname}.timer
}
linux-counter.service:
[Unit]
Description=Update script for The Linux Counter Project
Documentation=https://www.linuxcounter.net/
[Service]
ExecStart=/usr/bin/lico-update -m
User=root
Group=root
Type=oneshot
linux-counter.timer:
[Unit]
Description=Linux Counter daily update
[Timer]
OnCalendar=daily
Probably this package can be improved by dropping root privileges and running the script by a dedicated user, but I don't know how to do that. What do you think?
Offline
If the package contains the latest Git version its name should have "-git" suffix and should provide and conflict ${pkgname%-git}. Checksums should be skiped. The pkgver should be set dynamically, see: https://wiki.archlinux.org/index.php/VC … 9_function
Offline
Thank you for the answer, I'll look at the link. Anyway I'm not even sure my package is a real -git package because I don't clone the whole repository. I just download a single file from the git repository. There's even a version number inside that file (0.0.4).
Offline
If you're downloading from master, it should definitely be a -git package.
Offline
I just download a single file from the git repository. There's even a version number inside that file (0.0.4).
Yes, but that version number can and will change without any indication to the users of the AUR package.
So your options as I see them:
1) keep the source as is, append -git to the package name, and write a pkgver function that parses the script file to get that version number you just mentioned.
2) clone the git repo properly, append -git to the package name, and make this just like countless other good git PKGBUILDs.
3) change the source url to point to the file for a specific git commit or tag. Then put the version number of this commit/tag into the version field of the PKGBUILD and keep the package name as is.
Number 2 seems best to me, but 3 would be resonable enough - 1 just seems very awkward to me.
FWIW, number 2 will also make this easiest for you: you (almost never) need to worry about updating the PKGBUILD when upstream makes changes. They'll (almost) always 'just work'.
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
I chose option number 2. Here you are the updated PKGBUILD:
# Maintainer: Francesco Turco <fturco@fastmail.fm>
# Contributor: Max Roder <maxroder@web.de>
# Contributor: Mathias Buren <mathias.buren@gmail.com>
_name=linux-counter
pkgname=${_name}-git
pkgver=r34.6cd6ff2
pkgrel=1
pkgdesc="Update script for The Linux Counter Project"
url="https://www.linuxcounter.net/download"
arch=('any')
license=('GPL3')
depends=('bash')
source=("git://github.com/christinloehner/linuxcounter-update-examples/"
${pkgname}.service
${pkgname}.timer)
sha256sums=('SKIP'
'3b5d0f1a8e24fb9596c5fa6718a606510a30d461819c6b90209468fb74903df1'
'daf2649bb460e7e755eba8287716d18101509b0eb21ac5a961a094c70602b903')
package() {
install -D -m755 ${srcdir}/lico-update.sh ${pkgdir}/usr/bin/lico-update
install -D -m644 ${srcdir}/${pkgname}.service ${pkgdir}/usr/lib/systemd/system/${_name}.service
install -D -m644 ${srcdir}/${pkgname}.timer ${pkgdir}/usr/lib/systemd/system/${_name}.timer
}
pkgver() {
cd linuxcounter-update-examples
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}
What do you think? Can I upload it to the AUR?
Offline
Take -git out of the systemd files. Those would be the same whether you use the git version or not.
Offline
Yeah, you're right. Fixed. Latest version:
# Maintainer: Francesco Turco <fturco@fastmail.fm>
# Contributor: Max Roder <maxroder@web.de>
# Contributor: Mathias Buren <mathias.buren@gmail.com>
_name=linux-counter
pkgname=${_name}-git
pkgver=r34.6cd6ff2
pkgrel=1
pkgdesc="Update script for The Linux Counter Project"
url="https://www.linuxcounter.net/download"
arch=('any')
license=('GPL3')
depends=('bash')
source=("git://github.com/christinloehner/linuxcounter-update-examples/"
${_name}.service
${_name}.timer)
sha256sums=('SKIP'
'3b5d0f1a8e24fb9596c5fa6718a606510a30d461819c6b90209468fb74903df1'
'daf2649bb460e7e755eba8287716d18101509b0eb21ac5a961a094c70602b903')
package() {
install -D -m755 ${srcdir}/linuxcounter-update-examples/_official/lico-update.sh ${pkgdir}/usr/bin/lico-update
install -D -m644 ${srcdir}/${_name}.service ${pkgdir}/usr/lib/systemd/system/${_name}.service
install -D -m644 ${srcdir}/${_name}.timer ${pkgdir}/usr/lib/systemd/system/${_name}.timer
}
pkgver() {
cd linuxcounter-update-examples
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}
Offline