name="centos7"
lxc launch images:centos/7/amd64 "$name"
# from inside container
cat > build-it <<"EOF"
#!/bin/sh
# this is needed at least for python-oauthlib
set -e
ssh=false
repo="${1:-https://git.launchpad.net/~smoser/cloud-init}"
branch="${2:-master}"
packages="$packages
rpm-build
git
"
# these come from translating the output of read-dependencies
# through the package map in packages/brpm
packages="$packages
python-oauthlib
python-argparse
python-cheetah
python-jinja2
python-configobj
python-jsonpatch
python-oauthlib
python-prettytable
pyserial
PyYAML
python-requests
python-six
python-devel
"
if $openssh; then
packages="$packages openssh-server"
fi
yum install --assumeyes epel-release
yum install --assumeyes $packages
if $openssh; then
systemctl enable sshd
systemctl start sshd
# lock root logins via password, and un-expire it
# 117005 is days since 1970, that one is in 2026
passwd -l root
sed -i 's,\(root:[^:]*:\)0,\117005,p' /etc/shadow
fi
git clone "$repo" cloud-init
cd cloud-init
git branch -l | grep -q "^$branch$" ||
git branch "$branch" "origin/$branch"
git checkout "$branch"
./packages/brpm
EOF
lxc file push $name/root/build-it "build-it"
lxc exec "$name" -- chmod 755 /root/build-it
lxc exec "$name" -- /root/build-it
lxc ecec "$name" -- /root/build-it \
https://git.launchpad.net/~smoser/cloud-init feature/move-to-git