diff options
Diffstat (limited to 'examples/build_gold_image/build_archlinux.sh')
-rwxr-xr-x | examples/build_gold_image/build_archlinux.sh | 53 |
1 files changed, 53 insertions, 0 deletions
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 |