commit 0b6fc88b206d6dac820f5d4b6840caae629defdc parent a52a87fb723853a6b8da99eb543ccf2b0801e8dd Author: Hiltjo Posthuma <hiltjo@codemadness.org> Date: Sat, 5 Jul 2014 21:09:21 +0000 add setup-alpine script Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org> Diffstat:
A | misc/setup-alpine | | | 42 | ++++++++++++++++++++++++++++++++++++++++++ |
1 file changed, 42 insertions(+), 0 deletions(-)
diff --git a/misc/setup-alpine b/misc/setup-alpine @@ -0,0 +1,42 @@ +#!/bin/sh +# Things you might want to do after setup: +# - apk update +# - apk add alpine-sdk +# - use misc/run-chroot to chroot to it. +# - remove gcc, binutils, pkg-config etc packages. +# - remove libraries such as libpng (png-config), these can mess up +# the builds. +# - remove /usr/include or move to /usr/include.old, note that +# python for example uses files from /usr/include/python2.7 at runtime (oh oh). +# - add a separate morpheus user to build stuff. +# - copy static plan9 mk to /bin. +# - copy static git to /bin + +set -e -x + +mirror="http://nl.alpinelinux.org/alpine/" +installdir="/ns/alpine" +tmpdir="${installdir}/tmp" + +# fetch apk package tools. +mkdir -p "${tmpdir}/sbin" +cd "$tmpdir" +apktools="apk-tools-static-2.4.4-r0.apk" +if ! test -f "$apktools"; then + wget "${mirror}/v3.0/main/x86_64/${apktools}" +fi +if ! test -d "sbin"; then + tar -xzf "$apktools" +fi + +# install in chroot. +"${installdir}/tmp/sbin/apk.static" -X "${mirror}/v3.0/main" -U --allow-untrusted --root "${installdir}" --initdb add alpine-base + +# copy etc/resolv.conf +mkdir -p "${installdir}/etc" +cp /etc/resolv.conf "${installdir}/etc/resolv.conf" +chmod 755 "${installdir}/etc/resolv.conf" + +# write used mirror as apk repository. +mkdir -p "${installdir}/etc/apk" +echo "${mirror}/v3.0/main" > ${installdir}/etc/apk/repositories