1
0
mirror of git://git.2f30.org/morpheus.git synced 2024-06-16 10:38:33 +00:00
morpheus/misc/install-alpine
Hiltjo Posthuma 5bc8a553e2 install-*: allow to override root with first argument
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
2014-07-13 20:51:18 +00:00

44 lines
1.3 KiB
Bash
Executable File

#!/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/"
root="/ns/alpine"
test x"$1" != x"" && root="$1"
tmpdir="${root}/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 -f "sbin/apk.static"; then
tar -xzf "$apktools"
fi
# install in chroot.
"$tmpdir/sbin/apk.static" -X "${mirror}/v3.0/main" -U --allow-untrusted --root "${root}" --initdb add alpine-base
# copy etc/resolv.conf
mkdir -p "${root}/etc"
cp /etc/resolv.conf "${root}/etc/resolv.conf"
chmod 644 "${root}/etc/resolv.conf"
# write used mirror as apk repository.
mkdir -p "${root}/etc/apk"
echo "${mirror}/v3.0/main" > ${root}/etc/apk/repositories