Updating context script

hi all,

i’m trying to update a contextualisation script, but i don’t find an easy way to do it. i assume this means that i have to create a new one, but if that is the case, is there an easy way to locate and update the templates that use the current script, and modifiy them to use the new one?


I use libguestfs to automate that process. First I create an ISO file with the context packages (labeled EXTRA) and a script with the commands I want to execute inside. For example, for CentOS:

mkdir /tmp/mount
mount LABEL=EXTRA /tmp/mount

# Install opennebula context package
rpm -Uvh /tmp/mount/one-context*rpm

# Remove cloud-init and NetworkManager
yum remove -y NetworkManager cloud-init

# Install growpart and upgrade util-linux
yum install -y epel-release --nogpgcheck
yum install -y cloud-utils-growpart --nogpgcheck
yum upgrade -y util-linux --nogpgcheck

After that virt-customize is executed with these parameters:

PASSWD="--root-password disabled"
virt-customize --attach $ISO_IMAGE --run $script --format qcow2 -v -a $image $PASSWD

This is based on the example from virt-customize.

1 Like