Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archbuild
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2010-08-20 12:41:39 +0200
committerPierre Schmitz <pierre@archlinux.de>2010-08-20 12:41:39 +0200
commit9b001033aed89e534a6c7d667326fd45496e9f71 (patch)
tree40f393525ee7b1970cfb7a78b778ebdf38cde457 /archbuild
parentae5083fc118c6a708eec7f7c357ce8363eb2d78a (diff)
Add archbuild helper script to create and build in chroots
This will create chroots on demand if needed.
Diffstat (limited to 'archbuild')
-rwxr-xr-xarchbuild41
1 files changed, 41 insertions, 0 deletions
diff --git a/archbuild b/archbuild
new file mode 100755
index 0000000..ef62ca7
--- /dev/null
+++ b/archbuild
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+cmd="$(basename "${0%-build}")"
+repo=${cmd%-*}
+arch=${cmd#*-}
+chroots='/var/tmp/archbuild'
+clean_first=false
+
+usage() {
+ echo "usage $(basename "$0")"
+ echo ' -c Recreate the chroot before building'
+ echo ' -r <dir> Create chroots in this directory'
+ exit 1
+}
+
+while getopts 'cr:' arg; do
+ case "${arg}" in
+ c) clean_first=true ;;
+ r) chroots="$OPTARG" ;;
+ *) usage ;;
+ esac
+done
+
+if [ "$(uname -m)" == 'i686' -a "${arch}" != 'i686' ]; then
+ echo 'You can only build i686 packages on this system'
+ exit 1
+fi
+
+if ${clean_first} || [ ! -d "${chroots}/${repo}-${arch}" ]; then
+ echo "Creating chroot for [${repo}] (${arch})..."
+ sudo rm -rf ${chroots}/${repo}-${arch}
+ sudo mkdir -p ${chroots}/${repo}-${arch}
+ setarch ${arch} sudo mkarchroot \
+ -C /usr/share/devtools/pacman-${repo}.conf \
+ -M /usr/share/devtools/makepkg-${arch}.conf \
+ ${chroots}/${repo}-${arch}/root \
+ base base-devel sudo
+fi
+
+echo "Building in chroot for [${repo}] (${arch})..."
+setarch ${arch} sudo makechrootpkg -c -u -r ${chroots}/${repo}-${arch}