mirror of
https://github.com/rancher/os.git
synced 2025-09-01 06:40:31 +00:00
make the iso run also get the ssh and cloud-init so testing the installer is easier
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
This commit is contained in:
@@ -1,13 +1,17 @@
|
||||
FROM ubuntu:16.04
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
RUN apt-get update && \
|
||||
apt-get install --no-install-recommends -y udev grub2 parted kexec-tools extlinux syslinux-common && \
|
||||
rm -rf /var/lib/apt/*
|
||||
FROM rancher/os-alpineconsole
|
||||
# TODO: redo as cross platform
|
||||
|
||||
COPY ./build/vmlinuz ./build/initrd /dist/
|
||||
COPY conf ./build/ros /scripts/
|
||||
# not installed atm udev, grub2, kexe-toos
|
||||
# parted: partprobe, e2fsprogs: mkfs.ext4, syslinux: extlinux&syslinux
|
||||
RUN apk --no-cache add syslinux parted e2fsprogs
|
||||
|
||||
COPY conf /scripts/
|
||||
|
||||
ARG VERSION
|
||||
ARG KERNEL_VERSION
|
||||
ENV VERSION=${VERSION}
|
||||
ENV KERNEL_VERSION=${KERNEL_VERSION}
|
||||
|
||||
# TODO: separate out the 3 elements below - so we can mix and match updates
|
||||
COPY ./build/vmlinuz-${KERNEL_VERSION} ./build/initrd ./build/ros /dist/
|
||||
ENTRYPOINT ["/scripts/ros"]
|
||||
|
@@ -1,5 +1,5 @@
|
||||
default rancheros
|
||||
label rancheros
|
||||
kernel /boot/vmlinuz
|
||||
kernel /boot/vmlinuz-${KERNEL_VERSION}
|
||||
initrd /boot/initrd
|
||||
append quiet rancher.autologin=tty1 rancher.autologin=ttyS0
|
||||
|
@@ -44,7 +44,11 @@ if [ -e ${DOWNLOADS}/kernel.tar.gz ]; then
|
||||
for i in vmlinuz vmlinux; do
|
||||
if [ -e ${BUILD}/kernel/boot/${i}-* ]; then
|
||||
mkdir -p dist/artifacts
|
||||
cp ${BUILD}/kernel/boot/${i}-* dist/artifacts/vmlinuz
|
||||
# frustratingly, the vmlinuz versioned filename != the tag name, so we need to do some guessing
|
||||
# for eg, 4.9-rc8-rancher2 is called vmlinuz-4.9.0-rc8-rancher
|
||||
echo "Copy ${BUILD}/kernel/boot/${i}-* to dist/artifacts/vmlinuz-${KERNEL_VERSION}"
|
||||
cp ${BUILD}/kernel/boot/${i}-* "dist/artifacts/vmlinuz-${KERNEL_VERSION}"
|
||||
cp ${BUILD}/kernel/boot/${i}-* ${BUILD}/kernel/vmlinuz
|
||||
break
|
||||
fi
|
||||
done
|
||||
@@ -54,6 +58,15 @@ if [ -e ${DOWNLOADS}/kernel.tar.gz ]; then
|
||||
cp -rf ${BUILD}/kernel/lib ${INITRD_DIR}/usr/
|
||||
depmod -b ${INITRD_DIR}/usr $(basename ${INITRD_DIR}/usr/lib/modules/*)
|
||||
fi
|
||||
else
|
||||
echo "no ${DOWNLOADS}/kernel.tar.gz found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ls -lah dist/artifacts/vmlinuz-*
|
||||
if [ ! -e "dist/artifacts/vmlinuz-${KERNEL_VERSION}" ]; then
|
||||
echo "Can't find dist/artifacts/vmlinuz-${KERNEL_VERSION}"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
if [ -e ${DOWNLOADS}/policy.29 ]; then
|
||||
|
@@ -10,7 +10,7 @@ INITRD=${ARTIFACTS}/initrd
|
||||
|
||||
mkdir -p ${ARTIFACTS}
|
||||
|
||||
if [ ! -f ${ARTIFACTS}/vmlinuz ]; then
|
||||
if [ ! -f ${ARTIFACTS}/vmlinuz-${KERNEL_VERSION} ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
@@ -7,16 +7,22 @@ source ./scripts/version
|
||||
|
||||
DOCKERFILE=./scripts/installer/Dockerfile.${ARCH}
|
||||
|
||||
if [ ! -f $DOCKERFILE ] || [ ! -f dist/artifacts/vmlinuz ] || [ ! -f dist/artifacts/initrd ]; then
|
||||
if [ ! -f $DOCKERFILE ] || [ ! -f dist/artifacts/vmlinuz-${KERNEL_VERSION} ] || [ ! -f dist/artifacts/initrd ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
mkdir -p ./scripts/installer/build
|
||||
cp ./dist/artifacts/{initrd,vmlinuz} ./scripts/installer/build
|
||||
cp ./dist/artifacts/initrd ./scripts/installer/build
|
||||
cp ./dist/artifacts/vmlinuz-${KERNEL_VERSION} ./scripts/installer/build
|
||||
cp ./bin/ros ./scripts/installer/build
|
||||
trap "rm -rf ./scripts/installer/build" EXIT
|
||||
|
||||
docker build -t ${OS_REPO}/os:${VERSION}${SUFFIX} --build-arg VERSION=${VERSION} -f $DOCKERFILE ./scripts/installer
|
||||
docker build \
|
||||
-t ${OS_REPO}/os:${VERSION}${SUFFIX} \
|
||||
--build-arg VERSION=${VERSION} \
|
||||
--build-arg KERNEL_VERSION=${KERNEL_VERSION} \
|
||||
-f $DOCKERFILE \
|
||||
./scripts/installer
|
||||
docker save -o dist/artifacts/installer.tar ${OS_REPO}/os:${VERSION}${SUFFIX}
|
||||
echo ${OS_REPO}/os:${VERSION}${SUFFIX} >> dist/images
|
||||
echo Built ${OS_REPO}/os:${VERSION}${SUFFIX}
|
||||
|
@@ -13,13 +13,13 @@ CHECKSUM=iso-checksums.txt
|
||||
mkdir -p ${CD}/boot/isolinux
|
||||
mkdir -p ${CD}/rancheros
|
||||
|
||||
if [ ! -f ${ARTIFACTS}/vmlinuz ] || [ ! -f ${ARTIFACTS}/initrd ]; then
|
||||
if [ ! -f ${ARTIFACTS}/vmlinuz-${KERNEL_VERSION} ] || [ ! -f ${ARTIFACTS}/initrd ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
cp ${ARTIFACTS}/initrd ${CD}/boot
|
||||
cp ${ARTIFACTS}/vmlinuz ${CD}/boot
|
||||
cp scripts/isolinux.cfg ${CD}/boot/isolinux
|
||||
cp ${ARTIFACTS}/vmlinuz-${KERNEL_VERSION} ${CD}/boot
|
||||
cat scripts/isolinux.cfg | envsubst > ${CD}/boot/isolinux/isolinux.cfg
|
||||
cp /usr/lib/ISOLINUX/isolinux.bin ${CD}/boot/isolinux
|
||||
cp /usr/lib/syslinux/modules/bios/ldlinux.c32 ${CD}/boot/isolinux
|
||||
# add the installer image to the iso for non-network / dev/test
|
||||
|
11
scripts/run
11
scripts/run
@@ -125,8 +125,7 @@ if [ "$QEMU" == "1" ] || [ "$BOOT_ISO" == "1" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [ "$QEMU" == "1" ]; then
|
||||
if [ "$QIND" != "1" ]; then
|
||||
CCROOT=${BUILD}/cloud-config
|
||||
rm -rf ${CCROOT}
|
||||
mkdir -p ${CCROOT}
|
||||
@@ -143,6 +142,10 @@ if [ "$QEMU" == "1" ]; then
|
||||
fi
|
||||
|
||||
HOME=${HOME:-/}
|
||||
fi
|
||||
|
||||
if [ "$QEMU" == "1" ]; then
|
||||
|
||||
if [ "$INSTALLED" == "1" ]; then
|
||||
# kernel args only works when using -kernel
|
||||
KERNEL_ARGS=""
|
||||
@@ -185,6 +188,10 @@ elif [ "$BOOT_ISO" == "1" ]; then
|
||||
$(eval "${hd["$ARCH"]} ${HD}") \
|
||||
${SECOND_DRIVE_ENABLE} \
|
||||
-smp 1 \
|
||||
-fsdev local,security_model=passthrough,readonly,id=fsdev0,path=${CCROOT} \
|
||||
-device virtio-9p-pci,id=fs0,fsdev=fsdev0,mount_tag=config-2 \
|
||||
-fsdev local,security_model=none,id=fsdev1,path=${HOME} \
|
||||
-device virtio-9p-pci,id=fs1,fsdev=fsdev1,mount_tag=home \
|
||||
-boot d \
|
||||
-cdrom ./dist/artifacts/rancheros.iso
|
||||
elif [ "$QIND" == "1" ]; then
|
||||
|
@@ -34,7 +34,8 @@ BUILD=build
|
||||
BASE=$(pwd)
|
||||
UNAME=$(uname)
|
||||
|
||||
KERNEL=${BASE}/dist/artifacts/vmlinuz
|
||||
#KERNEL=${BASE}/dist/artifacts/vmlinuz-${KERNEL_VERSION}*
|
||||
KERNEL=${BASE}/build/kernel/vmlinuz
|
||||
INITRD_SRC=${BASE}/build/initrd
|
||||
INITRD=${BASE}/build/initrd.tmp
|
||||
|
||||
|
Reference in New Issue
Block a user