Modify upgrade script. 31/192031/5 submit/tizen_4.0/20181029.073014
authorjin-gyu.kim <jin-gyu.kim@samsung.com>
Mon, 29 Oct 2018 05:20:20 +0000 (14:20 +0900)
committerYunjin Lee <yunjin-.lee@samsung.com>
Mon, 29 Oct 2018 06:20:00 +0000 (06:20 +0000)
- If upgrade is ongoing from 4.x to 4.x, then askrules should not be deleted.

Change-Id: I91101fcdb039d1b8c47776e734bedfecc58238e7

upgrade/201.security_upgrade.sh

index 487c87a69eede49b871c56e841972cd6e3eaf961..603b897ba3e6d534ac9c55e2ffe2a91e1d594968 100644 (file)
@@ -18,20 +18,26 @@ PATH=/bin:/usr/bin:/sbin:/usr/sbin
 # 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