aboutsummaryrefslogtreecommitdiff
blob: 655158c04a8b8e6931a645b78f513f5eba37f72e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
--- install_util/GBrowseInstall.pm.ori	2011-07-30 16:06:18.000000000 +0200
+++ install_util/GBrowseInstall.pm	2011-07-30 16:06:28.000000000 +0200
@@ -419,6 +419,7 @@
 sub ACTION_install {
     my $self = shift;
     my $prefix = $self->install_base || $self->prefix || '';
+    my $destdir = $self->destdir || '';
     GBrowseGuessDirectories->prefix($prefix);
 
     $self->depends_on('config_data');
@@ -445,7 +446,7 @@
 
     # fix some directories so that www user can write into them
     my $tmp = $self->config_data('tmp') || GBrowseGuessDirectories->tmp;
-    mkpath($tmp);
+    mkpath($destdir.$tmp);
     my ($uid,$gid) = (getpwnam($user))[2,3];
 
     # taint check issues
@@ -454,29 +455,29 @@
     $gid =~ /^(\d+)$/;
     $gid = $1;
     
-    unless (chown $uid,$gid,$tmp) {
+    unless (chown $uid,$gid,$destdir.$tmp) {
 	$self->ownership_warning($tmp,$user);
     }
 
     my $htdocs_i = File::Spec->catfile($self->install_path->{htdocs},'i');
     my $images   = File::Spec->catfile($tmp,'images');
     my $htdocs = $self->install_path->{htdocs};
-    chown $uid,-1,$htdocs;
+    chown $uid,-1,$destdir.$htdocs;
     {
 	local $> = $uid;
 	symlink($images,$htdocs_i);  # so symlinkifowner match works!
     }
-    chown $>,-1,$self->install_path->{htdocs};
+    chown $>,-1,$destdir.$self->install_path->{htdocs};
 
     my $persistent = $self->install_path->{'persistent'};
     my $sessions   = File::Spec->catfile($persistent,'sessions');
     my $userdata   = File::Spec->catfile($persistent,'userdata');
-    mkpath([$sessions,$userdata],0711);
+    mkpath([$destdir.$sessions,$destdir.$userdata],0711);
 
     my $databases = $self->install_path->{'databases'};
     
-    unless (chown $uid,$gid,glob(File::Spec->catfile($databases,'').'*')) {
-	$self->ownership_warning($databases,$user);
+    unless (chown $uid,$gid,glob($destdir.File::Spec->catfile($databases,'').'*')) {
+	$self->ownership_warning($destdir.$databases,$user);
     }
 
     # chmod 0755,File::Spec->catfile($self->install_path->{'etc'},'init.d','gbrowse-slave');
@@ -490,7 +491,7 @@
     my $perl          = $self->perl;
     my @inc           = map{"-I$_"} split ':',$self->added_to_INC;
     system $perl,@inc,$metadb_script;
-    system 'sudo','chown','-R',"$uid.$gid",$sessions,$userdata;
+    system 'sudo','chown','-R',"$uid.$gid",$destdir.$sessions,$destdir.$userdata;
 
 #    if (Module::Build->y_n(
 #	    "It is recommended that you restart Apache. Shall I try this for you?",'y'
@@ -600,6 +601,7 @@
     my $self = shift;
 
     my $prefix = $self->install_base || $self->prefix || '';
+    my $destdir = $self->destdir || '';
     GBrowseGuessDirectories->prefix($prefix);
     my $install_path = GBrowseGuessDirectories->etc;
 
@@ -647,7 +649,7 @@
 	if ($self->config_data('installconf') =~ /^[yY]/ && !-e "${includes}/$file") {
 	    warn "Creating include file for Apache config: $target\n";
 	    my $dir = dirname($target);
-	    mkpath([$dir]);
+	    mkpath([$destdir.$dir]);
 	    if (my $f = IO::File->new("blib${includes}/$file",'>')) {
 		$f->print($self->apache_conf);
 		$f->close;
@@ -935,8 +937,9 @@
 sub ownership_warning {
     my $self = shift;
     my ($path,$owner) = @_;
+    my $destdir = $self->destdir || '';
     warn "*** WARNING: Using sudo to change ownership of $path to '$owner'. You may be prompted for your login password ***\n";
-    system "sudo chown -R $owner $path";
+    system "sudo chown -R $owner $destdir.$path";
 }
 
 sub cgiurl {