# update global uid in security-manager DB (old : 376, new : 201)
sqlite3 /opt/dbspace/.security-manager.db "UPDATE user_app SET uid="201" WHERE uid="376";"
-# List ask-type cynara rule
-ASKTYPE_CYNARA_RULE_TEMP="/opt/data/asktype_cynara_rule"
-cyad --list-policies="" --all | grep ";10;" > $ASKTYPE_CYNARA_RULE_TEMP # TODO : Need to check how to fileter ask type rule except of ";10;"
-
-# Delete ask-type cynara rule (api version <= 3.0 would not have ask-type rule in Tizen-4.0 image)
-while read ask_rule_line
-do
- CLIENT=$(echo "$ask_rule_line" | cut -d ";" -f2)
- USER=$(echo "$ask_rule_line" | cut -d ";" -f3)
- PRIVILEGE=$(echo "$ask_rule_line" | cut -d ";" -f4)
- cyad --erase="" --recursive="no" --client="$CLIENT" --user="$USER" --privilege="$PRIVILEGE"
-done < $ASKTYPE_CYNARA_RULE_TEMP
-
-rm -f $ASKTYPE_CYNARA_RULE_TEMP
+# if upgrade is ongoing from 3.x to 4.0, then askrules need to be deleted.
+source /usr/share/upgrade/rw-update-macro.inc
+get_version_info
+
+if [[ "$OLD_VER" != "4"* ]]
+then
+ # List ask-type cynara rule
+ ASKTYPE_CYNARA_RULE_TEMP="/opt/data/asktype_cynara_rule"
+ cyad --list-policies="" --all | grep ";10;" > $ASKTYPE_CYNARA_RULE_TEMP # TODO : Need to check how to fileter ask type rule except of ";10;"
+
+ # Delete ask-type cynara rule (api version <= 3.0 would not have ask-type rule in Tizen-4.0 image)
+ while read ask_rule_line
+ do
+ CLIENT=$(echo "$ask_rule_line" | cut -d ";" -f2)
+ USER=$(echo "$ask_rule_line" | cut -d ";" -f3)
+ PRIVILEGE=$(echo "$ask_rule_line" | cut -d ";" -f4)
+ cyad --erase="" --recursive="no" --client="$CLIENT" --user="$USER" --privilege="$PRIVILEGE"
+ done < $ASKTYPE_CYNARA_RULE_TEMP
+ rm -f $ASKTYPE_CYNARA_RULE_TEMP
+fi
# start cynara & security-manager
systemctl start cynara