Skip to content

Commit 1754a64

Browse files
committed
fix more scripts
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
1 parent 60b5a2a commit 1754a64

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

scripts/installer/export-templates.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,21 @@
1616
# specific language governing permissions and limitations
1717
# under the License.
1818

19+
NEW_VERSIONING_CUTOVER_MAJOR_VERSION=24
20+
1921
METADATA_FILE="metadata.ini"
2022
IMAGE_PATH=${3:-"/usr/share/cloudstack-management/templates/systemvm/"}
2123
TEMPLATE_VERSION=$(awk -F "=" '/version/ {print $2}' ${IMAGE_PATH}${METADATA_FILE} | xargs)
2224
TEMPLATE_PATH="/usr/share/cloudstack-management/templates/systemvm/"
23-
VERSION="${TEMPLATE_VERSION%.*}"
25+
TEMPLATE_MAJOR_VERSION="$(cut -d'.' -f1 <<<"$TEMPLATE_VERSION")"
26+
if [[ "$TEMPLATE_MAJOR_VERSION" -ge "$NEW_VERSIONING_CUTOVER_MAJOR_VERSION" ]]; then
27+
# New versioning (major.minor.security): the generated template files use the full version as-is.
28+
VERSION="${TEMPLATE_VERSION}"
29+
else
30+
# Legacy versioning (major.minor.patch.security): the generated template files drop the trailing
31+
# security component.
32+
VERSION="${TEMPLATE_VERSION%.*}"
33+
fi
2434
PREFIX=${4:-"systemvmtemplate-$VERSION"}
2535
CLEANUP=${2:-1}
2636
TEMP_IMAGE_PATH="/tmp/sysvm_convert/"

0 commit comments

Comments
 (0)