add installing p12 for cert-mgr
[platform/core/security/cert-svc.git] / debian / libcert-svc1.postinst
1 #!/bin/sh -e
2
3 USE_CERT=6524
4
5 case "$1" in
6     configure)
7     if [ `whoami` = "root" ]
8     then
9         chown -R root:${USE_CERT} /opt/share/cert-svc/certs/
10         chmod -R 0775 /opt/share/cert-svc/certs/
11     fi
12
13     if [ -z ${2} ]
14     then
15         echo "This is new install of wrt-security"
16         echo "Calling /usr/bin/cert_svc_create_clean_db.sh"
17         /usr/bin/cert_svc_create_clean_db.sh
18     else
19         # Find out old and new version of databases
20         VCORE_OLD_DB_VERSION=`sqlite3 /opt/dbspace/.cert_svc_vcore.db ".tables" | grep "DB_VERSION_"`
21         VCORE_NEW_DB_VERSION=`cat /usr/share/cert-svc/cert_svc_vcore_db.sql | tr '[:blank:]' '\n' | grep DB_VERSION_`
22         echo "OLD vcore database version ${VCORE_OLD_DB_VERSION}"
23         echo "NEW vcore database version ${VCORE_NEW_DB_VERSION}"
24
25         if [ ${VCORE_OLD_DB_VERSION} -a ${VCORE_NEW_DB_VERSION} ]
26         then
27             if [ ${VCORE_OLD_DB_VERSION} = ${VCORE_NEW_DB_VERSION} ]
28             then
29                 echo "Equal database detected so db installation ignored"
30             else
31                 echo "Calling /usr/bin/cert_svc_create_clean_db.sh"
32                 /usr/bin/cert_svc_create_clean_db.sh
33             fi
34         else
35             echo "Calling /usr/bin/cert_svc_create_clean_db.sh"
36             /usr/bin/cert_svc_create_clean_db.sh
37         fi
38     fi
39     ;;
40
41     abort-upgrade|abort-remove|abort-deconfigure)
42     ;;
43
44     *)
45         echo "postinst called with unknown argument \`$1'" >&2
46         exit 1
47     ;;
48 esac
49
50 # dh_installdeb will replace this with shell code automatically
51 # generated by other debhelper scripts.
52
53 #DEBHELPER#
54
55 exit 0