--- /dev/null
+#!/bin/bash
+# Copyright (c) 2019 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.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# @file release.sh
+# @author Zofia Grzelewska <z.abramowska@samsung.com>
+# @brief Helper script for preparing release commit
+#
+
+echo "Alfa-version of release script. Use on your own responsibility ;)"
+
+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"
+
+# A POSIX variable
+OPTIND=1 # Reset in case getopts has been used previously in the shell.
+
+# Initialize our own variables:
+UPDATE_MAJOR=0
+
+while getopts "h?m" opt; do
+ case "$opt" in
+ h)
+ echo "Release script for updating askuser-notification version (default: minor version is updated)"
+ echo "Usage: $0 [-m Update major option instead of minor]"
+ exit 0
+ ;;
+ \?)
+ echo "Invalid option: -$OPTARG" >&2
+ exit 1
+ ;;
+ m) UPDATE_MAJOR=1
+ ;;
+ esac
+done
+
+if ((UPDATE_MAJOR))
+then
+ NEW_MAJOR=$((CURRENT_MAJOR + 1))
+ NEW_MINOR=0
+else
+ NEW_MAJOR=$CURRENT_MAJOR
+ NEW_MINOR=$((CURRENT_MINOR + 1))
+fi
+
+NEW_VERSION="$NEW_MAJOR.$NEW_MINOR"
+
+read -p "Update askuser release from $CURRENT_VERSION to $NEW_VERSION? [y/n]" -n 1 -r
+echo
+
+
+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"
+ echo "Updating spec files..."
+ find . -name "*.spec" -type f -print0 | xargs -0 sed -i "s/${CURRENT_VERSION}/${NEW_VERSION}/g"
+
+ echo "Checking left files..."
+ left_files=($(git grep -IF "${CURRENT_VERSION}" | awk -F ":" '{print $1}' | sort -u))
+
+ CHANGELOG_FILE="packaging/askuser.changes"
+ if [ ${#left_files[*]} -ne 1 ]
+ then
+ echo "WARNING! Unexpected files left with old version still present :"
+ echo "${left_files[*]}"
+ fi
+
+ if [ "${left_files}" != "${CHANGELOG_FILE}" ]
+ then
+ echo "WARNING! Unexpected file left with old version still present : ${left_files}"
+ fi
+
+ echo "Updating changelog..."
+
+ AUTHOR_NAME=`git config user.name`
+ AUTHOR_EMAIL=`git config user.email`
+ COMMIT_DATE=`date "+%a %b %d %Y"`
+
+ RELEASE_COMMIT=`git log --pretty=oneline --abbrev-commit | grep "Release.*${CURRENT_VERSION}" | awk {'print $1'}`
+ IFS=$'\n'
+ COMMIT_LIST=($(git log --pretty=oneline --abbrev-commit ${RELEASE_COMMIT}..HEAD | awk {'first = $1; $1=""; print $0'}|sed 's/^ //g'))
+#COMMIT_LIST=`git log --pretty=oneline --abbrev-commit ${RELEASE_COMMIT}..HEAD | awk {'first = $1; $1=""; print $0'}|sed 's/^ //g'`
+
+ COMMIT_TITLE="Release version 0.${NEW_VERSION}"
+ COMMIT_MSG_LIST=""
+ NEWLINE=$'\n'
+ for COMMIT in ${COMMIT_LIST[@]}
+ do
+ COMMIT_MSG_LIST="${COMMIT_MSG_LIST}- ${COMMIT}${NEWLINE}"
+ done
+
+ echo "${COMMIT_DATE} ${AUTHOR_NAME} <${AUTHOR_EMAIL}>
+${COMMIT_TITLE}
+${COMMIT_MSG_LIST}
+$(cat ${CHANGELOG_FILE})" > ${CHANGELOG_FILE}
+
+ echo "Generating commit msg..."
+ COMMIT_MSG="${COMMIT_TITLE}${NEWLINE}${NEWLINE}${COMMIT_MSG_LIST}"
+
+ git commit "*CMakeLists.txt" "*spec" $CHANGELOG_FILE -m "${COMMIT_MSG}"
+
+ unset IFS
+
+fi
+
+exit
+