You are not logged in.
I've just attempted creating my first Arch Linux package and I'm after some feedback as a sanity check before I post it onto the AUR.
The package is for Longview, a system monitoring agent for Linode customers...
https://www.linode.com/longview
https://www.linode.com/docs/platform/longview
https://github.com/linode/longview
And this is what I've come up with.
PKGBUILD
# Maintainer: Slithery <aur at slithery dot uk>
pkgname=longview
pkgver=1.1.4
pkgrel=1
pkgdesc="A system monitoring agent for Linode customers."
arch=('any')
url="https://github.com/linode/$pkgname"
license=('GPL2')
depends=('perl-libwww' 'perl-crypt-ssleay' 'perl-io-socket-inet6' \
'perl-linux-distribution' 'perl-json-pp' 'perl-json' \
'perl-log-loglite' 'perl-try-tiny' 'perl-dbi')
optdepends=('perl-dbd-mysql: MySQL support')
install=longview.install
source=($url/archive/v$pkgver.tar.gz)
sha256sums=('735811fd9118af91f03a4659d7aaa1b9ccb1c29043ebc97dfeb4b08994a18638')
build() {
msg2 "Converting headers."
h2ph -d "$srcdir/$pkgname-$pkgver" /usr/include/syscall.h
h2ph -d "$srcdir/$pkgname-$pkgver" /usr/include/sys/syscall.h
h2ph -d "$srcdir/$pkgname-$pkgver" /usr/include/asm/unistd.h
h2ph -d "$srcdir/$pkgname-$pkgver" /usr/include/asm/unistd_32.h
h2ph -d "$srcdir/$pkgname-$pkgver" /usr/include/asm/unistd_64.h
h2ph -d "$srcdir/$pkgname-$pkgver" /usr/include/bits/wordsize.h
h2ph -d "$srcdir/$pkgname-$pkgver" /usr/include/bits/syscall.h
}
package() {
cd "$pkgdir"
install -d -m755 "opt/linode"
cp -dpr --no-preserve=ownership "$srcdir/$pkgname-$pkgver" "opt/linode/$pkgname"
msg2 "Installing configuration files."
install -D -m600 "opt/linode/$pkgname/Extras/conf/Apache.conf" "etc/linode/longview.d/Apache.conf"
install -D -m600 "opt/linode/$pkgname/Extras/conf/MySQL.conf" "etc/linode/longview.d/MySQL.conf"
install -D -m600 "opt/linode/$pkgname/Extras/conf/Nginx.conf" "etc/linode/longview.d/Nginx.conf"
touch "etc/linode/longview.key"
chmod 600 "/etc/linode/longview.key"
msg2 "Installing service"
install -D -m644 "opt/linode/$pkgname/Extras/init/longview.service" "usr/lib/systemd/system/longview.service"
msg2 "Deleting unneeded files."
rm -rf "opt/linode/$pkgname/debian"
rm -rf "opt/linode/$pkgname/Extras/conf"
rm -rf "opt/linode/$pkgname/Extras/init"
rm "opt/linode/$pkgname/Extras/install-dependencies.sh"
}longview.install
post_install() {
cat << 'EOM'
Before starting the Longview service, paste the Longview
API key for this client into /etc/linode/longview.key
For Apache, MariaDB and Nginx plugin configuration please see the
documentation at https://www.linode.com/docs/platform/longview
EOM
}The original manual installation script that this has been derived from can be found here.
At first the package installed OK but threw errors when I tried to run it. I realised that perl-log-loglite and its dependency perl-io-lockedfile were both orphaned and hadn't been updated in over 5 years so even though the versions were current the PKGFILES were out of date. After adopting them and updating them to the latest packaging guidelines I now have a working longview package.
I'm just after some feedback from all of you packaging experts out there in case I've done anything stupid, I don't want to be doing lots of minor edits after I've submitted the package.
Last edited by Slithery (2014-10-13 23:22:53)
Offline
The only big thing I see is that etc/linode/longview.key needs to be in the backup array or it will be overwritten with the blank file on each upgrade. I think the chmod command is wrong, too, as you included the leading slash.
Beyond that, everything should work, but could be simplified. You don't need the forward slashes when defining the dependencies, a bash array will treat a return as any other whitespace. You could combine all of the rm's into one command. You could even install all of the conf files with one command (after creating the dir, which could be done with the same command where you create opt/linode). The msg2's really aren't needed for anything beyond debugging.
Overall, it looks pretty good.
Offline
Things like this are not needed:
msg2 "Installing configuration files."Offline