diff --git a/cmd/control/install.go b/cmd/control/install.go index 8efc2b49..d26f8191 100644 --- a/cmd/control/install.go +++ b/cmd/control/install.go @@ -115,8 +115,8 @@ func runInstall(image, installType, cloudConfig, device, append string, force, r return err } } - cmd := exec.Command("system-docker", "run", "--net=host", "--privileged", "--volumes-from=user-volumes", image, - "-d", device, "-t", installType, "-c", cloudConfig, "-a", append) + cmd := exec.Command("system-docker", "run", "--net=host", "--privileged", "--volumes-from=user-volumes", + "--volumes-from=command-volumes", image, "-d", device, "-t", installType, "-c", cloudConfig, "-a", append) cmd.Stdout, cmd.Stderr = os.Stdout, os.Stderr if err := cmd.Run(); err != nil { return err diff --git a/scripts/installer/Dockerfile.amd64 b/scripts/installer/Dockerfile.amd64 index c77e20e2..2e74add1 100644 --- a/scripts/installer/Dockerfile.amd64 +++ b/scripts/installer/Dockerfile.amd64 @@ -1,7 +1,7 @@ FROM ubuntu:16.04 ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && \ - apt-get install --no-install-recommends -y udev grub2 parted kexec-tools && \ + apt-get install --no-install-recommends -y udev grub2 parted kexec-tools extlinux syslinux-common && \ rm -rf /var/lib/apt/* COPY ./build/vmlinuz ./build/initrd /dist/ diff --git a/scripts/installer/lay-down-os b/scripts/installer/lay-down-os index 72edbe0e..e64c62d7 100755 --- a/scripts/installer/lay-down-os +++ b/scripts/installer/lay-down-os @@ -27,6 +27,7 @@ DIST=${DIST:-/dist} CLOUD_CONFIG=${CLOUD_CONFIG:-"${SCRIPTS_DIR}/conf/empty.yml"} CONSOLE=tty0 BASE_DIR="/mnt/new_img" +BOOT=boot/ # 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. PARTITION=${PARTITION:=${DEVICE}1} @@ -46,18 +47,28 @@ format_device() mkfs.ext4 -F -i 4096 -L RANCHER_STATE ${PARTITION} } +get_dev() +{ + if [ -z "$(which ros)" ]; then + lsblk -n -o label $1 + else + ros dev LABEL=${1} + fi +} + mount_device() { - local label=RANCHER_STATE + LABEL=RANCHER_STATE local raw="${1:-false}" mkdir -p ${BASE_DIR} - if [ "$(lsblk -o label|grep RANCHER_BOOT | wc -l)" -gt "0" ]; then - label=RANCHER_BOOT + if [ -n "$(get_dev RANCHER_BOOT)" ]; then + LABEL=RANCHER_BOOT + BOOT= fi - local mount_opts="-L ${label}" + local mount_opts="-L ${LABEL}" if [ "${raw}" == "true" ]; then device_defined ${DEVICE} mount_opts=${PARTITION} @@ -69,7 +80,21 @@ mount_device() create_boot_dirs() { - mkdir -p ${BASE_DIR}/boot/grub + mkdir -p ${BASE_DIR}/${BOOT}grub + mkdir -p ${BASE_DIR}/${BOOT}syslinux +} + +install_syslinux() { + dd bs=440 count=1 if=/usr/lib/syslinux/mbr/mbr.bin of=${DEVICE} + cp /usr/lib/syslinux/modules/bios/* ${BASE_DIR}/${BOOT}syslinux + extlinux --install ${BASE_DIR}/${BOOT}syslinux +} + +install_syslinux_raid() { + dd bs=440 count=1 if=/usr/lib/syslinux/mbr/mbr.bin of=/dev/sda + dd bs=440 count=1 if=/usr/lib/syslinux/mbr/mbr.bin of=/dev/sdb + cp /usr/lib/syslinux/modules/bios/* ${BASE_DIR}/${BOOT}syslinux + extlinux --install --raid ${BASE_DIR}/${BOOT}syslinux } install_grub() { @@ -77,7 +102,7 @@ install_grub() { } grub2_config(){ - local grub_cfg=${BASE_DIR}/boot/grub/grub.cfg + local grub_cfg=${BASE_DIR}/${BOOT}grub/grub.cfg local append_line="${1}" cat >${grub_cfg} <>${grub_cfg} <${syslinux_cfg} <>${syslinux_cfg} < ${grub_file}<> ${grub_file}< ${BASE_DIR}/boot/append +echo "${APPEND}" > ${BASE_DIR}/${BOOT}append grub2_config "${APPEND}" +syslinux_config "${APPEND}" pvgrub_config "${APPEND}" install_rancher