You are not logged in.

#1 2013-02-02 22:56:43

Salan54
Member
Registered: 2011-09-06
Posts: 25

ZuluCrypt - My first package

I recently discovered the zuluCrypt project (http://code.google.com/p/zulucrypt/) aimed to manage LUKS, PLAIN and (with the last cryptsetup version) TRUECRYPT volumes.
I found it interesting and decided to package and upload it to the AUR.
As it is my first package, I would like you to review and comment my PKGBUILD before publishing.
I test it on 3 different arch machines and it builds and installs without problems, but I would be certain that I didn't make any beginner's mistakes.
Thanks a lot for your advices and your time

# Maintainer: Salan54 <salan at fremenil dot com>
# Created: 01/29/2013
pkgname=zulucrypt
pkgver=4.6.1
pkgrel=1
pkgdesc="a cli and gui frontend to cryptsetup."
url="http://code.google.com/p/zulucrypt/"
arch=('x86_64' 'i686')
license=('GPL2')
depends=('cryptsetup' 'qt' 'libpwquality' 'libgnome-keyring')
optdepends=('kdeutils-kwallet: retrieve volume keys from kde kwallet')
makedepends=('cmake')
options=('!buildflags')
conflicts=()
replaces=()
backup=()
source=("http://zulucrypt.googlecode.com/files/${pkgname}-${pkgver}.tar.bz2")
md5sums=('1d64bd3f13956051e9f9e16f76c50134')
changelog='changelog'
install='.install'

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  mkdir build
  cd build
  cmake -DCMAKE_INSTALL_PREFIX=/usr/ -DNOKDE=true -DCMAKE_BUILD_TYPE=release . ..
  make
}
 
package() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  cd build
  make DESTDIR="$pkgdir/" install
}

Here is the .install :

post_install() {
    update-desktop-database -q
}

For the changelog, I initially had :

changelog="${srcdir}/${pkgname}-${pkgver}/changelog" 

but it didn't work and I decided to hard-copy the changelog file in the top directory (along with PKGBUILD and .install).

Offline

#2 2013-02-02 23:05:48

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,449
Website

Re: ZuluCrypt - My first package

Doesn't .install have to be in the source (and checksum) arrays?


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2013-02-02 23:25:51

tdy
Member
From: Sacremende
Registered: 2008-12-14
Posts: 440

Re: ZuluCrypt - My first package

It shouldn't be be in source/checksums, but I've never seen it as a hidden file either (although technically it works). Usually it's $pkgname.install or at least <something>.install.

Offline

#4 2013-02-02 23:27:12

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: ZuluCrypt - My first package

Salan54 wrote:
# Created: 01/29/2013
conflicts=()
replaces=()
backup=()

install='.install'

There should be no empty variables in the PKGBUILD, so remove "conflicts", "replaces" and "backup". The install script by convention uses the same name as the package with ".install" appended as an extension. In this case, it should be named "zulucrypt.install" and you can use "install=$pkgname.install" in the PKGBUILD.

As for the "Created:" line, that's not necessary, but if you are going to use dates, please use an ISO 8601 date format (e.g. YYYY-MM-DD).

Salan54 wrote:
build() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  mkdir build
  cd build
  cmake -DCMAKE_INSTALL_PREFIX=/usr/ -DNOKDE=true -DCMAKE_BUILD_TYPE=release . ..
  make
}

You should use "mkdir -p build" to avoid errors when the build directory already exists (e.g. when rebuilding the package). Some package may even require that you remove the old build directory before trying to rebuild, in which case you could use

[[ -e build ]] && rm -fr build
mkdir build

where you obviously don't need the "-p" option if you know that the directory does not exist.

Salan54 wrote:
package() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  cd build
  make DESTDIR="$pkgdir/" install
}

You can remove the slash ("/") after $pkgdir in the "make" line.

Salan54 wrote:

Here is the .install :

post_install() {
    update-desktop-database -q
}

Add the following after post_install to update the desktop database when the package is upgraded or removed:

post_upgrade() {
  post_install
}
post_remove() {
  post_install
}
Salan54 wrote:

For the changelog, I initially had :

changelog="${srcdir}/${pkgname}-${pkgver}/changelog" 

but it didn't work and I decided to hard-copy the changelog file in the top directory (along with PKGBUILD and .install).

I think the changelog is meant to be the package changelog created by the package maintainer, not the upstream changelog, but I am not sure.


Other than that, everything looks fine. Kudos for properly quoting variables. That's one of the most common things that I see people forget to do.



Trilby wrote:

Doesn't .install have to be in the source (and checksum) arrays?

.install files are not considered sources.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#5 2013-02-02 23:28:33

tdy
Member
From: Sacremende
Registered: 2008-12-14
Posts: 440

Re: ZuluCrypt - My first package

Xyne wrote:
Salan54 wrote:
package() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  cd build
  make DESTDIR="$pkgdir/" install
}

You can remove the slash ("/") after $pkgdir in the "make" line.

Just to follow up for the OP's future reference, this is included in the abs PKGBUILD prototype just in case of a poorly written makefile, e.g., defining BINDIR=usr/bin and then referencing $(DESTDIR)$(BINDIR). If you've found that the trailing slash isn't needed, it's fine to remove.

Last edited by tdy (2013-02-02 23:38:35)

Offline

#6 2013-02-02 23:30:46

Salan54
Member
Registered: 2011-09-06
Posts: 25

Re: ZuluCrypt - My first package

You are right, I will rename it to package-name.install
Thanks

Offline

#7 2013-02-03 12:45:38

Salan54
Member
Registered: 2011-09-06
Posts: 25

Re: ZuluCrypt - My first package

Thanks everybody for your advice. Here are the PKGBUILD and install files revised according to your recommendations. I think the package is now ready to be published on AUR. Thank you again.

# Maintainer: Salan54 <salan at fremenil dot com>
# Created: 2013-01-29
pkgname=zulucrypt
pkgver=4.6.1
pkgrel=1
pkgdesc="a cli and gui frontend to cryptsetup."
url="http://code.google.com/p/zulucrypt/"
arch=('x86_64' 'i686')
license=('GPL2')
depends=('cryptsetup' 'qt' 'libpwquality' 'libgnome-keyring')
optdepends=('kdeutils-kwallet: retrieve volume keys from kde kwallet')
makedepends=('cmake')
options=('!buildflags')
source=("http://zulucrypt.googlecode.com/files/${pkgname}-${pkgver}.tar.bz2")
md5sums=('1d64bd3f13956051e9f9e16f76c50134')
changelog=${pkgname}.changelog
install=${pkgname}.install

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  mkdir -p build
  cd build
  cmake -DCMAKE_INSTALL_PREFIX=/usr/ -DNOKDE=true -DCMAKE_BUILD_TYPE=release . ..
  make
}
 
package() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  cd build
  make DESTDIR="$pkgdir" install
}
 
# vim:set ts=2 sw=2 et:
$ cat zulucrypt.install 
post_install() {
    update-desktop-database -q
}
post_upgrade() {
  post_install
}
post_remove() {
  post_install
}

Offline

Board footer

Powered by FluxBB