ironic-python-agent/imagebuild/tinyipa/build-instance-images.sh
Vasyl Saienko 8bf0629749 Update tiny-instance image to contain branch name
With this patch branch is added to tiny-instance image name.

Also fixed a problem with BRANCH_PATH was set to refs/heads/master
after migration to zuulv3

Change-Id: I490e2d51a7c3fbc2cc0fa78a95b984874ab934f7
2017-10-25 14:47:11 +00:00

37 lines
839 B
Bash
Executable File

#!/bin/bash
set -ex
WORKDIR=$(readlink -f $0 | xargs dirname)
DST_DIR=$(mktemp -d)
source ${WORKDIR}/common.sh
PARTIMG="$WORKDIR/tiny-instance-part${BRANCH_EXT}.img"
UECFILE="$WORKDIR/tiny-instance-uec${BRANCH_EXT}.tar.gz"
fs_type='ext4'
sudo rm -rf $PARTIMG $UECFILE
sudo truncate --size=150M $PARTIMG
sudo mkfs."${fs_type}" -F "$PARTIMG" -L "root"
sudo mount -o loop "$PARTIMG" "$DST_DIR/"
# Extract rootfs from .gz file
( cd "$DST_DIR" && zcat $WORKDIR/build_files/corepure64.gz | sudo cpio -i -H newc -d )
setup_tce $DST_DIR
$TC_CHROOT_CMD tce-load -wci grub2-multi.tcz
cleanup_tce $DST_DIR
sudo umount $DST_DIR/
pushd $DST_DIR/
cp $WORKDIR/tinyipa${BRANCH_EXT}.gz $DST_DIR/tinyipa-initrd
cp $WORKDIR/tinyipa${BRANCH_EXT}.vmlinuz $DST_DIR/tinyipa-vmlinuz
cp $PARTIMG $DST_DIR/
tar -czf $UECFILE ./
popd
sudo rm -rf $DST_DIR