summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2015-10-24 21:11:53 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2015-10-24 21:11:53 +0200
commit392d766c982cc1e6e53259fc65f6e1db1b1ee8db (patch)
tree3063b3e18286351b5545193dfee1018318d712fb
parentca2ca055e6281ee2b95285199f6ee2d8c1f46889 (diff)
downloadbiruda-392d766c982cc1e6e53259fc65f6e1db1b1ee8db.tar.gz
biruda-392d766c982cc1e6e53259fc65f6e1db1b1ee8db.tar.bz2
added ArchLinux gold build script (preliminary) and fixed Centos 6 script
-rw-r--r--examples/build_gold_image/README38
-rw-r--r--examples/build_gold_image/biruda.conf26
-rwxr-xr-xexamples/build_gold_image/build_archlinux.sh53
-rwxr-xr-xexamples/build_gold_image/build_centos6.sh8
4 files changed, 102 insertions, 23 deletions
diff --git a/examples/build_gold_image/README b/examples/build_gold_image/README
index b2ba636..8337c33 100644
--- a/examples/build_gold_image/README
+++ b/examples/build_gold_image/README
@@ -1,6 +1,10 @@
Requirements
------------
+In this example we use Centos6, but of course this should work with
+all Linux distributions recent enough to run on the kernel of the
+host.
+
Your distribution needs a running 'rpm', so on ArchLinux this can be
achieved by installing 'rpm-org'. You also need a running 'yum' which
on ArchLinux you can build from the AUR.
@@ -21,39 +25,39 @@ shell> biruda -i -c biruda.conf
biruda> status
coordinator eeepc cpe:/o:arch:arch:rolling x86_64 1 alive 1428133209 (0)
-worker example_build_gold stopped direct /bin/sh ./build_centos6.sh x86_64 (0)
-worker example_run stopped direct /bin/chroot rhel6-x64 /bin/bash -c '/bin/cat /etc/redhat-release' (1)
+worker example_build_centos6 stopped direct /bin/sh ./build_centos6.sh x86_64 (0)
+worker example_uname_centos6 stopped direct /bin/chroot rhel6-x64 /bin/bash -c '/bin/cat /etc/redhat-release' (1)
We see one coordinator running on ArchLinux ('cpe:/o:arch:arch:rolling')
-and two workers: 'example_build_gold' builds the image, 'example_run'
+and two workers: 'example_build_gold' builds the image, 'example_uname_centos6'
runs a command in the chrooted Centos.
We start the first worker by calling:
biruda> start
-worker> example_build_gold
+worker> example_build_centos6
Request queued
The 'messages' command shows us the output of the worker:
biruda> messages
-output example_build_gold:
-1428133254 example_build_gold --- STARTED 19698 ---
-1428133255 example_build_gold stderr --2015-04-04 09:40:55-- http://mirror.centos.org/centos/6.6/os/x86_64/Packages/centos-release-6-6.el6.centos.12.2.x86_64.rpm
-1428133255 example_build_gold stderr Resolving mirror.centos.org (mirror.centos.org)... 95.211.98.141
+output example_build_centos6:
+1428133254 example_build_centos6 --- STARTED 19698 ---
+1428133255 example_build_centos6 stderr --2015-04-04 09:40:55-- http://mirror.centos.org/centos/6.6/os/x86_64/Packages/centos-release-6-6.el6.centos.12.2.x86_64.rpm
+1428133255 example_build_centos6 stderr Resolving mirror.centos.org (mirror.centos.org)... 95.211.98.141
..
-The daemon spools the output of a worker in a file 'example_build_gold.output',
+The daemon spools the output of a worker in a file 'example_build_centos6.output',
you can also have a look at that:
-shell> tail -f example_build_gold.output
+shell> tail -f example_build_centos6.output
The worker is now running:
biruda> status
coordinator eeepc cpe:/o:arch:arch:rolling x86_64 1 alive 1428134192 (0)
-worker example_build_gold running direct /bin/sh ./build_centos6.sh x86_64 (0)
-worker example_run stopped direct /bin/chroot rhel6-x64 /bin/bash -c '/bin/cat /etc/redhat-release' (1)
+worker example_build_centos6 running direct /bin/sh ./build_centos6.sh x86_64 (0)
+worker example_uname_centos6 stopped direct /bin/chroot rhel6-x64 /bin/bash -c '/bin/cat /etc/redhat-release' (1)
We get the chrooted environment installed in the directory running the biruda
node in 'rhel6-x64':
@@ -67,13 +71,13 @@ When the installation has finished we can run the other worker which just
makes a cat of the Redhat version file '/etc/redhat-release':
biruda> start
-worker> example_run
+worker> example_uname_centos6
Request queued
biruda> messages
-output example_run:
-1428146958 example_run --- STARTED 12858 ---
-1428146958 example_run stdout CentOS release 6.6 (Final)
-1428146958 example_run --- STOPPED 12858 (0, <unknown error>)---
+output example_uname_centos6:
+1428146958 example_uname_centos6 --- STARTED 12858 ---
+1428146958 example_uname_centos6 stdout CentOS release 6.6 (Final)
+1428146958 example_uname_centos6 --- STOPPED 12858 (0, <unknown error>)---
Each outputline has a timestamp, the name of the worker executed,
whether the output went to stdout or stderr and the actual message.
diff --git a/examples/build_gold_image/biruda.conf b/examples/build_gold_image/biruda.conf
index 6171df0..aed8d53 100644
--- a/examples/build_gold_image/biruda.conf
+++ b/examples/build_gold_image/biruda.conf
@@ -15,7 +15,7 @@ coordinator
control = "tcp://localhost:5555"
}
-worker example_build_gold
+worker example_build_centos6
{
control = "tcp://localhost:5555"
@@ -26,7 +26,7 @@ worker example_build_gold
command = "/bin/sh ./build_centos6.sh ${ARCH}"
}
-worker example_run
+worker example_uname_centos6
{
control = "tcp://localhost:5555"
@@ -37,6 +37,28 @@ worker example_run
command = "/bin/chroot rhel6-${ARCH} /bin/bash -c '/bin/cat /etc/redhat-release && /bin/uname -m'"
}
+worker example_build_archlinux
+{
+ control = "tcp://localhost:5555"
+
+ data = "tcp://localhost:5556"
+
+ execution = direct
+
+ command = "/bin/sh ./build_archlinux.sh ${ARCH}"
+}
+
+worker example_uname_archlinux
+{
+ control = "tcp://localhost:5555"
+
+ data = "tcp://localhost:5556"
+
+ execution = direct
+
+ command = "/bin/chroot archlinux-${ARCH} /bin/bash -c '/bin/cat /etc/arch-release && /bin/uname -m'"
+}
+
webserver
{
threads = 4
diff --git a/examples/build_gold_image/build_archlinux.sh b/examples/build_gold_image/build_archlinux.sh
new file mode 100755
index 0000000..af0f485
--- /dev/null
+++ b/examples/build_gold_image/build_archlinux.sh
@@ -0,0 +1,53 @@
+#!/bin/sh
+
+# ArchLinux
+
+export PATH=/bin:/sbin:/usr/bin:/usr/sbin:${PATH}
+
+ARCH=$1
+
+if test "x$ARCH" = "x"; then
+ echo "One argument expected (architecture)" 1>&2
+ exit 1
+fi
+
+case $ARCH in
+ i686)
+ PACKAGE_ARCH=i386
+ ARCH_SWITCH=linux32
+ ;;
+
+ x86_64)
+ PACKAGE_ARCH=x86_64
+ ARCH_SWITCH=
+ ;;
+
+ *)
+ echo "Unsupported architecture '$ARCH'" 1>&2
+ exit 1
+esac
+
+CHROOT_DIR=archlinux-${ARCH}
+
+umount ${CHROOT_DIR}-mnt/proc
+umount ${CHROOT_DIR}-mnt
+
+rm -rf $CHROOT_DIR
+
+mkdir $CHROOT_DIR
+
+# pacstrap only installs into a mountpoint, so emulate one
+mkdir ${CHROOT_DIR}-mnt
+mount --bind ${CHROOT_DIR} ${CHROOT_DIR}-mnt
+
+${ARCH_SWITCH} pacstrap ${CHROOT_DIR}-mnt filesystem bash coreutils pacman
+
+mount -t proc proc ${CHROOT_DIR}/proc
+
+${ARCH_SWITCH} arch-chroot ${CHROOT_DIR} pacman --noconfirm -Syyu
+
+${ARCH_SWITCH} arch-chroot ${CHROOT_DIR} pacman -S --noconfirm make gcc cmake tar openssh git
+
+umount ${CHROOT_DIR}-mnt/proc
+umount ${CHROOT_DIR}-mnt
+rmdir ${CHROOT_DIR}-mnt
diff --git a/examples/build_gold_image/build_centos6.sh b/examples/build_gold_image/build_centos6.sh
index 3d4fd3b..08048bd 100755
--- a/examples/build_gold_image/build_centos6.sh
+++ b/examples/build_gold_image/build_centos6.sh
@@ -37,13 +37,13 @@ mkdir -p $CHROOT_DIR/var/lib/rpm
rpm -v --rebuilddb --root=`pwd`/$CHROOT_DIR
-wget http://mirror.centos.org/centos/6.6/os/${PACKAGE_ARCH}/Packages/centos-release-6-6.el6.centos.12.2.${ARCH}.rpm
+wget http://mirror.centos.org/centos/6.7/os/${PACKAGE_ARCH}/Packages/centos-release-6-7.el6.centos.12.3.${ARCH}.rpm
-rpm -v -i --root=`pwd`/$CHROOT_DIR --nodeps centos-release-6-6.el6.centos.12.2.${ARCH}.rpm
+rpm -v -i --root=`pwd`/$CHROOT_DIR --nodeps centos-release-6-7.el6.centos.12.3.${ARCH}.rpm
-rm -f centos-release-6-6.el6.centos.12.2.${ARCH}.rpm
+rm -f centos-release-6-7.el6.centos.12.3.${ARCH}.rpm
-wget http://mirror.centos.org/centos/6.6/os/${PACKAGE_ARCH}/RPM-GPG-KEY-CentOS-6
+wget http://mirror.centos.org/centos/6.7/os/${PACKAGE_ARCH}/RPM-GPG-KEY-CentOS-6
rpm -v --root=`pwd`/$CHROOT_DIR --import RPM-GPG-KEY-CentOS-6