* FusionForge Installation Dependency Setup
*
* Copyright 2006 GForge, LLC
- * http://gforge.org/
+ * http://fusionforge.org/
*
* @version
*
* This file is part of GInstaller, it is called by install.sh.
*
- * GForge is free software; you can redistribute it and/or modify
+ * FusionForge is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * GForge is distributed in the hope that it will be useful,
+ * FusionForge 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with GForge; if not, write to the Free Software
+ * along with FusionForge; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US
* Francisco Gimeno
*/
show(" * Creating '$gforge_user' User...");
run("/usr/sbin/useradd -g $gforge_user $gforge_user", true);
+
+ // Let's give some time for PostgreSQL to start
+ sleep(5);
show(" * Creating Database User '$gforge_user'...");
run("su - postgres -c \"createuser -A -R -d -E $gforge_user\"", true);
foreach ($tables as $table) {
run('su - postgres -c "psql '.$gforge_db.' -c \\"GRANT ALL on '.$table.' TO '.$gforge_user.';\\""');
}
+ run("su - postgres -c \"psql $gforge_db -c \\\"UPDATE pg_ts_cfg SET locale='en_US.UTF-8' WHERE ts_name='default'\\\"\"");
// } else {
// show(" * Creating FTS default configuation (Full Text Search)");
// run("su - postgres -c \"psql $gforge_db < $fusionforge_src_dir/db/FTS-20081108.sql\" >> /tmp/gforge-import.log");
//$t = trim(fgets($STDIN));
// run("su - postgres -c \"psql $gforge_db -c \\\"INSERT INTO users (user_name, user_pw, unix_pw) VALUES ('$admin_user', '$pw_md5', '$pw_crypt')\\\"\"");
- run("su - postgres -c \"psql $gforge_db -c \\\"INSERT INTO users (user_name, email, user_pw, unix_pw, status, theme_id) VALUES ('$admin_user', 'root@localhost.localdomain', '$pw_md5', '$pw_crypt', 'A', 1); INSERT INTO user_group (user_id, group_id, admin_flags) VALUES (currval('users_pk_seq'), 1, 'A'); INSERT INTO pfo_user_role (user_id, role_id) VALUES (currval('users_pk_seq'), 3)\\\"\"");
+ if (file_exists ('/tmp/fusionforge-use-pfo-rbac')) { // USE_PFO_RBAC
+ run("su - postgres -c \"psql $gforge_db -c \\\"INSERT INTO users (user_name, realname, firstname, lastname, email, user_pw, unix_pw, status, theme_id) VALUES ('$admin_user', 'Forge Admin', 'Forge', 'Admin', 'root@localhost.localdomain', '$pw_md5', '$pw_crypt', 'A', 1); INSERT INTO user_group (user_id, group_id, admin_flags) VALUES (currval('users_pk_seq'), 1, 'A'); INSERT INTO pfo_user_role (user_id, role_id) VALUES (currval('users_pk_seq'), 3)\\\"\"");
+ } else {
+ run("su - postgres -c \"psql $gforge_db -c \\\"INSERT INTO users (user_name, realname, firstname, lastname, email, user_pw, unix_pw, status, theme_id) VALUES ('$admin_user', 'Forge Admin', 'Forge', 'Admin', 'root@localhost.localdomain', '$pw_md5', '$pw_crypt', 'A', 1); INSERT INTO user_group (user_id, group_id, admin_flags) VALUES (currval('users_pk_seq'), 1, 'A')\\\"\"");
+ }
//echo "BREAKPOINT 2\n";
//$t = trim(fgets($STDIN));
if (!is_dir($fusionforge_etc_dir)) {
mkdir($fusionforge_etc_dir);
}
-
+ if (!is_dir($fusionforge_etc_dir.'/config.ini.d')) {
+ mkdir($fusionforge_etc_dir.'/config.ini.d');
+ }
show(' * Saving database configuration in FForge config file');
- $data = file_get_contents("$fusionforge_etc_dir/local.inc");
- $lines = explode("\n",$data);
- $config = '';
- foreach ($lines as $l) {
- $l = preg_replace("/^.sys_dbname\s*=\s*'(.*)'/", "\$sys_dbname='$gforge_db'", $l);
- $l = preg_replace("/^.sys_dbuser\s*=\s*'(.*)'/", "\$sys_dbuser='$gforge_user'", $l);
- $config .= $l."\n";
+ if (!is_file("$fusionforge_etc_dir/config.ini.d/rpm-install.ini")){
+ if ($fp = fopen("$fusionforge_etc_dir/config.ini.d/rpm-install.ini", "w")) {
+ $config='; This file was generated by the RPM installation system.
+; You can edit the values here or move them to other files.
+[core]
+forge_name=FusionForge
+web_host='.system("hostname -f").'
+';
+ fwrite ($fp, $config);
+ fclose($fp);
+ }
}
-
- if ($fp = fopen("$fusionforge_etc_dir/local.inc", "w")) {
- fwrite ($fp, $config);
- fclose($fp);
+ if (!is_file("$fusionforge_etc_dir/config.ini.d/rpm-install-secrets.ini")){
+ if ($fp = fopen("$fusionforge_etc_dir/config.ini.d/rpm-install-secrets.ini", "w")) {
+ $config='; This file was generated by the RPM installation system.
+; You can edit the values here or move them to other files.
+; These values should not go into world-readable files!
+
+[core]
+database_host=""
+database_name='.$gforge_db.'
+database_user='.$gforge_user.'
+database_port=5432
+; database_password=$pw
+';
+ fwrite ($fp, $config);
+ fclose($fp);
+ }
}
+ #$data = file_get_contents("$fusionforge_etc_dir/local.inc");
+ #$lines = explode("\n",$data);
+ #$config = '';
+ #foreach ($lines as $l) {
+ # $l = preg_replace("/^.sys_dbname\s*=\s*'(.*)'/", "\$sys_dbname='$gforge_db'", $l);
+ # $l = preg_replace("/^.sys_dbuser\s*=\s*'(.*)'/", "\$sys_dbuser='$gforge_user'", $l);
+ # $config .= $l."\n";
+ #}
+
+ #if ($fp = fopen("$fusionforge_etc_dir/local.inc", "w")) {
+ # fwrite ($fp, $config);
+ # fclose($fp);
+ #}
show(' * Saving installation log in /tmp/gforge-import.log');
}