From 7c0081f468db6df70c5bf8b5dbdb816b5a18ba76 Mon Sep 17 00:00:00 2001 From: Liz Rea Date: Fri, 16 Oct 2015 15:13:44 +1300 Subject: [PATCH] Bug 13216 - fix koha shell to accept alternative perl5lib paths To test: gitify an install run sudo koha-shell instance run env | grep PERL5LIB it should be set to /usr/share/koha/lib run sudo koha-shell -d /path/to/your/git/install run env | grep PERL5LIB it should be set to /path/to/your/git/install Signed-off-by: Mirko Tietgen --- debian/scripts/koha-shell | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/debian/scripts/koha-shell b/debian/scripts/koha-shell index b8d92f5..26fa411 100755 --- a/debian/scripts/koha-shell +++ b/debian/scripts/koha-shell @@ -22,7 +22,7 @@ Getopt::Long::Configure("bundling"); my %opts; my $res = GetOptions( \%opts, "command|c=s", "help|h", "login|l", "shell|s=s", - "preserve-environment|p|m", "verbose|v" ); + "preserve-environment|p|m", "verbose|v", "kohadir|d=s" ); if ( !$res || $opts{help} ) { show_help( !$res ); @@ -39,7 +39,13 @@ if ( !-e "/etc/koha/sites/$instance" ) { exit(1); } my $shell = $opts{shell} || $ENV{SHELL} || '/bin/sh'; - +my $kohadir; +if ( $opts{kohadir} ) { + $kohadir = $opts{kohadir}; +} +else { + $kohadir = '/usr/share/koha/lib'; +} # Now we're set up, build the 'su' command my @su_args; push @su_args, '/usr/bin/sudo'; @@ -49,7 +55,7 @@ push @su_args, "-u", "$instance-koha"; push @su_args, "env " . "KOHA_CONF=/etc/koha/sites/$instance/koha-conf.xml " - . "PERL5LIB=/usr/share/koha/lib $shell" + . "PERL5LIB=$kohadir $shell" . ( $opts{command} ? " -c '$opts{command}'" : '' ); print "Command: '".join("' '",@su_args)."'\n" if $opts{verbose}; @@ -76,13 +82,14 @@ koha-shell -- gives you a shell with your Koha environment set up Usage: koha-shell [options] [instance name] Options: - -c, --command COMMAND pass COMMAND to the invoked shell - -h, --help show this help and quit - -l, --login make the shell a login shell + -c, --command COMMAND pass COMMAND to the invoked shell + -h, --help show this help and quit + -l, --login make the shell a login shell -m, -p, - --preserve-environment do not reset environment variables - -s, --shell SHELL use SHELL instead of the one from your environment - -v, --verbose output the full command that will be executed + --preserve-environment do not reset environment variables + -s, --shell SHELL use SHELL instead of the one from your environment + -v, --verbose output the full command that will be executed + -d, --kohadir /path/to/koha use a different PERL5LIB directory, for example in a git install. The default shell is the one currently in use. Refer to su(1) for more detail on these options. -- 2.1.4