View | Details | Raw Unified | Return to bug 13216
Collapse All | Expand All

(-)a/debian/scripts/koha-shell (-10 / +16 lines)
Lines 22-28 Getopt::Long::Configure("bundling"); Link Here
22
22
23
my %opts;
23
my %opts;
24
my $res = GetOptions( \%opts, "command|c=s", "help|h", "login|l", "shell|s=s",
24
my $res = GetOptions( \%opts, "command|c=s", "help|h", "login|l", "shell|s=s",
25
    "preserve-environment|p|m", "verbose|v" );
25
    "preserve-environment|p|m", "verbose|v", "kohadir|d=s" );
26
26
27
if ( !$res || $opts{help} ) {
27
if ( !$res || $opts{help} ) {
28
    show_help( !$res );
28
    show_help( !$res );
Lines 39-45 if ( !-e "/etc/koha/sites/$instance" ) { Link Here
39
    exit(1);
39
    exit(1);
40
}
40
}
41
my $shell = $opts{shell} || $ENV{SHELL} || '/bin/sh';
41
my $shell = $opts{shell} || $ENV{SHELL} || '/bin/sh';
42
42
my $kohadir;
43
if ( $opts{kohadir} ) {
44
    $kohadir = $opts{kohadir};
45
}
46
else {
47
    $kohadir = '/usr/share/koha/lib';
48
}
43
# Now we're set up, build the 'su' command
49
# Now we're set up, build the 'su' command
44
my @su_args;
50
my @su_args;
45
push @su_args, '/usr/bin/sudo';
51
push @su_args, '/usr/bin/sudo';
Lines 49-55 push @su_args, "-u", "$instance-koha"; Link Here
49
push @su_args,
55
push @su_args,
50
    "env "
56
    "env "
51
  . "KOHA_CONF=/etc/koha/sites/$instance/koha-conf.xml "
57
  . "KOHA_CONF=/etc/koha/sites/$instance/koha-conf.xml "
52
  . "PERL5LIB=/usr/share/koha/lib $shell"
58
  . "PERL5LIB=$kohadir $shell"
53
  . ( $opts{command} ? " -c '$opts{command}'" : '' );
59
  . ( $opts{command} ? " -c '$opts{command}'" : '' );
54
60
55
print "Command: '".join("' '",@su_args)."'\n" if $opts{verbose};
61
print "Command: '".join("' '",@su_args)."'\n" if $opts{verbose};
Lines 76-88 koha-shell -- gives you a shell with your Koha environment set up Link Here
76
Usage: koha-shell [options] [instance name]
82
Usage: koha-shell [options] [instance name]
77
83
78
Options:
84
Options:
79
    -c, --command COMMAND   pass COMMAND to the invoked shell
85
    -c, --command COMMAND           pass COMMAND to the invoked shell
80
    -h, --help              show this help and quit
86
    -h, --help                      show this help and quit
81
    -l, --login             make the shell a login shell
87
    -l, --login                     make the shell a login shell
82
    -m, -p,
88
    -m, -p,
83
    --preserve-environment  do not reset environment variables
89
    --preserve-environment          do not reset environment variables
84
    -s, --shell SHELL       use SHELL instead of the one from your environment
90
    -s, --shell SHELL               use SHELL instead of the one from your environment
85
    -v, --verbose           output the full command that will be executed
91
    -v, --verbose                   output the full command that will be executed
92
    -d, --kohadir /path/to/koha     use a different PERL5LIB directory, for example in a git install.
86
93
87
The default shell is the one currently in use. Refer to su(1) for more detail
94
The default shell is the one currently in use. Refer to su(1) for more detail
88
on these options.
95
on these options.
89
- 

Return to bug 13216