You are not logged in.

#1 2008-11-23 03:08:39

Ranguvar
Member
Registered: 2008-08-12
Posts: 2,549

Making my first PKGBUILD - a cursor theme

Hello,

I'm writing my first PKGBUILD, for a cursor theme: http://www.gnome-look.org/content/show. … tent=88322

I'm basing the PKGBUILD off the ones for other xcursor themes in the AUR and community repo.

So far, I have:

#Maintainer: Devin Cofer <ranguvar[AT]archlinux{DOT}us>

pkgname=xcursor-dart3d
_pkgname=Dart3D_LHPPL
pkgver=1.0
pkgrel=1
pkgdesc="Dark, glassy X cursor theme"
arch=('i686' 'x86_64')
url="http://www.gnome-look.org/content/show.php?content=88322"
license=('GPL')
depends=()
source=("http://www.gnome-look.org/CONTENT/content-files/88322-${_pkgname}.tar.gz")
md5sums=('d65dbf7101ef6679f5d3fe91def5cd9f')

build() {
    cd $startdir/src/$_pkgname
    install -d -m755 $startdir/pkg/usr/share/icons/${_pkgname}/cursors/filesources
    install -D -m644 $startdir/src/${_pkgname}/index.theme \
                    $startdir/pkg/usr/share/icons/${_pkgname}
    cd $startdir/src/${_pkgname}/cursors
    for i in * ; do
        install -D -m644 $i $startdir/pkg/usr/share/icons/${_pkgname}/cursors
    done
}

The build() block is unchanged from the PKGBUILD I copied it from.

I'm unsure what to put for the build() block. I can see they're using the install command, but I'm not sure why, or why they're choosing permissions...

Could someone please explain to me in detail what that block does and why? And/or if I should change it for my PKGBUILD, and why?

I did read the info about making packages on the wiki.

Thanks very much, I promise the knowledge will be put to good use helping users smile

Offline

#2 2008-11-23 08:30:58

Snowman
Developer/Forum Fellow
From: Montreal, Canada
Registered: 2004-08-20
Posts: 5,212

Re: Making my first PKGBUILD - a cursor theme

'man install' will give you all the info. Basically, install command copy files and let you set the wanted permissions.

install -d -m755 $startdir/pkg/usr/share/icons/${_pkgname}/cursors/filesources
creat a directory with 755 perms.

install -D -m644 $startdir/src/${_pkgname}/index.theme \
                    $startdir/pkg/usr/share/icons/${_pkgname}
copy $startdir/src/${_pkgname}/index.theme to $startdir/pkg/usr/share/icons/${_pkgname}, set perm to 644 and create directory as needed.

Whether you need to change them in your build function depends on what files you want to copy and where.

Offline

#3 2008-11-23 13:25:05

Ranguvar
Member
Registered: 2008-08-12
Posts: 2,549

Re: Making my first PKGBUILD - a cursor theme

Yeah, I see, but why are they setting permissions? Would not a simple copy suffice? And why such an odd method of copying, like the for loop?

Offline

#4 2008-11-23 13:42:21

foutrelis
Developer
From: Athens, Greece
Registered: 2008-07-28
Posts: 705
Website

Re: Making my first PKGBUILD - a cursor theme

Ranguvar wrote:

Yeah, I see, but why are they setting permissions? Would not a simple copy suffice?

If the user has altered his file mode creation mask (umask), wrong permissions will be set on the copied file/folder. For example, if umask is set to 0077, nobody but the owner (usually root) will have access to those files. Therefore, specifying the target file's permissions is the safer (read "only") way to go.

Ranguvar wrote:

And why such an odd method of copying, like the for loop?

I'd assume it's because `install' doesn't allow recursive copying.

Offline

#5 2008-11-23 14:09:45

Ranguvar
Member
Registered: 2008-08-12
Posts: 2,549

Re: Making my first PKGBUILD - a cursor theme

OK... thanks...

Offline

#6 2008-11-23 20:19:35

Snowman
Developer/Forum Fellow
From: Montreal, Canada
Registered: 2004-08-20
Posts: 5,212

Re: Making my first PKGBUILD - a cursor theme

I think you can remove the loop if you create first the target directory. so you would replace:
    for i in * ; do
        install -D -m644 $i $startdir/pkg/usr/share/icons/${_pkgname}/cursors
    done
by:
install -d -m755 $startdir/pkg/usr/share/icons/${_pkgname}/cursors
install -m644 * $startdir/pkg/usr/share/icons/${_pkgname}/cursors/

In this specific exemple, the directory was created previously so you could replace the loop by:
install -m644 * $startdir/pkg/usr/share/icons/${_pkgname}/cursors/

I might be wrong. You should verify it.

Offline

Board footer

Powered by FluxBB