#!/bin/bash
-# Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+# Copyright (c) 2019-2020 Samsung Electronics Co., Ltd. All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
CURRENT_MAJOR=($(cat packaging/askuser-notification.spec | grep Version | awk -F ":" '{print $2}' | awk -F "." '{print $2}'))
CURRENT_MINOR=($(cat packaging/askuser-notification.spec | grep Version | awk -F ":" '{print $2}' | awk -F "." '{print $3}'))
CURRENT_VERSION="$CURRENT_MAJOR.$CURRENT_MINOR"
+CURRENT_VERSION_RE="\\<$CURRENT_MAJOR\\.$CURRENT_MINOR\\>"
# A POSIX variable
OPTIND=1 # Reset in case getopts has been used previously in the shell.
if [[ $REPLY =~ ^[Yy]$ ]]
then
echo "Updating CMakeLists.txt files..."
- find . -name "CMakeLists.txt" -type f -print0 | xargs -0 sed -i "s/${CURRENT_VERSION}/${NEW_VERSION}/g"
+ find . -name "CMakeLists.txt" -type f -print0 | xargs -0 sed -i "s/${CURRENT_VERSION_RE}/${NEW_VERSION}/g"
echo "Updating spec files..."
- find . -name "*.spec" -type f -print0 | xargs -0 sed -i "s/${CURRENT_VERSION}/${NEW_VERSION}/g"
+ find . -name "*.spec" -type f -print0 | xargs -0 sed -i "s/${CURRENT_VERSION_RE}/${NEW_VERSION}/g"
echo "Checking left files..."
- left_files=($(git grep -IF "${CURRENT_VERSION}" | awk -F ":" '{print $1}' | sort -u))
+ left_files=($(git grep -I "${CURRENT_VERSION_RE}" | awk -F ":" '{print $1}' | sort -u))
CHANGELOG_FILE="packaging/askuser.changes"
if [ ${#left_files[*]} -ne 1 ]