install-alpine 957 Bytes
Newer Older
1 2 3 4 5 6
#!/bin/sh
# vim: set ts=4:
set -eu

. "$(dirname "$0")"/common.sh

7 8
APK_TOOLS_URI='https://github.com/alpinelinux/apk-tools/releases/download/v2.7.2/apk-tools-2.7.2-x86_64-linux.tar.gz'
APK_TOOLS_SHA256='e949d3826d08ad41622b29186f960b135711dd96aacfb80ff8238c0fd69d051f'
9

10
APK=$(which apk 2>/dev/null) || true
11

12 13
if [ ! -e "$APK" ]; then
	title 'Downloading static apk-tools'
14

15 16 17 18 19 20 21
	cd /tmp
	wget -T 10 "$APK_TOOLS_URI"
	echo "$APK_TOOLS_SHA256  ${APK_TOOLS_URI##*/}" | sha256sum -c
	tar -xzf ${APK_TOOLS_URI##*/}
	mv apk-tools-*/apk /tmp/apk
	APK=/tmp/apk
fi
22 23 24 25 26 27

title 'Installing Alpine Linux'

mkdir -p "$ALPINE_ROOT"/etc/apk
cd "$ALPINE_ROOT"

28
echo "$MIRROR_URI/main" > etc/apk/repositories
29
cp -R "$CLONE_DIR"/.travis/keys etc/apk/keys
30 31
cp /etc/resolv.conf etc/resolv.conf

32
$APK \
33
	--root . --update-cache --initdb --no-progress \
34 35 36 37 38
	add alpine-base

mount -t proc none proc
mount --rbind /sys sys
mount --rbind /dev dev
39 40 41
mount --rbind /run run

ln -sf /run/shm dev/shm