diff --git a/Dockerfile b/Dockerfile index c458d482..9bf4e5fd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,9 @@ -FROM alpine -RUN apk update && apk add coreutils util-linux bash parted syslinux e2fsprogs +FROM debian:jessie COPY ./scripts/installer /scripts COPY ./scripts/version /scripts/ +RUN /scripts/bootstrap -COPY ./dist/artifacts/vmlinuz ./dist/artifacts/initrd /dist/ +COPY ./dist/artifacts/vmlinuz /dist/vmlinuz +COPY ./dist/artifacts/initrd /dist/initrd ENTRYPOINT ["/scripts/lay-down-os"] diff --git a/scripts/installer/bootstrap b/scripts/installer/bootstrap new file mode 100755 index 00000000..426ed80f --- /dev/null +++ b/scripts/installer/bootstrap @@ -0,0 +1,6 @@ +#!/bin/bash + +export DEBIAN_FRONTEND=noninteractive + +apt-get update +apt-get install -y grub2 parted diff --git a/scripts/installer/lay-down-os b/scripts/installer/lay-down-os index 7433823f..69d01495 100755 --- a/scripts/installer/lay-down-os +++ b/scripts/installer/lay-down-os @@ -2,11 +2,10 @@ set -e -x . $(dirname $0)/version -VERSION=${VERSION:?"VERSION not set"} while getopts "i:f:c:d:t:r:o:p:" OPTION do - case ${OPTION} in + case $OPTION in i) DIST="$OPTARG" ;; f) FILES="$OPTARG" ;; c) CLOUD_CONFIG="$OPTARG" ;; @@ -21,7 +20,6 @@ done DIST=${DIST:-/dist} CLOUD_CONFIG=${CLOUD_CONFIG:-/scripts/conf/empty.yml} -CONSOLE=tty0 BASE_DIR="/mnt/new_img" # TODO: Change this to a number so that users can specify. # Will need to make it so that our builds and packer APIs remain consistent. @@ -58,41 +56,43 @@ mount_device() mount_opts=${PARTITION} fi - mount ${mount_opts} ${BASE_DIR} + mount $mount_opts ${BASE_DIR} trap "umount ${BASE_DIR}" EXIT } create_boot_dirs() { mkdir -p ${BASE_DIR}/boot/grub - mkdir -p ${BASE_DIR}/boot/extlinux } -install_extlinux() { - extlinux -i ${BASE_DIR}/boot/extlinux - dd if=/usr/share/syslinux/mbr.bin of=${DEVICE} +install_grub() { + grub-install --boot-directory=${BASE_DIR}/boot ${DEVICE} } -extlinux_config(){ - local extlinux_conf=${BASE_DIR}/boot/extlinux/extlinux.conf +grub2_config(){ + local grub_cfg=${BASE_DIR}/boot/grub/grub.cfg local append_line="${1}" -cat >${extlinux_conf} <$grub_cfg <>${extlinux_conf} <>$grub_cfg < ${grub_file}< $grub_file<> ${grub_file}<> $grub_file<