You are not logged in.

#1 2012-01-16 04:53:04

Relish
Member
Registered: 2012-01-16
Posts: 13

[SCRIPT]: Build AUR Packages With Ease

I just started to use Arch, and coming from Ubuntu/Debian, it was a bit of a shock, but Arch does grow on you.  One of it's strengths is the AUR.  When I first found out about it, I was all like, "HOLY $#!% ITS MACPORTS FOR LINUX."  Turns out is isn't quite as easy to use, but it works.  Walking into Arch, the only languages I was comfortable writing code in were C/Objective-C.  Tonight I learned a little bash and wrote this wrapper around makepkg.  Tell me what you think.  The only thing missing that I can think of is dependency resolving, but I didn't want to put in the work for that just yet.

#! /bin/bash

ROOT=`pwd`
BUILDDIR=pkgbuild
NAME=$2
PREFIX=`expr ${NAME:0:2}`
URL=http://aur.archlinux.org/packages/$PREFIX/$NAME/$NAME.tar.gz

echo Package URL is $URL

setup() {
	mkdir -p $BUILDDIR/$NAME
	cd $BUILDDIR
}

download() {
	curl $URL | gunzip | tar -x
	cd $NAME
}

build() {
	makepkg -s 1>/dev/null
}

install() {
	makepkg -si 1>/dev/null
}

clean() {
	cd $ROOT/$BUILDDIR
	rm -rf $NAME
}

allclean() {
	cd $ROOT
	rm -rf $BUILDDIR
}

case $1 in
	install)
		setup
		download
		install
		;;
	build)
		setup
		download
		build
		;;
	clean)
		clean
		;;
	allclean)
		allclean
		;;
	*)
		echo "Usage:"
		echo $0 "{install|build|clean|allclean} <package>"
		;;
esac

Here is the command syntax:

Usage:
./archpkg {install|build|clean|allclean} <package>

Last edited by Relish (2012-01-16 05:31:33)

Offline

#2 2012-01-16 05:21:29

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SCRIPT]: Build AUR Packages With Ease

Relish wrote:

Here are the command synaptics:

I think you mean 'command syntax' :-)


You can try to get the BUILDDIR from makepkg.conf.

Last edited by karol (2012-01-16 05:23:18)

Offline

#3 2012-01-16 05:32:43

Relish
Member
Registered: 2012-01-16
Posts: 13

Re: [SCRIPT]: Build AUR Packages With Ease

karol wrote:
Relish wrote:

Here are the command synaptics:

I think you mean 'command syntax' :-)


You can try to get the BUILDDIR from makepkg.conf.

Yes smile
I can't seem to find that entry in makepkg.conf.

Offline

#4 2012-01-16 05:34:45

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SCRIPT]: Build AUR Packages With Ease

[karol@black ~]$ grep ^BUILDDIR /etc/makepkg.conf
BUILDDIR=/home/karol/test/makepkg

It may be commented out, as

#BUILDDIR=/tmp/makepkg

is the default.

Last edited by karol (2012-01-16 05:35:17)

Offline

#5 2012-01-16 05:38:25

Relish
Member
Registered: 2012-01-16
Posts: 13

Re: [SCRIPT]: Build AUR Packages With Ease

Ah.  Why didn't I think of that.  I might add the option to select that as the build dir as soon as I decipher some more bash tutorials.

Offline

#6 2012-01-16 07:13:44

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: [SCRIPT]: Build AUR Packages With Ease

If you'd llike to see similar scripts (in various languages), as examples/guidance/whatever, check out the AUR Helpers page in the wiki.

Offline

Board footer

Powered by FluxBB