You are not logged in.
Hi all, I'm fairly new to Arch (a week or two) and I'm working on creating my first real package. I came from Slackware and I'm used to using a utility called superformat to format DOS floppies and stuff, I know I can use fdformat/mformat but I really like superformat. So, I figured I'd make a package for it and of course I'd be more than willing to share it with anyone that was interested. Generally the package building system seems pretty easy but fdutils (which contains superformat) has presented a few issues that I'd like advice on handling.
First, here is my PKGBUILD which for my system only I'm pretty happy with but others might not be as pleased with some of my choices.
pkgname=fdutils
pkgver=5.4
pkgrel=1
pkgdesc="A collection of floppy disk/drive utils."
url="http://www.tux.org/pub/knaff/fdutils/"
license=""
depends=()
makedepends=('tetex' 'texinfo')
conflicts=()
replaces=()
backup=()
install=
source=(http://www.tux.org/pub/knaff/fdutils/$pkgname-$pkgver.tar.gz)
md5sums=('17c1df04b1e524078ee52825a5ef5e56')
build() {
cd $startdir/src/$pkgname-$pkgver
# patch to change group ownership (gid) from floppy which doesn't
# exist by default in Arch to root which does
patch -Np1 -i ../../floppy-gid.patch || return 1
./configure --prefix=/usr
make || return 1
mkdir -p $startdir/pkg/usr/bin
mkdir -p $startdir/pkg/usr/man/man1
mkdir -p $startdir/pkg/usr/man/man4
make prefix=$startdir/pkg/usr install
# /usr/bin/setfdprm is already there courtesy of util-linux
# /usr/bin/man4/fd.4(.gz) is already there courtesy of man-pages
rm -f $startdir/pkg/usr/bin/setfdprm
rm -f $startdir/pkg/usr/man/man4/fd.4
}
Now, first you'll notice that I had to make a patch because by default the fdutils package installs everything as root:floppy and Arch doesn't have a floppy group by default so I figured I'd just change it to root:root rather than telling people to create a floppy group before installing or whatever, I think the use of groups like that should be up to the user/admin anyway. Here is the patch:
diff -Naur fdutils-5.4-orig/src/Makefile.in fdutils-5.4/src/Makefile.in
--- fdutils-5.4-orig/src/Makefile.in 2000-05-27 11:41:54.000000000 -0500
+++ fdutils-5.4/src/Makefile.in 2004-10-24 03:10:28.000000000 -0500
@@ -51,7 +51,7 @@
#we only people in group floppy to run priviledged programs
MANPERM = 644
UID = root
-GID = floppy
+GID = root
Next, I had to pre-create some directory structure - no biggie there and the package seemed to build fine but when I tried to pacman the thing I got the message that it wanted to overwrite /usr/bin/setfdprm and /usr/man/man4/fd.4.gz and the installation bombed. Now, of course I could have forced it with pacman -f but again, if others wanted to use the package that's no good so I just rm'd the offending files and rebuilt the package. This time it built and installed fine. The manpage for fd is actually a few years newer in fdutils vs man-pages but I doubt that it matters much - I don't know about the setfdprm but if the one from base/util-linux does the job I'm inclined to leave it alone - I don't use it.
Questions:
Is the patch an OK way to handle the root:floppy / root:root issue?
Is removing the files before packaging OK, I figured this was best because the conflicting files are actually part of 'base' so that should be off limits for extra packages such as this - que no?!
Thanks for more experienced insights or even inexperienced opinions. Oh, I can post namcap output and/or a log of the build if it would help / be interesting.
--
Regards, G.S.
Offline
as for handling root:floppy and root:root, this question comes up alot when dealing with daemons and things.... i think its kinda unresolved at the moment, so do what you want (you can make an install script to create the group, postinstall, if you want)
as for the patch, put it in the source array (relative path from the PKGBUILD) just to be consistent
Offline
The patch looks pretty simple. Its one way to do things; but another option would be to use sed to alter the file(s) in question. This way you don't have to ship other files with your PKGBUILD.
Nice first attempt!
Dusty
Offline
Question for phrakture: what do you mean by putting the patch in the source array? Something like 'mv floppy-gid.patch $startdir/src'?
As for the group thing, I think it's probably best to leave it up to the individual whether they want a 'floppy' group or not, so since it's not explicitly defined that's what I'll go with for now.
For Dusty: thanks for the encouragement, I'm very impressed with almost everything about Arch so far, the package build system is no exception.
As far as using sed - I think I'll just leave it as a patch for now, I see your point but I kind of like the patch system.
I've been looking at a lot of PKGBUILDs lately and tried to use them as a model, I've also looked at all the docs I could find in the wiki, this forum and elsewhere.
Any opinions on overwriting the files? I'm almost certain that my philosophy of not overwriting something contained in a 'base' package is right and like it says in the pacman manpage -f should seldom be used, preferably not at all or something like that.
Offline
source=(http://www.tux.org/pub/knaff/fdutils/$pkgname-$pkgver.tar.gz floppy-gid.patch)
As for overwriting files, pacman won't allow it unless you force it. So anyone forcing knows they are taking a risk. I think removing the files works fine, however I still feel it's a bit of a hack... I made a bittornado-curses package and simple removed the gui elements....
Offline
source=(http://www.tux.org/pub/knaff/fdutils/$pkgname-$pkgver.tar.gz floppy-gid.patch)
As for overwriting files, pacman won't allow it unless you force it. So anyone forcing knows they are taking a risk. I think removing the files works fine, however I still feel it's a bit of a hack... I made a bittornado-curses package and simple removed the gui elements....
err like this looks neater....
source=(http://www.tux.org/pub/knaff/fdutils/$pkgname-$pkgver.tar.gz
floppy-gid.patch)
Mr Green
Offline
Mr. Green or Mr. Perfect?!*
Anyway, I see now what phrakture means. I didn't realize it could be done that way.
I also agree that it _is_ a hack but personally I prefer it to pacman errors or warnings or whatever they'd be considered. Removing files does seem to be an oft used hack though, I've seen it quite a few times while perusing the cvs.
Thanks again for all the input, I doubt if there's much call for this package anyway - unless you're used to superformat and actually still use floppies as much as I do.
--
G.S.
* Due respect given to Curt Hennig (RIP)
Offline
np... Welcome to Arch
Mr Green
Offline
As far as using sed - I think I'll just leave it as a patch for now, I see your point but I kind of like the patch system.
I know what you mean.... I don't like sed very much and I *always* have to look up an example to get it to work in a PKGBUILD. However, it does reduce the number of files needed, and its always a benefit to be able to ship a PKGBUILD without additional files.
Dusty
Offline
sed is just plain nasty - i usually have my O'Rielly "sed and awk Pocket Reference" on my desk....
Offline
In this case it was just a simple substitution, only occurrence in the file so I used global, etc. - I went ahead and made the change - here's a snippet:
build() {
cd $startdir/src/$pkgname-$pkgver
# Change default group ownership from floppy to root
sed -i.orig 's/GIDt= floppy/GIDt= root/g'
$startdir/src/$pkgname-$pkgver/src/Makefile.in
./configure --prefix=/usr
You're right though, sed gets pretty nasty - the patch was a lot easier but the self contained PKGBUILD idea won out. Just looking back at the snippet in this post though I should match beginning (^) and end ($) of the line, bah - I'll fix it later.
Offline