Subject: fix directories for debian policy
Description: Fix install directories to match
 Debian Policy
Author: Olivier Sallou <osallou@debian.org>
Last-Updated: 2012-09-25
Forwarded: not-needed
--- a/etc/init.d/gbrowse-slave
+++ b/etc/init.d/gbrowse-slave
@@ -1,10 +1,10 @@
 #!/bin/sh
 ### BEGIN INIT INFO
 # Provides:          gbrowse_slave
-# Required-Start:    $local_fs
-# Required-Stop:     $local_fs
-# Default-Start:     28
-# Default-Stop:      S
+# Required-Start:    $remote_fs $syslog
+# Required-Stop:     $remote_fs $syslog
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
 # Short-Description: Start/Stop the gbrowse_slave rendering server.
 ### END INIT INFO
 
@@ -13,7 +13,7 @@
 NAME="gbrowse-slave"
 DESC="GBrowse slave track rendering server"
 
-test -x $DAEMON || exit 0
+#test -x $DAEMON || exit 0
 set -e
 
 USER=$WWWUSER
--- a/etc/default/gbrowse-slave
+++ b/etc/default/gbrowse-slave
@@ -1,10 +1,9 @@
-#!/bin/sh
 
 export PERL5LIB=$PERL5LIB
 
-DAEMON=$INSTALLSCRIPT/gbrowse_slave
-USER=$WWWUSER
-PRELOAD=$CONF/slave_preload.conf
+DAEMON=/usr/bin/gbrowse_slave
+USER=www-data
+PRELOAD=/etc/gbrowse/slave_preload.conf
 RUNDIR=/var/run/gbrowse
 LOGDIR=/var/log/gbrowse
 PREFORK=3
--- a/bin/gbrowse_metadb_config.pl
+++ b/bin/gbrowse_metadb_config.pl
@@ -21,7 +21,10 @@
 my @argv = @ARGV;
 
 my ($dsn, $admin);
+my $new=0;
+
 GetOptions('dsn=s'         => \$dsn,
+           'new'           => \$new,
            'admin=s'       => \$admin) or die <<EOF;
 Usage: $0 [options] <optional path to GBrowse.conf>
 
@@ -169,10 +172,12 @@
 check_table("uploads",          $uploads_columns);
 check_table("sharing",          $sharing_columns);
 
+if($new==0) {
 check_sessions();
 check_uploads_ids();
 check_all_files();
 check_data_sources();
+}
 fix_session_permissions();
 fix_sqlite_permissions() if $type =~ /sqlite/i;
 
--- a/htdocs/index.html
+++ b/htdocs/index.html
@@ -24,7 +24,7 @@
   <dd><a href="example_scripts">/var/www/gbrowse2/example_scripts</a></dd>
 </dl>
 
-<h2>Example Databases</h2>
+<h2>Example Databases (requires gbrowse-data package)</h2>
 
 <p>
 
@@ -32,9 +32,9 @@
 installed for you.  Try them at these URL:
 
 <ul>
-<li><a href="/cgi-bin/gb2/gbrowse/yeast">http://your.host/cgi-bin/gb2/gbrowse/yeast</a> (simple example)</li>
-<li><a href="/cgi-bin/gb2/gbrowse/yeast_advanced">http://your.host/cgi-bin/gb2/gbrowse/yeast_advanced</a> (advanced example)</li>
-<li><a href="/cgi-bin/gb2/gbrowse/yeast_renderfarm">http://your.host/cgi-bin/gb2/gbrowse/yeast_renderfarm</a> (yeast_renderfarm example)</li>
+<li><a href="/cgi-bin/gbrowse/gbrowse/yeast">http://your.host/cgi-bin/gbrowse/gbrowse/yeast</a> (simple example)</li>
+<li><a href="/cgi-bin/gbrowse/gbrowse/yeast_advanced">http://your.host/cgi-bin/gbrowse/gbrowse/yeast_advanced</a> (advanced example)</li>
+<li><a href="/cgi-bin/gbrowse/gbrowse/yeast_renderfarm">http://your.host/cgi-bin/gbrowse/gbrowse/yeast_renderfarm</a> (yeast_renderfarm example)</li>
 </ul>
 
 <p>
@@ -56,13 +56,13 @@
 <li><a href="/gb2/gbrowse/yeast">http://your.host/gb2/gbrowse/yeast</a></li>
 <li><a href="/gb2/gbrowse/yeast_advanced">http://your.host/gb2/gbrowse/yeast_advanced</a></li>
 <li><a href="/gb2/gbrowse/yeast_renderfarm">http://your.host/gb2/gbrowse/yeast_renderfarm</a></li>
-<li><a href="/gb2/gbrowse/pop_demo">http://your.host/gb2/gbrowse/pop_demo</a> (demo of embedded population allele frequency maps -- requires Template module to be installed)</li>
 </ul>
 
 <h3>Accelerated Demos</h3>
 
-If you have FastCGI and/or ModPerl installed, you will have access to
-an accelerated version of gbrowse at these URLs:
+By default, FastCGI and ModPerl are not set by gbrowse installation,
+However, if you have FastCGI and/or ModPerl installed, you will have access to
+ accelerated versions of gbrowse a these URLs:
 
 <ul>
   <li>FastCGI
--- a/install_util/GBrowseInstall.pm
+++ b/install_util/GBrowseInstall.pm
@@ -33,6 +33,7 @@
 		wwwuser       => 'User account under which Apache daemon runs?',
 		installconf   => 'Automatically update Apache config files to run GBrowse?',
 		installetc    => 'Automatically update system config files to run gbrowse-slave?',
+		registration_done	=> 'Set to 1 to skip registration.',
     );
 my %OK_PROPS = @OK_PROPS;
 
@@ -422,6 +423,82 @@
 END
 }
 
+sub ACTION_debianinstall {
+    my $self = shift;
+    my $prefix = $self->install_base || $self->prefix || 'debian/libgbrowse-perl';
+    GBrowseGuessDirectories->prefix($prefix);
+
+    $self->depends_on('config_data');
+
+    $self->install_path->{conf}
+        ||= $self->config_data('conf') || GBrowseGuessDirectories->conf;
+    $self->install_path->{htdocs}
+        ||= $self->config_data('htdocs')
+            || GBrowseGuessDirectories->htdocs;
+    $self->install_path->{'cgi-bin'}
+        ||= $self->config_data('cgibin')
+            || GBrowseGuessDirectories->cgibin;
+    $self->install_path->{'etc'}
+        ||= GBrowseGuessDirectories->etc;
+    $self->install_path->{'databases'}
+        ||= $self->config_data('databases')
+            || GBrowseGuessDirectories->databases;
+
+
+    $self->install_path->{conf} = $prefix.$self->install_path->{conf};
+    $self->install_path->{htdocs} = $prefix.$self->install_path->{htdocs};
+    $self->install_path->{'cgi-bin'} = $prefix.$self->install_path->{'cgi-bin'};
+    $self->install_path->{'etc'} = $prefix.$self->install_path->{'etc'};
+    $self->install_path->{'databases'} = $prefix.$self->install_path->{'databases'};
+    $self->SUPER::ACTION_install();
+
+    my $user = $self->config_data('wwwuser') || GBrowseGuessDirectories->wwwuser;
+
+    # fix some directories so that www user can write into them
+    my $tmp = $self->config_data('tmp') || GBrowseGuessDirectories->tmp;
+    $tmp = $prefix.$tmp;
+    mkpath($tmp);
+    my ($uid,$gid) = (getpwnam($user))[2,3];
+
+    # taint check issues
+    $uid =~ /^(\d+)$/;
+    $uid = $1;
+    $gid =~ /^(\d+)$/;
+    $gid = $1;
+
+    my $htdocs_i = File::Spec->catfile($self->install_path->{htdocs},'i');
+    my $images   = File::Spec->catfile($tmp,'images');
+    my $htdocs = $self->install_path->{htdocs};
+    {
+        local $> = $uid;
+        symlink($images,$htdocs_i);  # so symlinkifowner match works!
+    }
+
+    my $databases = $self->install_path->{'databases'};
+
+    #chmod 0755,File::Spec->catfile($self->install_path->{'etc'},'init.d','gbrowse-slave');
+    #$self->fix_selinux;
+
+    my $base = basename($self->install_path->{htdocs});
+
+    # Configure the databases, if needed.
+    #print STDERR "Updating user account database...\n";
+    #my $metadb_script = File::Spec->catfile("bin", "gbrowse_metadb_config.pl");
+    #my $perl          = $self->perl;
+    #my @inc           = map{"-I$_"} split ':',$self->added_to_INC;
+    #system $perl,@inc,$metadb_script,"--dsn=DBI:SQLite:debian/gbrowse/var/lib/gbrowse/users.sqlite";
+
+}
+
+sub ACTION_debianinstall_slave {
+    my $self = shift;
+    my $prefix = $self->install_base || $self->prefix ||'';
+    GBrowseGuessDirectories->prefix($prefix);
+    $self->install_path->{'etc'} = $prefix.$self->install_path->{'etc'};
+    $self->SUPER::ACTION_install();
+}
+
+
 sub ACTION_install {
     my $self = shift;
     my $prefix = $self->install_base || $self->prefix || '';
@@ -773,8 +850,9 @@
 sub guess_user_account_db {
     my $self = shift;
     if (eval "require DBD::SQLite; 1") {
-	my $databases = $self->config_data('databases');
-	return "DBI:SQLite:$databases/users.sqlite";
+	#my $databases = $self->config_data('databases');
+	#return "DBI:SQLite:$databases/users.sqlite";
+	return "DBI:SQLite:/var/lib/gbrowse/users.sqlite";
     } elsif (eval "require DBD::mysql; 1") {
 	return 'DBI:mysql:gbrowse_login;user=gbrowse;password=gbrowse';
     } else {
--- a/conf/GBrowse.conf
+++ b/conf/GBrowse.conf
@@ -161,9 +161,9 @@
 # "user_accounts" is true, then GBrowse
 # will attempt to use its internal user accounts database
 # to authenticate and/or register users.
-user_accounts               = 1
-user_accounts_registration  = 1
-user_accounts_openid        = 1
+user_accounts               = 0
+user_accounts_registration  = 0
+user_accounts_openid        = 0
 
 # Path to the database -- you will need to create this database and grant all
 # privileges on it to the indicated user.
