#!/bin/sh if [ $# -ne 2 ]; then echo "$0 disk ssh-keyfile" echo " disk: which disk to install to" echo " ssh-keyfile: ssh keys to add into the image" exit 1 fi set -e set -x DISK=$1; shift SSH_KEYS=$1; shift MAJOR_VERSION=3.13 MINOR_VERSION=5 IMAGE=alpine-minirootfs-$MAJOR_VERSION.$MINOR_VERSION-x86_64.tar.gz RESOLVCONF=/etc/resolv.conf working_directory=$(pwd -P) rootfs_tmpdir=$(mktemp -d) rootfs_url="http://dl-cdn.alpinelinux.org/alpine/v$MAJOR_VERSION/releases/x86_64/$IMAGE" run_root () { sudo chroot $rootfs_tmpdir /usr/bin/env \ PATH=/bin:/sbin \ /bin/sh -c "$*" } wget -c "$rootfs_url" -O "$IMAGE" # Partition disk with 1 Linux partition sudo sfdisk "$DISK" <