Lines 41-46
if ( !-e "/etc/koha/sites/$instance" ) {
Link Here
|
41 |
my $shell = $opts{shell} || $ENV{SHELL} || '/bin/sh'; |
41 |
my $shell = $opts{shell} || $ENV{SHELL} || '/bin/sh'; |
42 |
|
42 |
|
43 |
# Now we're set up, build the 'su' command |
43 |
# Now we're set up, build the 'su' command |
|
|
44 |
my $perl5lib = read_perl5lib( $instance ); |
44 |
my @su_args; |
45 |
my @su_args; |
45 |
push @su_args, '/usr/bin/sudo'; |
46 |
push @su_args, '/usr/bin/sudo'; |
46 |
push @su_args, '--preserve-env' if $opts{'preserve-environment'}; |
47 |
push @su_args, '--preserve-env' if $opts{'preserve-environment'}; |
Lines 49-55
push @su_args, "-u", "$instance-koha";
Link Here
|
49 |
push @su_args, |
50 |
push @su_args, |
50 |
"env " |
51 |
"env " |
51 |
. "KOHA_CONF=/etc/koha/sites/$instance/koha-conf.xml " |
52 |
. "KOHA_CONF=/etc/koha/sites/$instance/koha-conf.xml " |
52 |
. "PERL5LIB=/usr/share/koha/lib $shell" |
53 |
. "PERL5LIB=$perl5lib $shell" |
53 |
. ( $opts{command} ? " -c '$opts{command}'" : '' ); |
54 |
. ( $opts{command} ? " -c '$opts{command}'" : '' ); |
54 |
|
55 |
|
55 |
print "Command: '".join("' '",@su_args)."'\n" if $opts{verbose}; |
56 |
print "Command: '".join("' '",@su_args)."'\n" if $opts{verbose}; |
Lines 70-75
sub show_help {
Link Here
|
70 |
print $fh $_ while <DATA>; |
71 |
print $fh $_ while <DATA>; |
71 |
} |
72 |
} |
72 |
|
73 |
|
|
|
74 |
sub read_perl5lib { |
75 |
my ( $instance ) = @_; |
76 |
|
77 |
# This simulates what the debian shell scripts do: |
78 |
# Read /etc/default/koha-common |
79 |
# Check dev_install in koha-conf.xml |
80 |
|
81 |
my $result = `grep "^PERL5LIB=" /etc/default/koha-common`; |
82 |
chomp $result; |
83 |
$result =~ s/^PERL5LIB=\s*//; |
84 |
my $dev_install = `xmlstarlet sel -t -v 'yazgfs/config/dev_install' /etc/koha/sites/$instance/koha-conf.xml`; |
85 |
chomp $dev_install; |
86 |
return $dev_install || $result; |
87 |
} |
88 |
|
73 |
__DATA__ |
89 |
__DATA__ |
74 |
koha-shell -- gives you a shell with your Koha environment set up |
90 |
koha-shell -- gives you a shell with your Koha environment set up |
75 |
|
91 |
|