[Owncloud] owncloud autosetup

Thomas Schmidt tschmidt at suse.de
Tue Oct 4 09:02:09 UTC 2011


Hi, I wrote a patch to enable an autosetup of owncloud:


diff --git a/index.php b/index.php
index 2ac3f6d..e72b427 100644
--- a/index.php
+++ b/index.php
@@ -27,8 +27,16 @@ require_once('lib/base.php');

 // Setup required :
 $not_installed = !OC_Config::getValue('installed', false);
-$install_called = (isset($_POST['install']) AND $_POST['install']=='true');
 if($not_installed) {
+       // Check for autosetup:
+       $autosetup_file = OC::$SERVERROOT."/config/autoconfig.php";
+       if( file_exists( $autosetup_file )){
+               error_log("Autoconfig file found, setting up owncloud...");
+               include( $autosetup_file );
+               $_POST['install'] = 'true';
+               $_POST = array_merge ($_POST, $AUTOCONFIG);
+               unlink($autosetup_file);
+       }
        OC_Util::addScript('setup');
        require_once('setup.php');
        exit();


That will be useful when installing owncloud 'headless', for example by using the
new owncloud-admin script, or just copying the files over by ftp and using it without opening a browser.

It expects an autoconfig.php in the config directory which gets removed after setup.
A minimal example file looks like this:

<?php
$AUTOCONFIG = array(
    "dbtype" => 'sqlite',
    "directory" => "/space/workspace/owncloud/data",
    "adminlogin" => "tom",
    "adminpass" => "tom"
);
?>


What do you think, should I commit this to the master branch, so it's included in the release?

Greetings

-- 
Thomas Schmidt (tschmidt [at] suse.de)
SUSE Linux Products GmbH :: Research & Development :: Tools
"Don't Panic", Douglas Adams (11.03.1952 - 11.05.2001)



More information about the Owncloud mailing list