Update User Agent String
[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_commons_reset_db.sh"
6     /usr/bin/wrt_commons_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     AUTOSAVE_OLD_DB_VERSION=`sqlite3 /opt/dbspace/.wrt_autosave.db ".tables" | grep "DB_VERSION_"`
12     AUTOSAVE_NEW_DB_VERSION=`cat /usr/share/wrt-engine/wrt_autosave_db.sql | tr '[:blank:]' '\n' | grep DB_VERSION_`
13     echo "OLD wrt database version ${WRT_OLD_DB_VERSION}"
14     echo "NEW wrt database version ${WRT_NEW_DB_VERSION}"
15     echo "OLD wrt_autosave database version ${AUTOSAVE_OLD_DB_VERSION}"
16     echo "NEW wrt_autosave database version ${AUTOSAVE_NEW_DB_VERSION}"
17
18     if [ ${WRT_OLD_DB_VERSION} -a ${WRT_NEW_DB_VERSION} -a ${AUTOSAVE_OLD_DB_VERSION} -a ${AUTOSAVE_NEW_DB_VERSION} ]
19     then
20         if [ ${WRT_NEW_DB_VERSION} = ${WRT_OLD_DB_VERSION} -a ${AUTOSAVE_NEW_DB_VERSION} = ${AUTOSAVE_OLD_DB_VERSION} ]
21         then
22             echo "Equal database detected so db installation ignored"
23         else
24             echo "Calling /usr/bin/wrt_commons_reset_db.sh"
25             /usr/bin/wrt_commons_reset_db.sh
26         fi
27     else
28         echo "Calling /usr/bin/wrt_commons_reset_db.sh"
29         /usr/bin/wrt_commons_reset_db.sh
30     fi
31 fi
32
33 mkdir -p /usr/etc/ace
34 mkdir -p /usr/apps/org.tizen.policy
35
36 # DBUS services fix
37 # WARNING: THIS IS TEMPORARY SOLUTION, AS THIS SHOULD NOT BE OUR
38 # RESPONSIBILITY!!! WE HAVE TO CONTACT TO DBUS MAINAINERS
39
40 if [ -f /var/lib/dbus/machine-id ]; then
41     echo "machine-id exists"
42 else
43     if [ -f /usr/var/lib/dbus/machine-id ]; then
44         echo "machine-id exists"
45     else
46         echo "Creating machine-id"
47         mkdir -p /usr/var/lib/dbus/
48         dbus-uuidgen > /usr/var/lib/dbus/machine-id
49         dbus-uuidgen --ensure=/usr/var/lib/dbus/machine-id
50     fi
51     mkdir -p /var/lib/dbus/
52     cp /usr/var/lib/dbus/machine-id /var/lib/dbus/
53 fi
54
55 echo "[WRT] wrt-commons postinst done ..."