diff --git a/conf/bootstrap_context.php b/conf/bootstrap_context.php
new file mode 100644
index 0000000..3cb646f
--- /dev/null
+++ b/conf/bootstrap_context.php
@@ -0,0 +1,130 @@
+
+ * This file is part of Pydio.
+ *
+ * Pydio is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Pydio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Pydio. If not, see .
+ *
+ * The latest code can be found at .
+ *
+ * This is the main configuration file for configuring the core of the application.
+ * In a standard usage, you should not have to change any variables.
+ */
+@date_default_timezone_set(@date_default_timezone_get());
+if (function_exists("xdebug_disable")) {
+ xdebug_disable();
+}
+@error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT);
+//Windows users may have to uncomment this
+//setlocale(LC_ALL, '');
+@libxml_disable_entity_loader(false);
+
+list($vNmber,$vDate) = explode("__",file_get_contents(AJXP_CONF_PATH."/VERSION"));
+define("AJXP_VERSION", $vNmber);
+define("AJXP_VERSION_DATE", $vDate);
+
+define("AJXP_EXEC", true);
+
+// APPLICATION PATHES CONFIGURATION
+define("AJXP_DATA_PATH", "/home/yunohost.app/pydio/data");
+define("AJXP_CACHE_DIR", AJXP_DATA_PATH."/cache");
+define("AJXP_SHARED_CACHE_DIR", AJXP_DATA_PATH."/cache");
+define("AJXP_PLUGINS_CACHE_FILE", AJXP_CACHE_DIR."/plugins_cache.ser");
+define("AJXP_PLUGINS_REQUIRES_FILE", AJXP_CACHE_DIR."/plugins_requires.ser");
+define("AJXP_PLUGINS_QUERIES_CACHE", AJXP_CACHE_DIR."/plugins_queries.ser");
+define("AJXP_PLUGINS_MESSAGES_FILE", AJXP_CACHE_DIR."/plugins_messages.ser");
+define("AJXP_SERVER_ACCESS", "index.php");
+define("AJXP_PLUGINS_FOLDER", "plugins");
+define("AJXP_BIN_FOLDER_REL", "core/classes");
+define("AJXP_BIN_FOLDER", AJXP_INSTALL_PATH."/core/classes");
+define("AJXP_DOCS_FOLDER", "core/doc");
+define("AJXP_COREI18N_FOLDER", AJXP_INSTALL_PATH."/plugins/core.ajaxplorer/i18n");
+define("TESTS_RESULT_FILE", AJXP_CACHE_DIR."/diag_result.php");
+define("AJXP_TESTS_FOLDER", AJXP_INSTALL_PATH."/core/tests");
+define("INITIAL_ADMIN_PASSWORD", "admin");
+// Startup admin password (used at first creation). Once
+// The admin password is created and his password is changed,
+// this config has no more impact.
+define("ADMIN_PASSWORD", "admin");
+// For a specific distribution, you can specify where the
+// log files will be stored. This should be detected by log.* plugins
+// and used if defined. See bootstrap_plugins.php default configs for
+// example in log.serial. Do not forget the trailing slash
+// define("AJXP_FORCE_LOGPATH", "/var/log/ajaxplorer/");
+
+
+// DEBUG OPTIONS
+define("AJXP_CLIENT_DEBUG" , false);
+define("AJXP_SERVER_DEBUG" , false);
+define("AJXP_SKIP_CACHE" , false);
+
+
+// PBKDF2 CONSTANTS FOR A SECURE STORAGE OF PASSWORDS
+// These constants may be changed without breaking existing hashes.
+define("PBKDF2_HASH_ALGORITHM", "sha256");
+define("PBKDF2_ITERATIONS", 1000);
+define("PBKDF2_SALT_BYTE_SIZE", 24);
+define("PBKDF2_HASH_BYTE_SIZE", 24);
+
+define("HASH_SECTIONS", 4);
+define("HASH_ALGORITHM_INDEX", 0);
+define("HASH_ITERATION_INDEX", 1);
+define("HASH_SALT_INDEX", 2);
+define("HASH_PBKDF2_INDEX", 3);
+
+// CAN BE SWITCHED TO TRUE TO MAKE THE SECURE TOKEN MORE SAFE
+// MAKE SURE YOU HAVE PHP.5.3, OPENSSL, AND THAT IT DOES NOT DEGRADE PERFORMANCES
+define("USE_OPENSSL_RANDOM", false);
+
+function AjaXplorer_autoload($className)
+{
+ $fileName = AJXP_BIN_FOLDER."/"."class.".$className.".php";
+ if (file_exists($fileName)) {
+ require_once($fileName);
+ return;
+ }
+ $fileName = AJXP_BIN_FOLDER."/"."interface.".$className.".php";
+ if (file_exists($fileName)) {
+ require_once($fileName);
+ return;
+ }
+ $corePlugClass = glob(AJXP_INSTALL_PATH."/".AJXP_PLUGINS_FOLDER."/core.*/class.".$className.".php", GLOB_NOSORT);
+ if ($corePlugClass !== false && count($corePlugClass)) {
+ require_once($corePlugClass[0]);
+ return;
+ }
+ $corePlugInterface = glob(AJXP_INSTALL_PATH."/".AJXP_PLUGINS_FOLDER."/core.*/interface.".$className.".php", GLOB_NOSORT);
+ if ($corePlugInterface !== false && count($corePlugInterface)) {
+ require_once($corePlugInterface[0]);
+ return;
+ }
+}
+spl_autoload_register('AjaXplorer_autoload');
+
+AJXP_Utils::safeIniSet("session.cookie_httponly", 1);
+
+if (is_file(AJXP_CONF_PATH."/bootstrap_conf.php")) {
+ include(AJXP_CONF_PATH."/bootstrap_conf.php");
+ if (isSet($AJXP_INISET)) {
+ foreach($AJXP_INISET as $key => $value) AJXP_Utils::safeIniSet($key, $value);
+ }
+ if (defined('AJXP_LOCALE')) {
+ setlocale(LC_CTYPE, AJXP_LOCALE);
+ }else if(file_exists(AJXP_DATA_PATH."/plugins/boot.conf/encoding.php")){
+ require_once(AJXP_DATA_PATH."/plugins/boot.conf/encoding.php");
+ if(isSet($ROOT_ENCODING)){
+ setlocale(LC_CTYPE, $ROOT_ENCODING);
+ }
+ }
+}
diff --git a/conf/create.mysql b/conf/create.mysql
index 856c388..988f6a8 100644
--- a/conf/create.mysql
+++ b/conf/create.mysql
@@ -124,9 +124,9 @@ CREATE TABLE `ajxp_plugin_configs` (
LOCK TABLES `ajxp_plugin_configs` WRITE;
/*!40000 ALTER TABLE `ajxp_plugin_configs` DISABLE KEYS */;
INSERT INTO `ajxp_plugin_configs` VALUES
-('authfront.http_basic', 'a:3:{s:19:"AJXP_PLUGIN_ENABLED";b:0;s:5:"ORDER";s:2:"10";s:13:"PROTOCOL_TYPE";s:10:"no_session";}'),
-('authfront.http_server', 'a:5:{s:19:"AJXP_PLUGIN_ENABLED";b:1;s:11:"CREATE_USER";b:0;s:10:"AJXP_ADMIN";s:4:"";s:5:"ORDER";s:1:"1";s:13:"PROTOCOL_TYPE";s:4:"both";}'),
-('authfront.session_login','a:3:{s:19:"AJXP_PLUGIN_ENABLED";b:0;s:5:"ORDER";s:2:"20";s:13:"PROTOCOL_TYPE";s:12:"session_only";}'),
+('authfront.http_basic', 'a:3:{s:19:\"AJXP_PLUGIN_ENABLED\";b:0;s:5:\"ORDER\";s:2:\"10\";s:13:\"PROTOCOL_TYPE\";s:10:\"no_session\";}'),
+('authfront.http_server', 'a:5:{s:19:\"AJXP_PLUGIN_ENABLED\";b:1;s:11:\"CREATE_USER\";b:0;s:10:\"AJXP_ADMIN\";s:0:\"\";s:5:\"ORDER\";s:1:\"1\";s:13:\"PROTOCOL_TYPE\";s:4:\"both\";}'),
+('authfront.session_login','a:3:{s:19:\"AJXP_PLUGIN_ENABLED\";b:0;s:5:\"ORDER\";s:2:\"20\";s:13:\"PROTOCOL_TYPE\";s:12:\"session_only\";}'),
('core.ajaxplorer','a:2:{s:17:\"APPLICATION_TITLE\";s:5:\"Pydio\";s:16:\"DEFAULT_LANGUAGE\";s:2:\"en\";}'),
('core.log','a:1:{s:22:\"UNIQUE_PLUGIN_INSTANCE\";a:3:{s:13:\"instance_name\";s:7:\"log.sql\";s:18:\"group_switch_value\";s:7:\"log.sql\";s:10:\"SQL_DRIVER\";a:2:{s:11:\"core_driver\";s:4:\"core\";s:18:\"group_switch_value\";s:4:\"core\";}}}'),
('core.mq','a:1:{s:18:\"UNIQUE_MS_INSTANCE\";a:3:{s:13:\"instance_name\";s:6:\"mq.sql\";s:18:\"group_switch_value\";s:6:\"mq.sql\";s:10:\"SQL_DRIVER\";a:2:{s:11:\"core_driver\";s:4:\"core\";s:18:\"group_switch_value\";s:4:\"core\";}}}'),
diff --git a/scripts/install b/scripts/install
index df72529..c18ff26 100644
--- a/scripts/install
+++ b/scripts/install
@@ -25,6 +25,7 @@ tar xzf ../upstream/pydio-core.tar.gz -C ../upstream
# Copy files to the right place
final_path=/var/www/pydio
+data_path=/home/yunohost.app/pydio
# Create owncloud user
sudo useradd -d /var/www/pydio pydio
@@ -32,6 +33,8 @@ sudo useradd -d /var/www/pydio pydio
sudo mkdir -p $final_path
sudo cp -ar ../upstream/pydio-core-$version/* $final_path
+sudo mkdir -p $data_path
+
# Database
db_pwd=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]' | sed -n 's/\(.\{24\}\).*/\1/p')
db_user=pydio
@@ -44,16 +47,22 @@ sudo mkdir -p $final_path/data/plugins/boot.conf
sudo cp ../conf/bootstrap.json $final_path/data/plugins/boot.conf/bootstrap.json
sudo yunohost app setting pydio admin -v $admin
+sudo cp ../conf/bootstrap_context.php $final_path/conf
+
sudo touch $final_path/data/cache/admin_counted
sudo touch $final_path/data/cache/first_run_passed
sudo touch $final_path/data/cache/diag_result.php
+sudo mv $final_path/data $data_path
+
# Fix up permissions
-sudo chown -R root:pydio $final_path
+sudo chown -R root: $final_path
sudo find $final_path -type f -exec chmod 644 {} \;
sudo find $final_path -type d -exec chmod 755 {} \;
-sudo find $final_path/data -type f -exec chmod 664 {} \;
-sudo find $final_path/data -type d -exec chmod 775 {} \;
+
+sudo chown -R pydio:pydio $data_path
+sudo find $data_path/data -type f -exec chmod 660 {} \;
+sudo find $data_path/data -type d -exec chmod 770 {} \;
sed -i "s@NAMETOCHANGE@pydio@g" ../conf/php-fpm.conf
finalphpconf=/etc/php5/fpm/pool.d/pydio.conf
diff --git a/scripts/remove b/scripts/remove
index 1744d1d..4c0bd58 100644
--- a/scripts/remove
+++ b/scripts/remove
@@ -1,7 +1,8 @@
#!/bin/bash
-# Removing executable files
sudo rm -rf /var/www/pydio
+sudo rm -rf /home/yunohost.app/pydio
+
domain=$(sudo yunohost app setting pydio domain)
sudo rm -f /etc/nginx/conf.d/$domain.d/pydio.conf
sudo rm -f /etc/php5/fpm/pool.d/pydio.conf
@@ -15,6 +16,5 @@ mysql -u root -p$root_pwd -e "DROP DATABASE $db_name ; DROP USER $db_user@localh
sudo userdel pydio > /dev/null 2>&1
-# Restarting services
sudo service nginx reload
sudo service php5-fpm restart
\ No newline at end of file