From 3733146198aefce32a8dd955f843ffc6e8070d65 Mon Sep 17 00:00:00 2001 From: Mason James Date: Wed, 24 May 2017 15:40:40 +1200 Subject: [PATCH] Revert "Bug 16733: Adjust other debian scripts using PERL5LIB" This reverts commit f7f06ed850bd74bfb628a01748ff573d6b102827. --- debian/scripts/koha-foreach | 17 ++--------------- debian/scripts/koha-plack | 23 ++++++----------------- debian/scripts/koha-shell | 18 +----------------- debian/scripts/koha-sitemap | 12 ++---------- debian/scripts/koha-start-sip | 23 ++--------------------- debian/scripts/koha-stop-sip | 9 ++++++++- debian/scripts/koha-upgrade-schema | 25 +++++-------------------- debian/templates/plack.psgi | 8 +++++--- 8 files changed, 31 insertions(+), 104 deletions(-) diff --git a/debian/scripts/koha-foreach b/debian/scripts/koha-foreach index 5262cc5218..7a3341d111 100755 --- a/debian/scripts/koha-foreach +++ b/debian/scripts/koha-foreach @@ -15,18 +15,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -set -e - -# Read configuration variable file if it is present -[ -r /etc/default/koha-common ] && . /etc/default/koha-common -# include helper functions -if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then - . "/usr/share/koha/bin/koha-functions.sh" -else - echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2 - exit 1 -fi +set -e listopts="" while [ ! -z "$1" ] @@ -49,14 +39,11 @@ done for name in $(koha-list $listopts) do - # Optionally use alternative paths for a dev install - adjust_paths_dev_install $name - cmd=`echo "$@" | sed -e s/__instancename__/${name}/g` ( exec 3>&1 sudo -u "$name-koha" \ - env PERL5LIB=$PERL5LIB \ + env PERL5LIB=/usr/share/koha/lib \ KOHA_CONF="/etc/koha/sites/$name/koha-conf.xml" \ ${cmd} 2>&1 >&3 | sed -e "s/^/$name: /" >&2 3>&- exec 3>&- diff --git a/debian/scripts/koha-plack b/debian/scripts/koha-plack index 55261056dc..0d49c937f2 100755 --- a/debian/scripts/koha-plack +++ b/debian/scripts/koha-plack @@ -233,22 +233,6 @@ set_action() fi } -adjust_paths() -{ - # Optionally use alternative paths for a dev install - adjust_paths_dev_install $1 - - # PERL5LIB has been read from etc/default, add lib/installer - # export some vars (for plack.psgi) - export KOHA_HOME - if [ "$DEV_INSTALL" = "" ]; then - export PERL5LIB=$PERL5LIB:$KOHA_HOME/lib/installer - else - export DEV_INSTALL - export PERL5LIB=$PERL5LIB:$KOHA_HOME/installer - fi -} - STARMAN=$(which starman) op="" quiet="no" @@ -286,6 +270,12 @@ while [ $# -gt 0 ]; do done +if [ -z $PERL5LIB ]; then + PERL5LIB="/usr/share/koha/lib" +fi + +export PERL5LIB + [ "${quiet}" != "yes" ] && check_env_and_warn if [ $# -gt 0 ]; then @@ -294,7 +284,6 @@ if [ $# -gt 0 ]; then if is_instance $name; then - adjust_paths $name case $op in "start") start_plack $name diff --git a/debian/scripts/koha-shell b/debian/scripts/koha-shell index 0d747da8b0..b8d92f556d 100755 --- a/debian/scripts/koha-shell +++ b/debian/scripts/koha-shell @@ -41,7 +41,6 @@ if ( !-e "/etc/koha/sites/$instance" ) { my $shell = $opts{shell} || $ENV{SHELL} || '/bin/sh'; # Now we're set up, build the 'su' command -my $perl5lib = read_perl5lib( $instance ); my @su_args; push @su_args, '/usr/bin/sudo'; push @su_args, '--preserve-env' if $opts{'preserve-environment'}; @@ -50,7 +49,7 @@ push @su_args, "-u", "$instance-koha"; push @su_args, "env " . "KOHA_CONF=/etc/koha/sites/$instance/koha-conf.xml " - . "PERL5LIB=$perl5lib $shell" + . "PERL5LIB=/usr/share/koha/lib $shell" . ( $opts{command} ? " -c '$opts{command}'" : '' ); print "Command: '".join("' '",@su_args)."'\n" if $opts{verbose}; @@ -71,21 +70,6 @@ sub show_help { print $fh $_ while ; } -sub read_perl5lib { - my ( $instance ) = @_; - - # This simulates what the debian shell scripts do: - # Read /etc/default/koha-common - # Check dev_install in koha-conf.xml - - my $result = `grep "^PERL5LIB=" /etc/default/koha-common`; - chomp $result; - $result =~ s/^PERL5LIB=\s*//; - my $dev_install = `xmlstarlet sel -t -v 'yazgfs/config/dev_install' /etc/koha/sites/$instance/koha-conf.xml`; - chomp $dev_install; - return $dev_install || $result; -} - __DATA__ koha-shell -- gives you a shell with your Koha environment set up diff --git a/debian/scripts/koha-sitemap b/debian/scripts/koha-sitemap index 89b07e5e81..c42ab345a6 100755 --- a/debian/scripts/koha-sitemap +++ b/debian/scripts/koha-sitemap @@ -108,9 +108,9 @@ generate_sitemap() fi if sudo -u "$instance-koha" -H \ - env PERL5LIB=$PERL5LIB \ + env PERL5LIB=/usr/share/koha/lib \ KOHA_CONF="/etc/koha/sites/$instance/koha-conf.xml" \ - $KOHA_BINDIR/cronjobs/sitemap.pl \ + /usr/share/koha/bin/cronjobs/sitemap.pl \ --dir $sitemapdir ; then return 0 else @@ -171,14 +171,6 @@ while [ $# -gt 0 ]; do done -# Optionally use alternative paths for a dev install -adjust_paths_dev_install $1 -if [ "$DEV_INSTALL" = "" ]; then - KOHA_BINDIR=$KOHA_HOME/bin -else - KOHA_BINDIR=$KOHA_HOME/misc -fi - if [ $# -gt 0 ]; then # We have at least one instance name for name in "$@"; do diff --git a/debian/scripts/koha-start-sip b/debian/scripts/koha-start-sip index 7f4f8182bd..98a0ed612b 100755 --- a/debian/scripts/koha-start-sip +++ b/debian/scripts/koha-start-sip @@ -18,17 +18,6 @@ set -e -# Read configuration variable file if it is present -[ -r /etc/default/koha-common ] && . /etc/default/koha-common - -# include helper functions -if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then - . "/usr/share/koha/bin/koha-functions.sh" -else - echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2 - exit 1 -fi - for name in "$@" do if [ ! -e /etc/koha/sites/${name}/koha-conf.xml ] ; @@ -40,17 +29,9 @@ do echo "Starting SIP server for $name" mkdir -p /var/run/koha/${name} chown "${name}-koha:${name}-koha" /var/run/koha/${name} - - adjust_paths_dev_install $name export KOHA_CONF PERL5LIB KOHA_CONF=/etc/koha/sites/${name}/koha-conf.xml - # PERL5LIB has been read already - if [ "$DEV_INSTALL" = "" ]; then - LIBDIR=$KOHA_HOME/lib - else - LIBDIR=$KOHA_HOME - fi - + PERL5LIB="/usr/share/koha/lib" daemon \ --name="$name-koha-sip" \ --errlog="/var/log/koha/$name/sip-error.log" \ @@ -63,6 +44,6 @@ do --user="$name-koha.$name-koha" \ -- \ perl \ - "$LIBDIR/C4/SIP/SIPServer.pm" \ + "/usr/share/koha/lib/C4/SIP/SIPServer.pm" \ "/etc/koha/sites/${name}/SIPconfig.xml" done diff --git a/debian/scripts/koha-stop-sip b/debian/scripts/koha-stop-sip index bfe7cd31c6..b0cbbe9614 100755 --- a/debian/scripts/koha-stop-sip +++ b/debian/scripts/koha-stop-sip @@ -31,6 +31,9 @@ do continue; fi echo "Stopping SIP server for $name" + KOHA_CONF=/etc/koha/sites/${name}/koha-conf.xml + PERL5LIB=/usr/share/koha/lib + export KOHA_CONF PERL5LIB daemon \ --name="$name-koha-sip" \ --errlog="/var/log/koha/$name/sip-error.log" \ @@ -41,5 +44,9 @@ do --delay=30 \ --pidfiles="/var/run/koha/${name}" \ --user="$name-koha.$name-koha" \ - --stop + --stop \ + -- \ + perl \ + "/usr/share/koha/lib/C4/SIP/SIPServer.pm" \ + "/etc/koha/sites/${name}/SIPconfig.xml" done diff --git a/debian/scripts/koha-upgrade-schema b/debian/scripts/koha-upgrade-schema index c1cc6cb989..e641c579b5 100755 --- a/debian/scripts/koha-upgrade-schema +++ b/debian/scripts/koha-upgrade-schema @@ -16,31 +16,16 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -set -e - -# Read configuration variable file if it is present -[ -r /etc/default/koha-common ] && . /etc/default/koha-common -# include helper functions -if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then - . "/usr/share/koha/bin/koha-functions.sh" -else - echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2 - exit 1 -fi +set -e -# Optionally use alternative paths for a dev install -adjust_paths_dev_install $1 -if [ "$DEV_INSTALL" = "" ]; then - CGI_PATH=$KOHA_HOME/intranet/cgi-bin -else - CGI_PATH=$KOHA_HOME -fi +update="/usr/share/koha/intranet/cgi-bin/installer/data/mysql/updatedatabase.pl" for name in "$@" do echo "Upgrading database schema for $name" KOHA_CONF="/etc/koha/sites/$name/koha-conf.xml" \ - PERL5LIB=$PERL5LIB \ - "$CGI_PATH/installer/data/mysql/updatedatabase.pl" + PERL5LIB="/usr/share/koha/lib" \ + "$update" done + diff --git a/debian/templates/plack.psgi b/debian/templates/plack.psgi index a4df05b798..704b91b5a4 100644 --- a/debian/templates/plack.psgi +++ b/debian/templates/plack.psgi @@ -17,6 +17,9 @@ use Modern::Perl; +use lib("/usr/share/koha/lib"); +use lib("/usr/share/koha/lib/installer"); + use Plack::Builder; use Plack::App::CGIBin; use Plack::App::Directory; @@ -49,13 +52,12 @@ use CGI qw(-utf8 ); # we will loose -utf8 under plack, otherwise }; } -my $home = $ENV{KOHA_HOME}; my $intranet = Plack::App::CGIBin->new( - root => $ENV{DEV_INSTALL}? $home: "$home/intranet/cgi-bin" + root => '/usr/share/koha/intranet/cgi-bin' )->to_app; my $opac = Plack::App::CGIBin->new( - root => $ENV{DEV_INSTALL}? "$home/opac": "$home/opac/cgi-bin/opac" + root => '/usr/share/koha/opac/cgi-bin/opac' )->to_app; # my $api = Plack::App::CGIBin->new( -- 2.39.5