Name: wrtjs
Summary: Javascript based Runtime for Tizen
-Version: 1.0.0
+# Version: {TPK_VERSION}.{INTERNAL_API_REVISION}.{WRTJS_VERSION}
+# The {INTERNAL_API_REVISION} is used to check compatibility with chromium-efl.
+Version: 1.0.1
Release: 1
Group: Web Framework/Web Runtime
License: Apache-2.0
echo "No TPK generation"
%endif
+%pre
+if (( $(rpm -qa | grep 'chromium-efl-[[:digit:]]' | wc -l) > 1 )); then
+ echo -e "\033[31m*****************************************************"
+ echo -e "Please remove chromium-efl rpm(s) except for one:\n"
+ rpm -qa | grep 'chromium-efl-[[:digit:]]'
+ echo -e "*****************************************************\033[m"
+ exit 1
+fi
+
+export CHROMIUM_REVISION=$(rpm -qa | grep chromium-efl | awk -F. '{print $2}')
+export WRTJS_REVISION=$(echo %{version} | awk -F. '{print $2}')
+if [[ "${CHROMIUM_REVISION}" == "" ]]; then
+ CHROMIUM_REVISION="not installed"
+fi
+
+echo -e "\033[32m*****************************************************"
+echo -e "* chromium-efl revision : ${CHROMIUM_REVISION}"
+echo -e "* wrtjs revision : ${WRTJS_REVISION}"
+echo -e "*"
+if [[ "${CHROMIUM_REVISION}" == "not installed" ]] || \
+ (( ${CHROMIUM_REVISION} == ${WRTJS_REVISION} )); then
+ echo -e "* Succeeded to check rpm versions"
+ echo -e "*****************************************************\033[m"
+else
+ if (( ${CHROMIUM_REVISION} > ${WRTJS_REVISION} )); then
+ echo -e "\033[31m* You're trying to install too old wrtjs."
+ echo -e "* Please install wrtjs as revision $CHROMIUM_REVISION"
+ echo -e "* or"
+ else
+ echo -e "\033[31m* You have too old chromium-efl."
+ fi
+ echo -e "* please re-install chromium-efl as revision $WRTJS_REVISION first."
+ echo -e "*****************************************************\033[m"
+ exit 1
+fi
+
%post
%postun