summarylogtreecommitdiffstats
path: root/xplico.install
blob: 7d186dc6b87dce22ae870db257abc4a00ff29155 (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
post_install() {
  XPLICO_BASE=/opt/xplico
  DB="${XPLICO_BASE}/xplico.db"
  DB_OLD="${XPLICO_BASE}/xplico_old.db"
  DB_NEW="${XPLICO_BASE}/xplico_new.db"
  XI="${XPLICO_BASE}/xi/app/"
  XPLICO_SQLITE_BASE="${XPLICO_BASE}/script/db/sqlite"
  PHPINI=/etc/php/php.ini
  PHPINIEXTRA=/etch/php/conf.d/3-mcrypt.ini
  HTTPDCONF=/etc/httpd/conf/httpd.conf

  echo "Don't forget to enable sqlite3 extension in $PHPINI"
  echo "Don't forget to enable pdo_sqlite extension in $PHPINI"
  echo "Don't forget to enable mcrypt extension in $PHPINIEXTRA"
  echo "Don't forget to enable mod_rewrite module in $HTTPDCONF"
  echo "Default Xplico daemon port is 9876"

  mkdir -p ${XI}/tmp/cache/{persistent,models}
  chmod 777 -R ${XI}/tmp/cache/

  cd "${XPLICO_SQLITE_BASE}" || exit 1
  if [ -e "${DB}" ]; then
    echo "Preserving previous Xplico database"
    mv "${DB}" "${DB_OLD}"
    sh create_xplico_db.sh
    mv "${DB}" "${DB_NEW}"
    mv "${DB_OLD}" "${DB}"
    sh create_xplico_db.sh
    python3 upgrade_db.py
    rm -f "${DB_NEW}"
    rm -rf /opt/xplico/xi/app/tmp/cache/models/*
    rm -rf /opt/xplico/xi/app/tmp/cache/views/*
  else
    echo "Creating new Xplico database"
    sh create_xplico_db.sh
  fi

}

post_remove() {
  echo "Don't forget to remove ${XPLICO_BASE} directory"
}