summaryrefslogtreecommitdiff
path: root/albootstrap
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2007-09-07 07:28:03 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2007-09-07 07:28:03 +0000
commitf1e147b06e143c36ddc023f5297e3d5a15852466 (patch)
tree9f3272d10e677ac3a822943c7b5f1b0bf1eccce0 /albootstrap
parentefcd98845f1e6888ebcd6a55c70206c517b234aa (diff)
downloadalpine-conf-f1e147b06e143c36ddc023f5297e3d5a15852466.zip
added albootstrap, setup-keymap and replaced setup-problem-reporting with setup-sendbug
Diffstat (limited to 'albootstrap')
-rw-r--r--albootstrap54
1 files changed, 54 insertions, 0 deletions
diff --git a/albootstrap b/albootstrap
new file mode 100644
index 0000000..2538fa3
--- /dev/null
+++ b/albootstrap
@@ -0,0 +1,54 @@
+#!/bin/sh
+
+# bootstrap an alpine installation
+
+VERSION=1.0
+
+usage() {
+ echo "usage: $(basename $0) TARGETDIR"
+ exit 2
+}
+
+die () {
+ echo "$@" >&2
+ exit 3
+}
+
+# set up vars
+: ${WGET:="/usr/bin/wget"}
+: ${TAR:="/usr/bin/tar"}
+: ${MIRROR:="http://dev.alpinelinux.org/alpine/v1.7"}
+: ${BASE:="base.tar.bz2"}
+target=$1
+
+# main
+[ -z "$target" ] && usage
+[ "$target" = "/" ] && die "Bootstrapping Alpine to '/' is probably not a good idea. Aborting..."
+
+mkdir -p "$target"
+
+echo ">>> Fetching $MIRROR/$BASE..."
+$WGET -q -O - "$MIRROR/$BASE" | tar -C "$target" -jx || die "Failed to fetch or unpack $BASE"
+
+echo ">>> Creating missing dirs..."
+for dir in proc sys dev home; do
+ mkdir -p "$target/$dir"
+done
+
+echo ">>> Installing busybox links..."
+# create fake /proc/self/exe
+mkdir -p "$target/proc/self"
+ln -s /bin/busybox "$target/proc/self/exe"
+chroot "$target" /bin/busybox --install -s
+rm -r "$target/proc/self"
+
+if [ -f /etc/resolv.conf ]; then
+ echo ">>> Copying /etc/resolv.conf..."
+ cp /etc/resolv.conf "$target/etc/"
+fi
+
+echo ">>> Setting up APK_PATH..."
+echo "export APK_PATH=$MIRROR/apks" >> "$target/etc/profile"
+
+echo ">>> Alpine bootstrap complete."
+