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", "kohadir|d=s" ); |
25 |
"preserve-environment|p|m", "verbose|v", "kohadir|d=s", "gitify|g" ); |
26 |
|
26 |
|
27 |
if ( !$res || $opts{help} ) { |
27 |
if ( !$res || $opts{help} ) { |
28 |
show_help( !$res ); |
28 |
show_help( !$res ); |
Lines 46-61
if ( $opts{kohadir} ) {
Link Here
|
46 |
else { |
46 |
else { |
47 |
$kohadir = '/usr/share/koha/lib'; |
47 |
$kohadir = '/usr/share/koha/lib'; |
48 |
} |
48 |
} |
|
|
49 |
|
49 |
# Now we're set up, build the 'su' command |
50 |
# Now we're set up, build the 'su' command |
50 |
my @su_args; |
51 |
my @su_args; |
51 |
push @su_args, '/usr/bin/sudo'; |
52 |
push @su_args, '/usr/bin/sudo'; |
52 |
push @su_args, '--preserve-env' if $opts{'preserve-environment'}; |
53 |
push @su_args, '--preserve-env' if $opts{'preserve-environment'}; |
53 |
push @su_args, '--login' if $opts{login}; |
54 |
push @su_args, '--login' if $opts{login}; |
54 |
push @su_args, "-u", "$instance-koha"; |
55 |
push @su_args, "-u", "$instance-koha"; |
|
|
56 |
push @su_args, "env "; |
57 |
push @su_args, "PATH=$kohadir/debian/scripts".':$PATH KOHA_GITIFY=1 ' if $opts{gitify}; |
55 |
push @su_args, |
58 |
push @su_args, |
56 |
"env " |
59 |
"KOHA_CONF=/etc/koha/sites/$instance/koha-conf.xml " |
57 |
. "KOHA_CONF=/etc/koha/sites/$instance/koha-conf.xml " |
60 |
. "PERL5LIB=$kohadir $shell " |
58 |
. "PERL5LIB=$kohadir $shell" |
|
|
59 |
. ( $opts{command} ? " -c '$opts{command}'" : '' ); |
61 |
. ( $opts{command} ? " -c '$opts{command}'" : '' ); |
60 |
|
62 |
|
61 |
print "Command: '".join("' '",@su_args)."'\n" if $opts{verbose}; |
63 |
print "Command: '".join("' '",@su_args)."'\n" if $opts{verbose}; |
Lines 90-95
Options:
Link Here
|
90 |
-s, --shell SHELL use SHELL instead of the one from your environment |
92 |
-s, --shell SHELL use SHELL instead of the one from your environment |
91 |
-v, --verbose output the full command that will be executed |
93 |
-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. |
94 |
-d, --kohadir /path/to/koha use a different PERL5LIB directory, for example in a git install. |
|
|
95 |
-g, --gitify use koha-shell for a git type install, with -d option |
93 |
|
96 |
|
94 |
The default shell is the one currently in use. Refer to su(1) for more detail |
97 |
The default shell is the one currently in use. Refer to su(1) for more detail |
95 |
on these options. |
98 |
on these options. |
96 |
- |
|
|