mirror of
https://github.com/rancher/os.git
synced 2025-09-09 18:50:04 +00:00
Update release scripts
This commit is contained in:
6
Makefile
6
Makefile
@@ -1,4 +1,4 @@
|
|||||||
TARGETS := $(shell ls scripts | grep -vE 'clean|run|help|release|build-moby|run-moby')
|
TARGETS := $(shell ls scripts | grep -vE 'clean|run|help|release*|build-moby|run-moby')
|
||||||
|
|
||||||
.dapper:
|
.dapper:
|
||||||
@echo Downloading dapper
|
@echo Downloading dapper
|
||||||
@@ -53,12 +53,12 @@ vmware: .dapper
|
|||||||
mkdir -p dist
|
mkdir -p dist
|
||||||
APPEND_SYSTEM_IMAGES="rancher/os-openvmtools:10.2.5-3" \
|
APPEND_SYSTEM_IMAGES="rancher/os-openvmtools:10.2.5-3" \
|
||||||
VMWARE_APPEND="console=tty1 console=ttyS0,115200n8 printk.devkmsg=on rancher.autologin=tty1 rancher.autologin=ttyS0 rancher.autologin=ttyS1 panic=10" \
|
VMWARE_APPEND="console=tty1 console=ttyS0,115200n8 printk.devkmsg=on rancher.autologin=tty1 rancher.autologin=ttyS0 rancher.autologin=ttyS1 panic=10" \
|
||||||
./.dapper vmware-release 2>&1 | tee dist/release.log
|
./.dapper release-vmware 2>&1 | tee dist/release.log
|
||||||
|
|
||||||
hyperv: .dapper
|
hyperv: .dapper
|
||||||
mkdir -p dist
|
mkdir -p dist
|
||||||
APPEND_SYSTEM_IMAGES="rancher/os-hypervvmtools:v4.14.85-rancher-1" \
|
APPEND_SYSTEM_IMAGES="rancher/os-hypervvmtools:v4.14.85-rancher-1" \
|
||||||
./.dapper hyperv-release 2>&1 | tee dist/release.log
|
./.dapper release-hyperv 2>&1 | tee dist/release.log
|
||||||
|
|
||||||
help:
|
help:
|
||||||
@./scripts/help
|
@./scripts/help
|
||||||
|
@@ -1,16 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
cd $(dirname $0)/..
|
|
||||||
|
|
||||||
|
|
||||||
source ./scripts/version
|
|
||||||
./scripts/release
|
|
||||||
|
|
||||||
ISO_NAME="rancheros-autoformat.iso"
|
|
||||||
|
|
||||||
mkdir -p /tmp/dist && mv ./dist/* /tmp/dist/
|
|
||||||
mkdir -p ./dist/hyperv && mv /tmp/dist/* ./dist/hyperv/
|
|
||||||
mkdir -p ./dist/artifacts && cp ./dist/hyperv/artifacts/rancheros.iso ./dist/artifacts/${ISO_NAME}
|
|
||||||
echo "gsutil cp dist/artifacts/${ISO_NAME} gs://releases.rancher.com/os/latest/hyperv/${ISO_NAME}"
|
|
||||||
echo "gsutil cp dist/artifacts/${ISO_NAME} gs://releases.rancher.com/os/${VERSION}/hyperv/${ISO_NAME}"
|
|
@@ -7,6 +7,7 @@ cd $(dirname $0)/..
|
|||||||
|
|
||||||
ARTIFACTS=$(pwd)/dist/artifacts
|
ARTIFACTS=$(pwd)/dist/artifacts
|
||||||
CD=${BUILD}/cd
|
CD=${BUILD}/cd
|
||||||
|
rm -rf ${CD}/
|
||||||
ISO=${ARTIFACTS}/$(echo ${DISTRIB_ID} | tr '[:upper:]' '[:lower:]').iso
|
ISO=${ARTIFACTS}/$(echo ${DISTRIB_ID} | tr '[:upper:]' '[:lower:]').iso
|
||||||
CHECKSUM=iso-checksums.txt
|
CHECKSUM=iso-checksums.txt
|
||||||
|
|
||||||
|
@@ -2,78 +2,8 @@
|
|||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
cd $(dirname $0)/..
|
cd $(dirname $0)/..
|
||||||
|
|
||||||
source ./scripts/version
|
source ./scripts/version
|
||||||
export REPO_VERSION=$VERSION
|
./scripts/release-build
|
||||||
if [[ -n "$DIRTY" || -z "$GIT_TAG" ]]; then
|
|
||||||
export REPO_VERSION=master
|
|
||||||
fi
|
|
||||||
export COMPRESS="gzip -9"
|
|
||||||
|
|
||||||
./scripts/ci
|
./scripts/release-${ARCH}
|
||||||
|
|
||||||
# from scripts/ci
|
|
||||||
echo PREPARE
|
|
||||||
./scripts/prepare
|
|
||||||
echo PACKAGE
|
|
||||||
./scripts/package
|
|
||||||
|
|
||||||
#if [[ "$ARCH" == "" || "$ARCH" == "amd64" ]]; then
|
|
||||||
## make generated changelog
|
|
||||||
#lastrelease=$(hub release | grep -v rc | head -n1 | tr -d ' \r\n')
|
|
||||||
#git log --format="%s: %b" ${lastrelease}..${VERSION} | grep "Merge pull" | sed 's/.*\(#.*\) from .*:\(.*\)/* \1: \2/g' > dist/artifacts/changelog.txt
|
|
||||||
#fi
|
|
||||||
|
|
||||||
CHECKSUM="dist/checksums.txt"
|
|
||||||
rm -f $CHECKSUM
|
|
||||||
|
|
||||||
cat scripts/hosting/rancheros.ipxe | sed "s/latest/${VERSION}/g" > dist/artifacts/rancheros.ipxe
|
|
||||||
|
|
||||||
echo "github-release release --user rancher --repo os --tag ${VERSION} --pre-release --draft" > dist/publish.sh
|
|
||||||
chmod 755 dist/publish.sh
|
|
||||||
|
|
||||||
touch dist/publish_gss_${VERSION}.sh dist/publish_gss_latest.sh
|
|
||||||
chmod 755 dist/publish_gss_${VERSION}.sh dist/publish_gss_latest.sh
|
|
||||||
|
|
||||||
for file in $(ls dist/artifacts/); do
|
|
||||||
case $file in
|
|
||||||
*"installer.tar" | "Dockerfile"*)
|
|
||||||
;;
|
|
||||||
"initrd-"*)
|
|
||||||
echo "github-release upload --user rancher --repo os --tag ${VERSION} --file ./dist/artifacts/${file} --name initrd" >> dist/publish.sh
|
|
||||||
echo "gsutil cp dist/artifacts/${file} gs://releases.rancher.com/os/latest/initrd" >> ./dist/publish_gss_latest.sh
|
|
||||||
echo "gsutil cp dist/artifacts/${file} gs://releases.rancher.com/os/${VERSION}/initrd" >> ./dist/publish_gss_${VERSION}.sh
|
|
||||||
;;
|
|
||||||
"vmlinuz-"*)
|
|
||||||
echo "github-release upload --user rancher --repo os --tag ${VERSION} --file ./dist/artifacts/${file} --name vmlinuz" >> dist/publish.sh
|
|
||||||
echo "gsutil cp dist/artifacts/${file} gs://releases.rancher.com/os/latest/vmlinuz" >> ./dist/publish_gss_latest.sh
|
|
||||||
echo "gsutil cp dist/artifacts/${file} gs://releases.rancher.com/os/${VERSION}/vmlinuz" >> ./dist/publish_gss_${VERSION}.sh
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "github-release upload --user rancher --repo os --tag ${VERSION} --file ./dist/artifacts/${file} --name ${file}" >> dist/publish.sh
|
|
||||||
echo "gsutil cp dist/artifacts/${file} gs://releases.rancher.com/os/latest/${file}" >> ./dist/publish_gss_latest.sh
|
|
||||||
echo "gsutil cp dist/artifacts/${file} gs://releases.rancher.com/os/${VERSION}/${file}" >> ./dist/publish_gss_${VERSION}.sh
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
#checksums
|
|
||||||
pushd .
|
|
||||||
cd dist/artifacts
|
|
||||||
for algo in sha256 md5; do
|
|
||||||
echo "$algo: $(${algo}sum $file)" >> ../../$CHECKSUM
|
|
||||||
done
|
|
||||||
popd
|
|
||||||
done
|
|
||||||
echo "github-release upload --user rancher --repo os --tag ${VERSION} --file dist/release.log --name release.log" >> dist/publish.sh
|
|
||||||
|
|
||||||
echo "github-release upload --user rancher --repo os --tag ${VERSION} --file ${CHECKSUM} --name checksums.txt" >> dist/publish.sh
|
|
||||||
|
|
||||||
echo >> dist/publish.sh
|
|
||||||
|
|
||||||
cat dist/images | sed 's/^/docker push /' >> dist/publish.sh
|
|
||||||
|
|
||||||
echo "--- Run dist/publish.sh"
|
|
||||||
cat dist/publish.sh
|
|
||||||
|
|
||||||
echo "--- Run dist/publish_gss.sh"
|
|
||||||
cat dist/publish_gss_latest.sh
|
|
||||||
cat dist/publish_gss_${VERSION}.sh
|
|
||||||
|
62
scripts/release-amd64
Executable file
62
scripts/release-amd64
Executable file
@@ -0,0 +1,62 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
cd $(dirname $0)/..
|
||||||
|
|
||||||
|
source ./scripts/version
|
||||||
|
./scripts/release-build
|
||||||
|
|
||||||
|
CHECKSUM="dist/checksums.txt"
|
||||||
|
rm -f $CHECKSUM
|
||||||
|
|
||||||
|
cat scripts/hosting/rancheros.ipxe | sed "s/latest/${VERSION}/g" > dist/artifacts/rancheros.ipxe
|
||||||
|
|
||||||
|
echo "github-release release --user rancher --repo os --tag ${VERSION} --pre-release --draft" > dist/publish.sh
|
||||||
|
chmod 755 dist/publish.sh
|
||||||
|
|
||||||
|
touch dist/publish_gss_${VERSION}.sh dist/publish_gss_latest.sh
|
||||||
|
chmod 755 dist/publish_gss_${VERSION}.sh dist/publish_gss_latest.sh
|
||||||
|
|
||||||
|
for file in $(ls dist/artifacts/); do
|
||||||
|
case $file in
|
||||||
|
*"installer.tar" | "Dockerfile"*)
|
||||||
|
;;
|
||||||
|
"initrd-"*)
|
||||||
|
echo "github-release upload --user rancher --repo os --tag ${VERSION} --file ./dist/artifacts/${file} --name initrd" >> dist/publish.sh
|
||||||
|
echo "gsutil cp dist/artifacts/${file} gs://releases.rancher.com/os/latest/initrd" >> ./dist/publish_gss_latest.sh
|
||||||
|
echo "gsutil cp dist/artifacts/${file} gs://releases.rancher.com/os/${VERSION}/initrd" >> ./dist/publish_gss_${VERSION}.sh
|
||||||
|
;;
|
||||||
|
"vmlinuz-"*)
|
||||||
|
echo "github-release upload --user rancher --repo os --tag ${VERSION} --file ./dist/artifacts/${file} --name vmlinuz" >> dist/publish.sh
|
||||||
|
echo "gsutil cp dist/artifacts/${file} gs://releases.rancher.com/os/latest/vmlinuz" >> ./dist/publish_gss_latest.sh
|
||||||
|
echo "gsutil cp dist/artifacts/${file} gs://releases.rancher.com/os/${VERSION}/vmlinuz" >> ./dist/publish_gss_${VERSION}.sh
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "github-release upload --user rancher --repo os --tag ${VERSION} --file ./dist/artifacts/${file} --name ${file}" >> dist/publish.sh
|
||||||
|
echo "gsutil cp dist/artifacts/${file} gs://releases.rancher.com/os/latest/${file}" >> ./dist/publish_gss_latest.sh
|
||||||
|
echo "gsutil cp dist/artifacts/${file} gs://releases.rancher.com/os/${VERSION}/${file}" >> ./dist/publish_gss_${VERSION}.sh
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
#checksums
|
||||||
|
pushd .
|
||||||
|
cd dist/artifacts
|
||||||
|
for algo in sha256 md5; do
|
||||||
|
echo "$algo: $(${algo}sum $file)" >> ../../$CHECKSUM
|
||||||
|
done
|
||||||
|
popd
|
||||||
|
done
|
||||||
|
echo "github-release upload --user rancher --repo os --tag ${VERSION} --file dist/release.log --name release.log" >> dist/publish.sh
|
||||||
|
|
||||||
|
echo "github-release upload --user rancher --repo os --tag ${VERSION} --file ${CHECKSUM} --name checksums.txt" >> dist/publish.sh
|
||||||
|
|
||||||
|
echo >> dist/publish.sh
|
||||||
|
|
||||||
|
cat dist/images | sed 's/^/docker push /' >> dist/publish.sh
|
||||||
|
|
||||||
|
echo "--- Run dist/publish.sh"
|
||||||
|
cat dist/publish.sh
|
||||||
|
|
||||||
|
echo "--- Run dist/publish_gss.sh"
|
||||||
|
cat dist/publish_gss_latest.sh
|
||||||
|
cat dist/publish_gss_${VERSION}.sh
|
29
scripts/release-arm64
Executable file
29
scripts/release-arm64
Executable file
@@ -0,0 +1,29 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
cd $(dirname $0)/..
|
||||||
|
|
||||||
|
source ./scripts/version
|
||||||
|
./scripts/release-build
|
||||||
|
|
||||||
|
touch dist/publish_gss_${VERSION}.sh dist/publish_gss_latest.sh
|
||||||
|
chmod 755 dist/publish_gss_${VERSION}.sh dist/publish_gss_latest.sh
|
||||||
|
|
||||||
|
for file in $(ls dist/artifacts/); do
|
||||||
|
case $file in
|
||||||
|
*"installer.tar" | "Dockerfile"*)
|
||||||
|
;;
|
||||||
|
"initrd-"*)
|
||||||
|
echo "gsutil cp dist/artifacts/${file} gs://releases.rancher.com/os/latest/arm64/initrd" >> ./dist/publish_gss_latest.sh
|
||||||
|
echo "gsutil cp dist/artifacts/${file} gs://releases.rancher.com/os/${VERSION}/arm64/initrd" >> ./dist/publish_gss_${VERSION}.sh
|
||||||
|
;;
|
||||||
|
"vmlinuz-"*)
|
||||||
|
echo "gsutil cp dist/artifacts/${file} gs://releases.rancher.com/os/latest/arm64/vmlinuz" >> ./dist/publish_gss_latest.sh
|
||||||
|
echo "gsutil cp dist/artifacts/${file} gs://releases.rancher.com/os/${VERSION}/arm64/vmlinuz" >> ./dist/publish_gss_${VERSION}.sh
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "gsutil cp dist/artifacts/${file} gs://releases.rancher.com/os/latest/arm64/${file}" >> ./dist/publish_gss_latest.sh
|
||||||
|
echo "gsutil cp dist/artifacts/${file} gs://releases.rancher.com/os/${VERSION}/arm64/${file}" >> ./dist/publish_gss_${VERSION}.sh
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
18
scripts/release-build
Executable file
18
scripts/release-build
Executable file
@@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
cd $(dirname $0)/..
|
||||||
|
source ./scripts/version
|
||||||
|
export REPO_VERSION=$VERSION
|
||||||
|
if [[ -n "$DIRTY" || -z "$GIT_TAG" ]]; then
|
||||||
|
export REPO_VERSION=master
|
||||||
|
fi
|
||||||
|
export COMPRESS="gzip -9"
|
||||||
|
|
||||||
|
./scripts/ci
|
||||||
|
|
||||||
|
# from scripts/ci
|
||||||
|
echo PREPARE
|
||||||
|
./scripts/prepare
|
||||||
|
echo PACKAGE
|
||||||
|
./scripts/package
|
23
scripts/release-hyperv
Executable file
23
scripts/release-hyperv
Executable file
@@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
cd $(dirname $0)/..
|
||||||
|
|
||||||
|
source ./scripts/version
|
||||||
|
./scripts/release-build
|
||||||
|
|
||||||
|
touch dist/publish_gss_${VERSION}.sh dist/publish_gss_latest.sh
|
||||||
|
chmod 755 dist/publish_gss_${VERSION}.sh dist/publish_gss_latest.sh
|
||||||
|
|
||||||
|
for file in $(ls dist/artifacts/); do
|
||||||
|
case $file in
|
||||||
|
"initrd-"*)
|
||||||
|
echo "gsutil cp dist/artifacts/${file} gs://releases.rancher.com/os/latest/hyperv/initrd" >> ./dist/publish_gss_latest.sh
|
||||||
|
echo "gsutil cp dist/artifacts/${file} gs://releases.rancher.com/os/${VERSION}/hyperv/initrd" >> ./dist/publish_gss_${VERSION}.sh
|
||||||
|
;;
|
||||||
|
"rancheros.iso" | "rootfs.tar.gz")
|
||||||
|
echo "gsutil cp dist/artifacts/${file} gs://releases.rancher.com/os/latest/hyperv/${file}" >> ./dist/publish_gss_latest.sh
|
||||||
|
echo "gsutil cp dist/artifacts/${file} gs://releases.rancher.com/os/${VERSION}/hyperv/${file}" >> ./dist/publish_gss_${VERSION}.sh
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
76
scripts/release-vmware
Executable file
76
scripts/release-vmware
Executable file
@@ -0,0 +1,76 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
cd $(dirname $0)/..
|
||||||
|
|
||||||
|
touch .make-vmware
|
||||||
|
|
||||||
|
source ./scripts/version
|
||||||
|
./scripts/release-build
|
||||||
|
|
||||||
|
touch dist/publish_gss_${VERSION}.sh dist/publish_gss_latest.sh
|
||||||
|
chmod 755 dist/publish_gss_${VERSION}.sh dist/publish_gss_latest.sh
|
||||||
|
|
||||||
|
if [ "$VMWARE_AUTOFORMAT" = 1 ]; then
|
||||||
|
echo "gsutil cp dist/artifacts/rancheros.iso gs://releases.rancher.com/os/latest/vmware/rancheros-autoformat.iso" >> ./dist/publish_gss_latest.sh
|
||||||
|
echo "gsutil cp dist/artifacts/rancheros.iso gs://releases.rancher.com/os/${VERSION}/vmware/rancheros-autoformat.iso" >> ./dist/publish_gss_${VERSION}.sh
|
||||||
|
echo "gsutil cp dist/artifacts/rancheros.iso gs://releases.rancher.com/os/latest/rancheros-vmware.iso" >> ./dist/publish_gss_latest.sh
|
||||||
|
echo "gsutil cp dist/artifacts/rancheros.iso gs://releases.rancher.com/os/${VERISION}/rancheros-vmware.iso" >> ./dist/publish_gss_${VERSION}.sh
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$VMWARE_APPEND" != "" ]; then
|
||||||
|
echo "--append ${VMWARE_APPEND}"
|
||||||
|
APPEND_PARAM="--append \"${VMWARE_APPEND}\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p /tmp/dist/openstack/latest ./dist/vmware
|
||||||
|
|
||||||
|
cat > /tmp/dist/openstack/latest/user_data << EOF
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
trap "poweroff" EXIT
|
||||||
|
|
||||||
|
mount -t 9p -o trans=virtio,version=9p2000.L config-2 /mnt
|
||||||
|
|
||||||
|
touch log
|
||||||
|
sleep 5
|
||||||
|
openvt -s -- tail -f log &
|
||||||
|
ros install \
|
||||||
|
-d /dev/vda \
|
||||||
|
${APPEND_PARAM} \
|
||||||
|
-f \
|
||||||
|
--no-reboot >log 2>&1
|
||||||
|
|
||||||
|
touch /mnt/success
|
||||||
|
EOF
|
||||||
|
|
||||||
|
rm -f /tmp/dist/success
|
||||||
|
|
||||||
|
qemu-img create -f qcow2 ./dist/vmware/vmdk.img 8G
|
||||||
|
kvm -curses \
|
||||||
|
-drive if=virtio,file=./dist/vmware/vmdk.img \
|
||||||
|
-cdrom ./dist/artifacts/rancheros.iso \
|
||||||
|
-m 2048 \
|
||||||
|
-fsdev local,id=conf,security_model=none,path=/tmp/dist \
|
||||||
|
-device virtio-9p-pci,fsdev=conf,mount_tag=config-2 \
|
||||||
|
-device virtio-rng-pci
|
||||||
|
|
||||||
|
[ -f /tmp/dist/success ]
|
||||||
|
|
||||||
|
echo "Converting ./dist/rancheros.vmdk"
|
||||||
|
qemu-img convert -f qcow2 -O vmdk ./dist/vmware/vmdk.img ./dist/artifacts/rancheros.vmdk
|
||||||
|
|
||||||
|
for file in $(ls dist/artifacts/); do
|
||||||
|
case $file in
|
||||||
|
"initrd-"*)
|
||||||
|
echo "gsutil cp dist/artifacts/${file} gs://releases.rancher.com/os/latest/vmware/initrd" >> ./dist/publish_gss_latest.sh
|
||||||
|
echo "gsutil cp dist/artifacts/${file} gs://releases.rancher.com/os/${VERSION}/vmware/initrd" >> ./dist/publish_gss_${VERSION}.sh
|
||||||
|
;;
|
||||||
|
"rancheros.iso" | "rancheros.vmdk" | "rootfs.tar.gz")
|
||||||
|
echo "gsutil cp dist/artifacts/${file} gs://releases.rancher.com/os/latest/vmware/${file}" >> ./dist/publish_gss_latest.sh
|
||||||
|
echo "gsutil cp dist/artifacts/${file} gs://releases.rancher.com/os/${VERSION}/vmware/${file}" >> ./dist/publish_gss_${VERSION}.sh
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
@@ -1,101 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
cd $(dirname $0)/..
|
|
||||||
|
|
||||||
touch .make-vmware
|
|
||||||
|
|
||||||
source ./scripts/version
|
|
||||||
./scripts/release
|
|
||||||
|
|
||||||
if [ "$VMWARE_AUTOFORMAT" = 1 ]; then
|
|
||||||
ISO_NAME="rancheros-autoformat.iso"
|
|
||||||
mkdir -p /tmp/dist && mv ./dist/* /tmp/dist/
|
|
||||||
mkdir -p ./dist/vmware && mv /tmp/dist/* ./dist/vmware/
|
|
||||||
mkdir -p ./dist/artifacts && cp ./dist/vmware/artifacts/rancheros.iso ./dist/artifacts/${ISO_NAME}
|
|
||||||
echo "gsutil cp dist/artifacts/${ISO_NAME} gs://releases.rancher.com/os/latest/vmware/${ISO_NAME}"
|
|
||||||
echo "gsutil cp dist/artifacts/${ISO_NAME} gs://releases.rancher.com/os/${VERSION}/vmware/${ISO_NAME}"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
ROOT_FS_NAME="rootfs.tar.gz"
|
|
||||||
VMDK_NAME="rancheros.vmdk"
|
|
||||||
ISO_NAME="rancheros.iso"
|
|
||||||
|
|
||||||
if [ "$VMWARE_APPEND" != "" ]; then
|
|
||||||
echo "--append ${VMWARE_APPEND}"
|
|
||||||
APPEND_PARAM="--append \"${VMWARE_APPEND}\""
|
|
||||||
fi
|
|
||||||
|
|
||||||
mkdir -p /tmp/dist/openstack/latest && mv ./dist/* /tmp/dist/
|
|
||||||
|
|
||||||
# create rancheros-vmware.vmdk
|
|
||||||
if [ -e /tmp/dist/vmdk.img ]; then
|
|
||||||
rm -rf /tmp/dist/vmdk.img
|
|
||||||
fi
|
|
||||||
|
|
||||||
cat > /tmp/dist/openstack/latest/user_data << EOF
|
|
||||||
#!/bin/bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
trap "poweroff" EXIT
|
|
||||||
|
|
||||||
mount -t 9p -o trans=virtio,version=9p2000.L config-2 /mnt
|
|
||||||
|
|
||||||
touch log
|
|
||||||
sleep 5
|
|
||||||
openvt -s -- tail -f log &
|
|
||||||
ros install \
|
|
||||||
-d /dev/vda \
|
|
||||||
${APPEND_PARAM} \
|
|
||||||
-f \
|
|
||||||
--no-reboot >log 2>&1
|
|
||||||
|
|
||||||
touch /mnt/success
|
|
||||||
EOF
|
|
||||||
|
|
||||||
rm -f /tmp/dist/success
|
|
||||||
|
|
||||||
mkdir -p ./dist/vmware && mv /tmp/dist/* ./dist/vmware/
|
|
||||||
mkdir -p ./dist/artifacts
|
|
||||||
|
|
||||||
qemu-img create -f qcow2 ./dist/vmware/vmdk.img 8G
|
|
||||||
kvm -curses \
|
|
||||||
-drive if=virtio,file=./dist/vmware/vmdk.img \
|
|
||||||
-cdrom ./dist/vmware/artifacts/rancheros.iso \
|
|
||||||
-m 2048 \
|
|
||||||
-fsdev local,id=conf,security_model=none,path=./dist/vmware \
|
|
||||||
-device virtio-9p-pci,fsdev=conf,mount_tag=config-2 \
|
|
||||||
-device virtio-rng-pci
|
|
||||||
|
|
||||||
[ -f ./dist/vmware/success ]
|
|
||||||
|
|
||||||
echo Converting ./dist/${VMDK_NAME}
|
|
||||||
qemu-img convert -f qcow2 -O vmdk ./dist/vmware/vmdk.img ./dist/artifacts/${VMDK_NAME}
|
|
||||||
|
|
||||||
cp ./dist/vmware/artifacts/rancheros.iso ./dist/artifacts/${ISO_NAME} && \
|
|
||||||
cp ./dist/vmware/artifacts/rootfs.tar.gz ./dist/artifacts/${ROOT_FS_NAME} && \
|
|
||||||
cp ./dist/vmware/artifacts/${INITRD} ./dist/artifacts/${INITRD}
|
|
||||||
|
|
||||||
for file in $(ls dist/artifacts/); do
|
|
||||||
case $file in
|
|
||||||
"initrd-"*)
|
|
||||||
echo "gsutil cp dist/artifacts/${INITRD} gs://releases.rancher.com/os/latest/vmware/${INITRD}" >> ./dist/publish_gss_latest.sh
|
|
||||||
echo "gsutil cp dist/artifacts/${INITRD} gs://releases.rancher.com/os/${VERSION}/vmware/${INITRD}" >> ./dist/publish_gss_${VERSION}.sh
|
|
||||||
;;
|
|
||||||
"rancheros.iso")
|
|
||||||
echo "gsutil cp dist/artifacts/${ISO_NAME} gs://releases.rancher.com/os/latest/vmware/${ISO_NAME}" >> ./dist/publish_gss_latest.sh
|
|
||||||
echo "gsutil cp dist/artifacts/${ISO_NAME} gs://releases.rancher.com/os/${VERSION}/vmware/${ISO_NAME}" >> ./dist/publish_gss_${VERSION}.sh
|
|
||||||
;;
|
|
||||||
"rancheros.vmdk")
|
|
||||||
echo "gsutil cp dist/artifacts/${VMDK_NAME} gs://releases.rancher.com/os/latest/vmware/${VMDK_NAME}" >> ./dist/publish_gss_latest.sh
|
|
||||||
echo "gsutil cp dist/artifacts/${VMDK_NAME} gs://releases.rancher.com/os/${VERSION}/vmware/${VMDK_NAME}" >> ./dist/publish_gss_${VERSION}.sh
|
|
||||||
;;
|
|
||||||
"rootfs.tar.gz")
|
|
||||||
echo "gsutil cp dist/artifacts/${ROOT_FS_NAME} gs://releases.rancher.com/os/latest/vmware/${ROOT_FS_NAME}" >> ./dist/publish_gss_latest.sh
|
|
||||||
echo "gsutil cp dist/artifacts/${ROOT_FS_NAME} gs://releases.rancher.com/os/${VERSION}/vmware/${ROOT_FS_NAME}" >> ./dist/publish_gss_${VERSION}.sh
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
chmod 755 ./dist/*.sh
|
|
Reference in New Issue
Block a user