1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252
|
#!/bin/sh
# This script is to be setup as a daily job to check if one of the
# OpenStack VM image needs an update, and generate a new one if
# needed.
set -e
set -x
if ! [ -e /etc/openstack-debian-images/openstack-debian-images.conf ] ; then
echo "$0 Configuration file /etc/openstack-debian-images/openstack-debian-images.conf missing: exiting..."
exit 1
fi
. /etc/openstack-debian-images/openstack-debian-images.conf
for RELEASE in $(echo ${RELEASE_LIST} | tr ',' ' ') ; do
echo "***************************"
echo "NOW LOOKING AT: ${RELEASE}"
echo "***************************"
if ! [ -d ${IMAGE_DEST}/${RELEASE}/current ] ; then
mkdir -p ${IMAGE_DEST}/${RELEASE}/current
cd ${IMAGE_DEST}/${RELEASE}/current
echo "-> Building a new image for ${RELEASE}"
build-openstack-debian-image \
-r ${RELEASE} \
-u ${DEB_MIRROR} \
-s ${DEB_MIRROR} \
--security-mirror ${SECURITY_MIRROR} \
--generate-package-list --grab-release-number --generate-source-tarball --generate-sums-sign 1>${IMAGE_DEST}/${RELEASE}/current/build.log 2>&1
else
cd ${IMAGE_DEST}/${RELEASE}/current
if ! check-openstack-debian-image \
--release ${RELEASE} \
--deb-mirror ${DEB_MIRROR} \
--security-mirror ${SECURITY_MIRROR} ; then
# Get info about the current installed image
LATEST=$(cat latest)
# Do a copy of the installed old version in the archive folder
# Do not archive if we're doing Sid or Bullseye.
if ! [ -e current_minor_version ] ; then
echo "Skipping archive for not released suite"
elif [ "${RELEASE}" = "sid" ] || [ "${RELEASE}" = "unstable" ] || [ "${RELEASE}" = "testing" ] ; then
echo "Skipping archive for not released"
else
CURRENT_POINT_RELEASE=$(cat current_point_release)
CURRENT_MINOR_VERSION=$(cat current_minor_version)
ARCH_DIR=${IMAGE_DEST}/${RELEASE}/archive/${CURRENT_POINT_RELEASE}.${CURRENT_MINOR_VERSION}
mkdir -p ${ARCH_DIR}
cp current_point_release current_minor_version SHA512SUMS.sign SHA512SUMS SHA512SUMS.asc ${ARCH_DIR} || true
mv ${LATEST}-packages.list ${LATEST}.raw ${LATEST}.qcow2 ${LATEST}-source.tar.gz ${ARCH_DIR} || true
fi
rm -f SHA512SUMS.sign SHA512SUMS SHA512SUMS.asc
echo "-> Building a new image for ${RELEASE}"
# Build a new version
build-openstack-debian-image \
-r ${RELEASE} \
-u ${DEB_MIRROR} \
-s ${DEB_MIRROR} \
--security-mirror ${SECURITY_MIRROR} \
--generate-package-list --grab-release-number --generate-source-tarball --generate-sums-sign 1>${IMAGE_DEST}/${RELEASE}/current/build.log 2>&1
# Remove the old version of the image
rm -f ${LATEST}-packages.list ${LATEST}.raw ${LATEST}.qcow2 ${LATEST}-source.tar.gz
fi
fi
done
for RELEASE in $(echo ${RESCUE_LIST} | tr ',' ' ') ; do
echo "***************************"
echo "NOW LOOKING AT: ${RELEASE} (rescue image)"
echo "***************************"
if ! [ -d ${IMAGE_DEST}/${RELEASE}-rescue/current ] ; then
mkdir -p ${IMAGE_DEST}/${RELEASE}-rescue/current
cd ${IMAGE_DEST}/${RELEASE}-rescue/current
echo "-> Building a new rescue image for ${RELEASE}"
build-openstack-debian-image \
-r ${RELEASE} \
-u ${DEB_MIRROR} \
-s ${DEB_MIRROR} \
--security-mirror ${SECURITY_MIRROR} \
--rescue --editor joe,vim --default-editor /bin/nano \
--generate-package-list --grab-release-number --generate-source-tarball --generate-sums-sign 1>${IMAGE_DEST}/${RELEASE}-rescue/current/build.log 2>&1
else
cd ${IMAGE_DEST}/${RELEASE}-rescue/current
if ! check-openstack-debian-image \
--release ${RELEASE} \
--deb-mirror ${DEB_MIRROR} \
--security-mirror ${SECURITY_MIRROR} ; then
# Get info about the current installed image
LATEST=$(cat latest)
# Do a copy of the installed old version in the archive folder
# Do not archive if we're doing Sid or Bullseye.
if ! [ -e current_minor_version ] ; then
echo "Skipping archive for not released suite"
elif [ "${RELEASE}" = "sid" ] || [ "${RELEASE}" = "unstable" ] || [ "${RELEASE}" = "testing" ] ; then
echo "Skipping archive for not released"
else
CURRENT_POINT_RELEASE=$(cat current_point_release)
CURRENT_MINOR_VERSION=$(cat current_minor_version)
ARCH_DIR=${IMAGE_DEST}/${RELEASE}-recue/archive/${CURRENT_POINT_RELEASE}.${CURRENT_MINOR_VERSION}
mkdir -p ${ARCH_DIR}
cp current_point_release current_minor_version SHA512SUMS.sign SHA512SUMS SHA512SUMS.asc ${ARCH_DIR} || true
mv ${LATEST}-packages.list ${LATEST}.raw ${LATEST}.qcow2 ${LATEST}-source.tar.gz ${ARCH_DIR} || true
fi
rm -f SHA512SUMS.sign SHA512SUMS SHA512SUMS.asc
echo "-> Building a new image for ${RELEASE}"
# Build a new version
build-openstack-debian-image \
-r ${RELEASE} \
-u ${DEB_MIRROR} \
-s ${DEB_MIRROR} \
--rescue --editor joe,vim --default-editor /bin/nano \
--security-mirror ${SECURITY_MIRROR} \
--generate-package-list --grab-release-number --generate-source-tarball --generate-sums-sign 1>${IMAGE_DEST}/${RELEASE}-rescue/current/build.log 2>&1
# Remove the old version of the image
rm -f ${LATEST}-packages.list ${LATEST}.raw ${LATEST}.qcow2 ${LATEST}-source.tar.gz
fi
fi
done
for OCTAVIA_IMAGE in $(echo ${OCTAVIA_IMAGES} | tr ',' ' ') ; do
echo "***************************"
echo "NOW LOOKING AT: ${OCTAVIA_IMAGE}"
echo "***************************"
DEB_REL=$(echo ${OCTAVIA_IMAGE} | cut -d- -f1)
OS_REL=$(echo ${OCTAVIA_IMAGE} | cut -d- -f2)
if [ "${DEB_REL}" = "${OS_REL}" ] ; then
REL=${DEB_REL}
EXT=""
else
REL=${DEB_REL}-${OS_REL}
EXT="--extrepo ${OS_REL}"
fi
if ! [ -d ${IMAGE_DEST}/octavia/${REL}/current ] ; then
mkdir -p ${IMAGE_DEST}/octavia/${REL}/current
cd ${IMAGE_DEST}/octavia/${REL}/current
echo "-> Building a new Octavia image for ${REL}"
build-openstack-debian-image \
-r ${DEB_REL} \
-u ${DEB_MIRROR} \
-s ${DEB_MIRROR} \
--security-mirror ${SECURITY_MIRROR} \
--generate-package-list --grab-release-number --generate-source-tarball --generate-sums-sign \
--octavia-agent ${EXT} \
1>${IMAGE_DEST}/octavia/${REL}/current/build.log 2>&1
else
cd ${IMAGE_DEST}/octavia/${REL}/current
if ! check-openstack-debian-image \
--release ${DEB_REL} \
--deb-mirror ${DEB_MIRROR} \
--security-mirror ${SECURITY_MIRROR} ; then
# Get info about the current installed image
LATEST=$(cat latest)
# Do a copy of the installed old version in the archive folder
# Do not archive if we're doing Sid or Testing.
if ! [ -e current_minor_version ] ; then
echo "Skipping archive for not released suite"
elif [ "${DEB_REL}" = "sid" ] || [ "${DEB_REL}" = "unstable" ] || [ "${DEB_REL}" = "testing" ] ; then
echo "Skipping archive for not released suite"
else
CURRENT_POINT_RELEASE=$(cat current_point_release)
CURRENT_MINOR_VERSION=$(cat current_minor_version)
ARCH_DIR=${IMAGE_DEST}/octavia/${REL}/archive/${CURRENT_POINT_RELEASE}.${CURRENT_MINOR_VERSION}
mkdir -p ${ARCH_DIR}
cp current_point_release current_minor_version SHA512SUMS.sign SHA512SUMS SHA512SUMS.asc ${ARCH_DIR} || true
mv ${LATEST}-packages.list ${LATEST}.raw ${LATEST}.qcow2 ${LATEST}-source.tar.gz ${ARCH_DIR} || true
fi
rm -f SHA512SUMS.sign SHA512SUMS SHA512SUMS.asc
echo "-> Building a new image for ${DEB_REL}"
# Build a new version
build-openstack-debian-image \
-r ${DEB_REL} \
-u ${DEB_MIRROR} \
-s ${DEB_MIRROR} \
--security-mirror ${SECURITY_MIRROR} \
--generate-package-list --grab-release-number --generate-source-tarball --generate-sums-sign \
--octavia-agent ${EXT} \
1>${IMAGE_DEST}/octavia/${REL}/current/build.log 2>&1
# Remove the old version of the image
rm -f ${LATEST}-packages.list ${LATEST}.raw ${LATEST}.qcow2 ${LATEST}-source.tar.gz
fi
fi
done
for MANILA_IMAGE in $(echo ${MANILA_IMAGES} | tr ',' ' ') ; do
echo "***************************"
echo "NOW LOOKING AT MANILA: ${MANILA_IMAGE}"
echo "***************************"
DEB_REL=$(echo ${MANILA_IMAGE})
REL=${MANILA_IMAGE}
if ! [ -d ${IMAGE_DEST}/manila/${REL}/current ] ; then
mkdir -p ${IMAGE_DEST}/manila/${REL}/current
cd ${IMAGE_DEST}/manila/${REL}/current
echo "-> Building a new Manila image for ${REL}"
build-openstack-debian-image \
-r ${DEB_REL} \
-u ${DEB_MIRROR} \
-s ${DEB_MIRROR} \
--security-mirror ${SECURITY_MIRROR} \
--generate-package-list --grab-release-number --generate-source-tarball --generate-sums-sign \
--manila-agent \
1>${IMAGE_DEST}/manila/${REL}/current/build.log 2>&1
else
cd ${IMAGE_DEST}/manila/${REL}/current
if ! check-openstack-debian-image \
--release ${DEB_REL} \
--deb-mirror ${DEB_MIRROR} \
--security-mirror ${SECURITY_MIRROR} ; then
# Get info about the current installed image
LATEST=$(cat latest)
# Do a copy of the installed old version in the archive folder
# Do not archive if we're doing Sid or Testing.
if ! [ -e current_minor_version ] ; then
echo "Skipping archive for not released suite"
elif [ "${DEB_REL}" = "sid" ] || [ "${DEB_REL}" = "unstable" ] || [ "${DEB_REL}" = "testing" ] ; then
echo "Skipping archive for not released suite"
else
CURRENT_POINT_RELEASE=$(cat current_point_release)
CURRENT_MINOR_VERSION=$(cat current_minor_version)
ARCH_DIR=${IMAGE_DEST}/manila/${REL}/archive/${CURRENT_POINT_RELEASE}.${CURRENT_MINOR_VERSION}
mkdir -p ${ARCH_DIR}
cp current_point_release current_minor_version SHA512SUMS.sign SHA512SUMS SHA512SUMS.asc ${ARCH_DIR} || true
mv ${LATEST}-packages.list ${LATEST}.raw ${LATEST}.qcow2 ${LATEST}-source.tar.gz ${ARCH_DIR} || true
fi
rm -f SHA512SUMS.sign SHA512SUMS SHA512SUMS.asc
echo "-> Building a new image for ${DEB_REL}"
# Build a new version
build-openstack-debian-image \
-r ${DEB_REL} \
-u ${DEB_MIRROR} \
-s ${DEB_MIRROR} \
--security-mirror ${SECURITY_MIRROR} \
--generate-package-list --grab-release-number --generate-source-tarball --generate-sums-sign \
--manila-agent \
1>${IMAGE_DEST}/manila/${REL}/current/build.log 2>&1
fi
fi
done
|