summaryrefslogtreecommitdiff
path: root/script/factoryreset-verify.sh
blob: 3302a2127485bdbf04b4b5056f2eede698581d6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/sh
#
# Copyright (c) 20014- 2017 Samsung Electronics Co., Ltd.
#
# Contact: MyoungJune Park <mj2004.park@samsung.com>
#   Created by Wonil Choi <wonil22.choi@samsung.com>
#
# 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.
#

logfile="/tmp/.verify_fail.log"
logchecksum="/tmp/verify_checksum.log"

CURRENTPATH=`/bin/pwd`
ROOTDIR=/

OPT="opt/"
rdir=usr/system/RestoreDir/

cd ${ROOTDIR}

check_verify () {
# check checksums with target data(restored)
	cd $ROOTDIR; /usr/bin/md5sum -c ${ROOTDIR}${rdir}checksum.md5  > $logchecksum

	if [ $? -ne 0 ];then
		echo "reset verify failed"
		# RESERVED STRING for verification result
		echo "FACTORYRESET VERIFICATION : FAIL"
		/bin/grep FAIL $logchecksum
		/bin/grep FAIL $logchecksum > $logfile
		FACTORY_RESULT="NG,"
# CALLS
		CALLS_DB=`/bin/grep "phone-misc.db:" $logfile`
#		CALLS_APP=`/bin/grep "org.tizen.phone" $logfile`
# contact db also has call logs
		CONTACT_DB=`/bin/grep "contacts-svc.db:" $logfile`
		if [[ "z$CALLS_DB" != "z" || "z$CALLS_APP" != "z" ||
				"z$CONTACT_DB" != "z" ]]; then
			FACTORY_RESULT="${FACTORY_RESULT}CALLS/"
		fi
# SMEMO
		SMEMO_DB=`/bin/grep "smemo.db:" $logfile`
#		SMEMO_APP=`/bin/grep "org.tizen.smemo" $logfile`
		if [[ "z$SMEMO_DB" != "z" || "z$SMEMO_APP" != "z" ]]; then
			FACTORY_RESULT="${FACTORY_RESULT}SMEMO/"
		fi
# MEMO
		MEMO_DB=`/bin/grep "\.memo.db:" $logfile`
#		MEMO_APP=`/bin/grep "org.tizen.memo" $logfile`
		if [[ "z$MEMO_DB" != "z" || "z$MEMO_APP" != "z" ]]; then
			FACTORY_RESULT="${FACTORY_RESULT}MEMO/"
		fi
# SMS/MMS
		MSG_DB=`/bin/grep "msg_service.db:" $logfile`
#		MSG_APP=`/bin/grep "org.tizen.message" $logfile`
#		MSG_SVC=`/bin/grep "msg-service" $logfile`
		if [[ "z$MSG_DB" != "z" || "z$MSG_APP" != "z" ||
				"z$MSG_SVC" != "z" ]]; then
			FACTORY_RESULT="${FACTORY_RESULT}SMS/MMS/"
		fi
# ALARM
		ALARM_DB=`/bin/grep "alarm.db:" $logfile`
#		ALARM_APP=`/bin/grep "org.tizen.clock" $logfile`
		ALARMMGR_DB=`/bin/grep "alarmmgr.db:" $logfile`
		if [[ "z$ALARM_DB" != "z" || "z$ALARM_APP" != "z" ||
				"z$ALARMMGR_DB" != "z" ]]; then
			FACTORY_RESULT="${FACTORY_RESULT}ALARM/"
		fi
# CONTACT
#		CONTACT_APP=`/bin/grep "org.tizen.contacts" $logfile`
#		CONTACT_SVC=`/bin/grep "contacts-svc" $logfile`
		if [[ "z$CONTACT_DB" != "z" || "z$CONTACT_APP" != "z" ||
				"z$CONTACT_SVC" != "z" ]]; then
			FACTORY_RESULT="${FACTORY_RESULT}CONTACT/"
		fi

## Report final results
		if [ "$FACTORY_RESULT" != "NG," ]; then
			echo $FACTORY_RESULT
		fi
	else
		echo "factory reset verify success"
		echo "FACTORYRESET VERIFICATION : OK"
	fi

	/bin/rm -f $logfile
	/bin/rm -f $logchecksum
}

check_verify