You are not logged in.

#1 2010-04-08 04:25:01

blazercist
Member
Registered: 2009-01-18
Posts: 20

Criticize my first ever PKGBUILD (fluxbb)

So I went to put a forum on a website I was working on and what better forum engine to use than the very same one bbs uses...  and then I realize there's no PKGBUILD in ABS or AUR for fluxbb, so I decided to make a simple one.  Please keep in mind this is my first so be gentle.


Also, let me know if you think it should be more interactive: for example /srv/http is not everyone's base webserver directory and people may want to change the name of "/upload" to something more fitting like "/forums".

# Contributor: DefunctProcess <blazercist@gmail.com>
pkgname=fluxbb
pkgver=1.2.22
pkgrel=1
pkgdesc="The forum engine that archlinux.org uses."
arch=('i686' 'x86_64')
url="fluxbb.org"
license=('GPL')
groups=()
depends=()
makedepends=()
optdepends=()
provides=()
conflicts=()
replaces=()
backup=()
options=()
install=
source=(http://fluxbb.org/download/releases/$pkgver/$pkgname-$pkgver.tar.gz)
noextract=()
md5sums=('6fac6a426be6c263abe545e3656e5493')

build() {
  cd "$srcdir/$pkgname-$pkgver"

#Modifying permissions of subdirectories in upload
  chmod 777 upload/cache || echo "Error: you must manually chmod 777 /upload/cache"
  chmod 777 upload/img/avatars || echo "Error: you must manually chmod 777 /upload/img/avatars"

#Creating install path
  mkdir -p \
    "$pkgdir/srv/http/upload" \ || return 1

 #Copying...
  cp -R $srcdir/$pkgname-$pkgver/upload $pkgdir/srv/http/
}

Last edited by blazercist (2010-04-08 04:42:27)

Offline

#2 2010-04-08 04:28:30

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,362

Re: Criticize my first ever PKGBUILD (fluxbb)

You should put the PKGBUILD in code-blocks smile


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#3 2010-04-08 04:42:57

blazercist
Member
Registered: 2009-01-18
Posts: 20

Re: Criticize my first ever PKGBUILD (fluxbb)

ngoonee, done and done wink

Offline

#4 2010-04-08 05:27:34

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,672
Website

Re: Criticize my first ever PKGBUILD (fluxbb)

Here we go...

1) get rid of all empty values.  e.g. conflicts=()
2) I'm sure it has some dependencies....
3) I would copy the files to PKGDEST and then adjust the permissions.  And just error out instead of the message.
4) as you noted /srv/http/upload seems a strange path.   /srv/http/fluxbb perhaps?

Offline

#5 2010-04-08 10:31:56

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,237
Website

Re: Criticize my first ever PKGBUILD (fluxbb)

IMHO....

# Contributor: DefunctProcess <blazercist@gmail.com>

You are the Maintainer, not a past contributor smile

source=(http://fluxbb.org/download/releases/$pkgver/$pkgname-$pkgver.tar.gz)

Double quote the URL.... If nothing else, it improves readability when using an editor with syntax highlighting.

  chmod 777 upload/cache || echo "Error: you must manually chmod 777 /upload/cache"
  chmod 777 upload/img/avatars || echo "Error: you must manually chmod 777 /upload/img/avatars"

1) Change the echo to 'return 1' like you've done in other places. Let the chmod error message give feedback to the user.
2) chmod 777 is BAD. chown and/or chgrp and chmod g+w the directories to '33' (http) instead.

  mkdir -p \
    "$pkgdir/srv/http/upload" \ || return 1

Don't bother wrapping lines like this.

Just my HO, otherwise quite good for a first PKGBUILD smile

Offline

#6 2010-04-08 10:50:13

flamelab
Member
From: Athens, Hellas (Greece)
Registered: 2007-12-26
Posts: 2,160

Re: Criticize my first ever PKGBUILD (fluxbb)

/srv should not be included into the PKGBUILD.

Package should not contain following directories:

    * /dev
    * /home
    * /srv
    * /media
    * /mnt
    * /proc
    * /root
    * /selinux
    * /sys
    * /tmp
    * /var/tmp

He could move everything to /opt, and then add a message printed through .install file that would give instructions for manual moving to /srv.

Offline

#7 2010-04-08 11:50:45

Profjim
Member
From: NYC
Registered: 2008-03-24
Posts: 658

Re: Criticize my first ever PKGBUILD (fluxbb)

flamelab wrote:

/srv should not be included into the PKGBUILD.
...
He could move everything to /opt, and then add a message printed through .install file that would give instructions for manual moving to /srv.

I'd prefer /usr/share/fluxbb to /opt/fluxbb.

Offline

#8 2010-04-08 13:53:07

Pierre
Developer
From: Bonn
Registered: 2004-07-05
Posts: 1,967
Website

Re: Criticize my first ever PKGBUILD (fluxbb)

Right, never install anything to /srv; it's like /home for services. For such arch independent apps you have to install it into /usr/share. But the software itself shouldn't alter any files there (like the upload dir). Put those into /var.

Most web apps cannot be packaged correctly which is the reason why we don't provide any. I would recommend to use your own vcs like git for managing your web apps.

Offline

#9 2010-04-08 16:23:51

blazercist
Member
Registered: 2009-01-18
Posts: 20

Re: Criticize my first ever PKGBUILD (fluxbb)

Just to let you guys know (in case you didn't already) this isn't a binary, its just a collection of .php files that need to go into the base directory of your webserver.  So for lighttpd its /srv/http/ and for apache its /var/www/ I think... that's why I'm installing to /srv/http/.  This is also why I suggested the install should be more interactive (allowing the user to specify their directory of choice and renaming "upload" to something more appropriate).  Also, the reason for chmod 777 is because when I manually installed on my machine those two directories had the wrong permissions and when I went to complete the install by going to www.mywebsite.com/upload/install.php it explicitly suggested that I chmod 777 those two directories.

Perhaps I should do as flamelab says and just install to some arbitrary directory and echo instructions with the .install script, but then the PKGBUILD loses some of its automation.  So I'm torn as to what to do.

Fukawi2, thanks for the advice, I'll clean things up.

Ok, so I'm going to submit the script to AUR soon, I'm going to wait a few hours for any last minute objections/suggestions.

Offline

#10 2010-04-08 17:42:59

Profjim
Member
From: NYC
Registered: 2008-03-24
Posts: 658

Re: Criticize my first ever PKGBUILD (fluxbb)

Yes, I think everyone was assuming it was just some php files, not a binary. You should still not install anything to /srv. Users should be free to write/edit anything under that directory. Install to /usr/share/whatever and tell users how to copy to/link from /srv/whatever.

And despite what the php scripts tell you, finding some solution that doesn't require the directories to be world-writeable will be much more secure than making them 777.

Last edited by Profjim (2010-04-08 17:43:47)

Offline

Board footer

Powered by FluxBB