GBrowse

 view release on metacpan or  search on metacpan

bin/gbrowse_metadb_config.pl  view on Meta::CPAN

              'user:pass') to skip the prompts if the database does not
              exist.

Currently mysql and SQLite databases are supported. When creating a
mysql database you must provide the -admin option to specify a user
and password that has database create privileges on the server.
EOF
    ;

my $www_user       = GBrowse::ConfigData->config('wwwuser');
my ($current_user) = getpwuid($<);

unless ($www_user eq $current_user or $< == 0) {
    print STDERR <<END;
For user account installation to work properly, this script must be able to
create directories owned by the Apache server account ($www_user).
This script will now invoke sudo to become the 'root' user temporarily.
You may be prompted for your login password now.
END
;
    exec 'sudo','-u','root',$0,@argv;

bin/gbrowse_metadb_config.pl  view on Meta::CPAN

    my $dir = dirname($path);
    unless (-e $dir) {
	my $parent = dirname($dir);
	if (-w $parent) {
	    mkdir $parent;
	} else {
	    print STDERR "Using sudo to create $parent directory. You may be prompted for your login password now.\n";
	    system "sudo mkdir $parent";
	}
    }
    my $file_owner = -e $path ? getpwuid((stat($path))[4]) : '';
    my $dir_owner  = -e $dir  ? getpwuid((stat($dir))[4])  : '';

    # Check if we need to, to avoid unnecessary printing/sudos.
    unless ($group) {
	print STDERR "Unable to look up group for $user. Will not change ownerships on $path.\n";
	print STDERR "You should do this manually to give the Apache web server read/write access to $path.\n";
	return;
    }

    if (-e $path && $user ne $file_owner) {
	print STDERR "Using sudo to set $path ownership to $user:$group. You may be prompted for your login password now.\n";

bin/gbrowse_metadb_config.pl  view on Meta::CPAN


  if (!defined($ans) || !length($ans)) {
      print STDERR "$default\n";
      $ans = $default;
  }
  return $ans;
}

sub get_group_from_user {
    my $user = shift;
    my (undef,undef,undef,$gid) = $user =~ /^\d+$/ ? getpwuid($user) 
                                                   : getpwnam($user);
    $gid or return;
    my $group = getgrgid($gid);
    return $group;
}

sub upgrade_schema {
    my $new_version   = shift;

    # probe whether this is a completely empty database

bin/scan_gbrowse.pl  view on Meta::CPAN


Options:
       --cache <cachetime>  Cache the results in a temporary file 
                            for cachetime seconds.
USAGE
    ;

GetOptions('cache=i' => \$cache_time) or die $USAGE;
my $url = shift                       or die $USAGE;

my $tmpdir = File::Spec->catfile(File::Spec->tmpdir,'gbrowse_scanner'.'_'.(getpwuid($<))[0]);
unless (-e $tmpdir && -d _) {
    mkdir $tmpdir or die "Couldn't create $tmpdir: $!";
}
(my $fname = $url) =~ s!/!_!g;
my $cache_file = File::Spec->catfile($tmpdir,"$fname.cache");
my $dest_file  = File::Spec->catfile($tmpdir,"$fname.dest");
build_cache($url,$dest_file,$cache_file)
    unless -e $cache_file && ((-M $cache_file) * SECS_PER_DAY)<$cache_time;

open my $fh,'<',$cache_file or die "Couldn't open cache file $cache_file: $!";

install_util/GBrowseGuessDirectories.pm  view on Meta::CPAN

	return $port if $h;
    }
}

sub wwwuser {
    my $self = shift;
    for (qw(www-data www httpd apache apache2 System nobody )) {
	return $_ if getpwnam($_);
    }
    # fallback -- user current real user
    return (getpwuid($<))[0];
}

sub installconf {
    my $self = shift;
    return   'y';
}

sub installetc {
    my $self = shift;
    return   'y';

install_util/gbrowse_ppm_install.pl  view on Meta::CPAN

}

sub interpolate {
  my $path = shift;
  my ($to_expand,$homedir);
  return $path unless $path =~ m!^~([^/]*)!;
  eval {
    if ($to_expand = $1) {
      $homedir = (getpwnam($to_expand))[7];
    } else {
      $homedir = (getpwuid($<))[7];
    }
    return $path unless $homedir;
    $path =~ s!^~[^/]*!$homedir!;
  };
  return $path;
}

# horrible -- fix line endings for proper architecture
sub fixup {
  my $file = shift;

lib/Bio/Graphics/Browser2/Render/HTML.pm  view on Meta::CPAN

    my $self   = shift;
    my $source = $self->data_source;

    return $CAN_PDF if defined $CAN_PDF;
    return $CAN_PDF = $source->global_setting('generate pdf') 
	if defined $source->global_setting('generate pdf');

    return $CAN_PDF=1 if `which svg2pdf`;
    return $CAN_PDF=0 unless `which inkscape`;
    # see whether we have the needed .inkscape and .gnome2 directories
    my $home = (getpwuid($<))[7];
    my $user = (getpwuid($<))[0];
    my $inkscape_dir = File::Spec->catfile($home,'.config','inkscape');
    my $gnome2_dir   = File::Spec->catfile($home,'.gnome2');
    if (-e $inkscape_dir && -w $inkscape_dir
	&&  -e $gnome2_dir   && -w $gnome2_dir) {
	return $CAN_PDF=1;
    } else {
	print STDERR
	    join(' ',
		 qq(GBROWSE NOTICE: To enable PDF generation, please enter the directory "$home"),
		 qq(and run the commands:),



( run in 0.281 second using v1.01-cache-2.11-cpan-8d75d55dd25 )