mirror of
https://github.com/rancher/os.git
synced 2025-09-16 06:59:12 +00:00
Add vmware iso support
This commit is contained in:
@@ -4,6 +4,7 @@ set -e
|
||||
cd $(dirname $0)/..
|
||||
rm -rf build dist bin images/*/build state
|
||||
rm -rf ./scripts/images/openstack/dist
|
||||
rm -rf ./scripts/images/vmware/dist
|
||||
|
||||
docker rmi $(docker images --format "{{.Repository}}:{{.Tag}}" | grep rancher) || true
|
||||
docker rmi $(docker images --filter dangling=true -q) ||true
|
||||
|
1
scripts/images/vmware/.dockerignore
Normal file
1
scripts/images/vmware/.dockerignore
Normal file
@@ -0,0 +1 @@
|
||||
dist
|
2
scripts/images/vmware/.gitignore
vendored
Normal file
2
scripts/images/vmware/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
dist
|
||||
assets
|
31
scripts/images/vmware/Dockerfile.dapper
Normal file
31
scripts/images/vmware/Dockerfile.dapper
Normal file
@@ -0,0 +1,31 @@
|
||||
FROM ubuntu:16.04
|
||||
# FROM arm=armhf/ubuntu:16.04 arm64=arm64v8/ubuntu:16.04
|
||||
|
||||
ARG DAPPER_HOST_ARCH
|
||||
ARG OS_SERVICE_VMTOOL=rancher/os-openvmtools:10.1.10-2
|
||||
|
||||
ENV HOST_ARCH=${DAPPER_HOST_ARCH} ARCH=${DAPPER_HOST_ARCH}
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y git cpio curl genisoimage isolinux wget xorriso xz-utils && \
|
||||
rm -f /bin/sh && ln -s /bin/bash /bin/sh
|
||||
|
||||
ENV DOCKER_URL_amd64=https://get.docker.com/builds/Linux/x86_64/docker-1.10.3 \
|
||||
DOCKER_URL_arm=https://github.com/rancher/docker/releases/download/v1.10.3-ros1/docker-1.10.3_arm \
|
||||
DOCKER_URL_arm64=https://github.com/rancher/docker/releases/download/v1.10.3-ros1/docker-1.10.3_arm64 \
|
||||
DOCKER_URL=DOCKER_URL_${ARCH} \
|
||||
OS_SERVICE_VMTOOL=${OS_SERVICE_VMTOOL}
|
||||
|
||||
RUN wget -O - ${!DOCKER_URL} > /usr/bin/docker && chmod +x /usr/bin/docker
|
||||
|
||||
ENV DAPPER_ENV REPO TAG DRONE_TAG DISTRIB_ID KERNEL_VERSION_amd64
|
||||
ENV DAPPER_SOURCE .
|
||||
ENV DAPPER_OUTPUT ./dist
|
||||
ENV DAPPER_DOCKER_SOCKET true
|
||||
ENV DAPPER_RUN_ARGS --privileged
|
||||
ENV TRASH_CACHE ${DAPPER_SOURCE}/.trash-cache
|
||||
ENV HOME ${DAPPER_SOURCE}
|
||||
ENV KERNEL_VERSION=${KERNEL_VERSION_amd64}
|
||||
WORKDIR ${DAPPER_SOURCE}
|
||||
|
||||
ENTRYPOINT ["./scripts/build.sh"]
|
9
scripts/images/vmware/README.md
Normal file
9
scripts/images/vmware/README.md
Normal file
@@ -0,0 +1,9 @@
|
||||
Vmware Iso
|
||||
===============
|
||||
|
||||
Build by running `dapper` in this folder and the build will produce `./dist/rancheros-vmware.iso`. The iso produced integration with "os-openvmtools".
|
||||
|
||||
Pre-request
|
||||
===============
|
||||
Need to run `make` or `make release` first, then run `make vmware`.
|
||||
|
59
scripts/images/vmware/scripts/build.sh
Executable file
59
scripts/images/vmware/scripts/build.sh
Executable file
@@ -0,0 +1,59 @@
|
||||
#!/bin/bash
|
||||
set -ex
|
||||
|
||||
cd $(dirname $0)/..
|
||||
CD=$(pwd)
|
||||
|
||||
# prepare dapper needed.
|
||||
rm -rf dist
|
||||
mkdir -p dist/build
|
||||
cp -r assets/build/initrd/ dist/build/
|
||||
|
||||
# prepare env needed.
|
||||
DISTRO_INFO=$(cat assets/version.txt)
|
||||
VERSION=$(echo -e "$DISTRO_INFO" | cut -f3 -d ' ')
|
||||
COMMIT=$(echo -e "$DISTRO_INFO" | cut -f5 -d ' ')
|
||||
INITRD=initrd-${VERSION}
|
||||
ISO=$(echo ${DISTRIB_ID} | tr '[:upper:]' '[:lower:]')-vmware.iso
|
||||
COMPRESS="xz --format=lzma -9 --memlimit-compress=80% -e"
|
||||
|
||||
# prepare vmware tools.
|
||||
docker pull ${OS_SERVICE_VMTOOL}
|
||||
docker save ${OS_SERVICE_VMTOOL} | xz -9 > dist/build/initrd/usr/share/ros/images-vmtools.tar
|
||||
|
||||
# package initrd.
|
||||
cd dist/build/initrd/
|
||||
|
||||
if [ ! -f ${CD}assets/dist/artifacts/${INITRD} ]; then
|
||||
echo "Skipping package-iso vmware build: ${INITRD} not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
find | cpio -H newc -o | ${COMPRESS} > ${INITRD}
|
||||
|
||||
cd ${CD}
|
||||
scp -r assets/dist/boot dist/
|
||||
mkdir -p dist/rancheros
|
||||
cp dist/build/initrd/${INITRD} dist/boot
|
||||
cp assets/dist/artifacts/vmlinuz-${KERNEL_VERSION_amd64} dist/boot/
|
||||
cp /usr/lib/ISOLINUX/isolinux.bin dist/boot/isolinux/
|
||||
cp /usr/lib/syslinux/modules/bios/ldlinux.c32 dist/boot/isolinux/
|
||||
cp /usr/lib/syslinux/modules/bios/*.c32 dist/boot/isolinux/
|
||||
cp assets/dist/artifacts/installer.tar dist/rancheros/
|
||||
cp assets/dist/artifacts/Dockerfile.amd64 dist/rancheros/
|
||||
|
||||
if [ -f dist/rancheros/installer.tar.gz ]; then
|
||||
rm -rf dist/rancheros/installer.tar.gz
|
||||
fi
|
||||
|
||||
gzip -9 dist/rancheros/installer.tar
|
||||
cd dist
|
||||
rm -rf build/
|
||||
|
||||
xorriso \
|
||||
-as mkisofs \
|
||||
-l -J -R -V "${DISTRIB_ID}" \
|
||||
-no-emul-boot -boot-load-size 4 -boot-info-table \
|
||||
-b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat \
|
||||
-isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin \
|
||||
-o $ISO .
|
Reference in New Issue
Block a user