tizen beta release
[framework/web/wrt-commons.git] / debian / wrt-commons.postinst
1 #!/bin/sh
2
3 if [ -z ${2} ]; then
4     echo "This is new install of wrt-commons"
5     echo "Calling /usr/bin/wrt_reset_db.sh"
6     /usr/bin/wrt_reset_db.sh
7 else
8     # Find out old and new version of databases
9     WRT_OLD_DB_VERSION=`sqlite3 /opt/dbspace/.wrt.db ".tables" | grep "DB_VERSION_"`
10     WRT_NEW_DB_VERSION=`cat /usr/share/wrt-engine/wrt_db.sql | tr '[:blank:]' '\n' | grep DB_VERSION_`
11     ACE_OLD_DB_VERSION=`sqlite3 /opt/dbspace/.ace.db ".tables" | grep "DB_VERSION_"`
12     ACE_NEW_DB_VERSION=`cat /usr/share/wrt-engine/ace_db.sql | tr '[:blank:]' '\n' | grep DB_VERSION_`
13     VCORE_OLD_DB_VERSION=`sqlite3 /opt/dbspace/.vcore.db ".tables" | grep "DB_VERSION_"`
14     VCORE_NEW_DB_VERSION=`cat /usr/share/wrt-engine/vcore_db.sql | tr '[:blank:]' '\n' | grep DB_VERSION_`
15     echo "OLD wrt database version ${WRT_OLD_DB_VERSION}"
16     echo "NEW wrt database version ${WRT_NEW_DB_VERSION}"
17     echo "OLD ace database version ${ACE_OLD_DB_VERSION}"
18     echo "NEW ace database version ${ACE_NEW_DB_VERSION}"
19     echo "OLD vcore database version ${VCORE_OLD_DB_VERSION}"
20     echo "NEW vcore database version ${VCORE_NEW_DB_VERSION}"
21
22
23     if [ ${WRT_OLD_DB_VERSION} -a ${WRT_NEW_DB_VERSION} -a ${ACE_OLD_DB_VERSION} -a ${ACE_NEW_DB_VERSION} -a ${VCORE_OLD_DB_VERSION} -a ${VCORE_NEW_DB_VERSION} ]
24     then
25         if [ ${WRT_NEW_DB_VERSION} = ${WRT_OLD_DB_VERSION} -a ${ACE_NEW_DB_VERSION} = ${ACE_OLD_DB_VERSION} -a ${VCORE_OLD_DB_VERSION} = ${VCORE_NEW_DB_VERSION} ]
26         then
27             echo "Equal database detected so db installation ignored"
28         else
29             echo "Calling /usr/bin/wrt_reset_db.sh"
30             /usr/bin/wrt_reset_db.sh
31         fi
32     else
33         echo "Calling /usr/bin/wrt_reset_db.sh"
34         /usr/bin/wrt_reset_db.sh
35     fi
36 fi
37
38 mkdir -p /usr/etc/ace
39 mkdir -p /usr/apps/org.tizen.policy
40
41 # 3. configurations
42 chown root:root /usr/etc/ace/config.xml
43
44 # DBUS services fix
45 # WARNING: THIS IS TEMPORARY SOLUTION, AS THIS SHOULD NOT BE OUR
46 # RESPONSIBILITY!!! WE HAVE TO CONTACT TO DBUS MAINAINERS
47
48 if [ -f /var/lib/dbus/machine-id ]; then
49     echo "machine-id exists"
50 else
51     if [ -f /usr/var/lib/dbus/machine-id ]; then
52         echo "machine-id exists"
53     else
54         echo "Creating machine-id"
55         mkdir -p /usr/var/lib/dbus/
56         dbus-uuidgen > /usr/var/lib/dbus/machine-id
57         dbus-uuidgen --ensure=/usr/var/lib/dbus/machine-id
58     fi
59     mkdir -p /var/lib/dbus/
60     cp /usr/var/lib/dbus/machine-id /var/lib/dbus/
61 fi
62
63 echo "[WRT] wrt-commons postinst done ..."