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

(-)a/debian/scripts/koha-foreach (-2 / +15 lines)
Lines 15-23 Link Here
15
# You should have received a copy of the GNU General Public License
15
# You should have received a copy of the GNU General Public License
16
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
17
18
19
set -e
18
set -e
20
19
20
# Read configuration variable file if it is present
21
[ -r /etc/default/koha-common ] && . /etc/default/koha-common
22
23
# include helper functions
24
if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then
25
    . "/usr/share/koha/bin/koha-functions.sh"
26
else
27
    echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2
28
    exit 1
29
fi
30
21
listopts=""
31
listopts=""
22
while [ ! -z "$1" ]
32
while [ ! -z "$1" ]
23
do
33
do
Lines 39-49 done Link Here
39
            
49
            
40
for name in $(koha-list $listopts)
50
for name in $(koha-list $listopts)
41
do
51
do
52
    # Optionally use alternative paths for a dev install
53
    adjust_paths_dev_install $name
54
42
    cmd=`echo "$@" | sed -e s/__instancename__/${name}/g`
55
    cmd=`echo "$@" | sed -e s/__instancename__/${name}/g`
43
    (
56
    (
44
    exec 3>&1
57
    exec 3>&1
45
    sudo -u "$name-koha" \
58
    sudo -u "$name-koha" \
46
    env PERL5LIB=/usr/share/koha/lib \
59
    env PERL5LIB=$PERL5LIB \
47
        KOHA_CONF="/etc/koha/sites/$name/koha-conf.xml" \
60
        KOHA_CONF="/etc/koha/sites/$name/koha-conf.xml" \
48
        ${cmd} 2>&1 >&3 | sed -e "s/^/$name: /" >&2 3>&-
61
        ${cmd} 2>&1 >&3 | sed -e "s/^/$name: /" >&2 3>&-
49
    exec 3>&-
62
    exec 3>&-
(-)a/debian/scripts/koha-plack (-6 / +17 lines)
Lines 213-218 set_action() Link Here
213
    fi
213
    fi
214
}
214
}
215
215
216
adjust_paths()
217
{
218
    # Optionally use alternative paths for a dev install
219
    adjust_paths_dev_install $1
220
221
    # PERL5LIB has been read from etc/default, add lib/installer
222
    # export some vars (for plack.psgi)
223
    export KOHA_HOME
224
    if [ "$DEV_INSTALL" = "" ]; then
225
        export PERL5LIB=$PERL5LIB:$KOHA_HOME/lib/installer
226
    else
227
        export DEV_INSTALL
228
        export PERL5LIB=$PERL5LIB:$KOHA_HOME/installer
229
    fi
230
}
231
216
STARMAN=$(which starman)
232
STARMAN=$(which starman)
217
op=""
233
op=""
218
quiet="no"
234
quiet="no"
Lines 250-261 while [ $# -gt 0 ]; do Link Here
250
266
251
done
267
done
252
268
253
if [ -z $PERL5LIB ]; then
254
    PERL5LIB="/usr/share/koha/lib"
255
fi
256
257
export PERL5LIB
258
259
[ "${quiet}" != "yes" ] && check_env_and_warn
269
[ "${quiet}" != "yes" ] && check_env_and_warn
260
270
261
if [ $# -gt 0 ]; then
271
if [ $# -gt 0 ]; then
Lines 264-269 if [ $# -gt 0 ]; then Link Here
264
274
265
        if is_instance $name; then
275
        if is_instance $name; then
266
276
277
            adjust_paths $name
267
            case $op in
278
            case $op in
268
                "start")
279
                "start")
269
                    start_plack $name
280
                    start_plack $name
(-)a/debian/scripts/koha-shell (-1 / +17 lines)
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
(-)a/debian/scripts/koha-sitemap (-2 / +10 lines)
Lines 108-116 generate_sitemap() Link Here
108
        fi
108
        fi
109
109
110
        if sudo -u "$instance-koha" -H \
110
        if sudo -u "$instance-koha" -H \
111
            env PERL5LIB=/usr/share/koha/lib \
111
            env PERL5LIB=$PERL5LIB \
112
            KOHA_CONF="/etc/koha/sites/$instance/koha-conf.xml" \
112
            KOHA_CONF="/etc/koha/sites/$instance/koha-conf.xml" \
113
            /usr/share/koha/bin/cronjobs/sitemap.pl \
113
            $KOHA_BINDIR/cronjobs/sitemap.pl \
114
                --dir $sitemapdir ; then
114
                --dir $sitemapdir ; then
115
            return 0
115
            return 0
116
        else
116
        else
Lines 171-176 while [ $# -gt 0 ]; do Link Here
171
171
172
done
172
done
173
173
174
# Optionally use alternative paths for a dev install
175
adjust_paths_dev_install $1
176
if [ "$DEV_INSTALL" = "" ]; then
177
    KOHA_BINDIR=$KOHA_HOME/bin
178
else
179
    KOHA_BINDIR=$KOHA_HOME/misc
180
fi
181
174
if [ $# -gt 0 ]; then
182
if [ $# -gt 0 ]; then
175
    # We have at least one instance name
183
    # We have at least one instance name
176
    for name in "$@"; do
184
    for name in "$@"; do
(-)a/debian/scripts/koha-start-sip (-2 / +21 lines)
Lines 18-23 Link Here
18
18
19
set -e
19
set -e
20
20
21
# Read configuration variable file if it is present
22
[ -r /etc/default/koha-common ] && . /etc/default/koha-common
23
24
# include helper functions
25
if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then
26
    . "/usr/share/koha/bin/koha-functions.sh"
27
else
28
    echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2
29
    exit 1
30
fi
31
21
for name in "$@"
32
for name in "$@"
22
do
33
do
23
    if [ ! -e /etc/koha/sites/${name}/koha-conf.xml ] ;
34
    if [ ! -e /etc/koha/sites/${name}/koha-conf.xml ] ;
Lines 29-37 do Link Here
29
    echo "Starting SIP server for $name"
40
    echo "Starting SIP server for $name"
30
    mkdir -p /var/run/koha/${name}
41
    mkdir -p /var/run/koha/${name}
31
    chown "${name}-koha:${name}-koha" /var/run/koha/${name}
42
    chown "${name}-koha:${name}-koha" /var/run/koha/${name}
43
44
    adjust_paths_dev_install $name
32
    export KOHA_CONF PERL5LIB
45
    export KOHA_CONF PERL5LIB
33
    KOHA_CONF=/etc/koha/sites/${name}/koha-conf.xml
46
    KOHA_CONF=/etc/koha/sites/${name}/koha-conf.xml
34
    PERL5LIB="/usr/share/koha/lib"
47
    # PERL5LIB has been read already
48
    if [ "$DEV_INSTALL" = "" ]; then
49
        LIBDIR=$KOHA_HOME/lib
50
    else
51
        LIBDIR=$KOHA_HOME
52
    fi
53
35
    daemon \
54
    daemon \
36
        --name="$name-koha-sip" \
55
        --name="$name-koha-sip" \
37
        --errlog="/var/log/koha/$name/sip-error.log" \
56
        --errlog="/var/log/koha/$name/sip-error.log" \
Lines 44-49 do Link Here
44
        --user="$name-koha.$name-koha" \
63
        --user="$name-koha.$name-koha" \
45
        -- \
64
        -- \
46
        perl \
65
        perl \
47
        "/usr/share/koha/lib/C4/SIP/SIPServer.pm" \
66
        "$LIBDIR/C4/SIP/SIPServer.pm" \
48
        "/etc/koha/sites/${name}/SIPconfig.xml"
67
        "/etc/koha/sites/${name}/SIPconfig.xml"
49
done
68
done
(-)a/debian/scripts/koha-stop-sip (-8 / +1 lines)
Lines 31-39 do Link Here
31
        continue;
31
        continue;
32
    fi
32
    fi
33
    echo "Stopping SIP server for $name"
33
    echo "Stopping SIP server for $name"
34
    KOHA_CONF=/etc/koha/sites/${name}/koha-conf.xml
35
    PERL5LIB=/usr/share/koha/lib
36
    export KOHA_CONF PERL5LIB
37
    daemon \
34
    daemon \
38
        --name="$name-koha-sip" \
35
        --name="$name-koha-sip" \
39
        --errlog="/var/log/koha/$name/sip-error.log" \
36
        --errlog="/var/log/koha/$name/sip-error.log" \
Lines 44-52 do Link Here
44
        --delay=30 \
41
        --delay=30 \
45
        --pidfiles="/var/run/koha/${name}" \
42
        --pidfiles="/var/run/koha/${name}" \
46
        --user="$name-koha.$name-koha" \
43
        --user="$name-koha.$name-koha" \
47
        --stop \
44
        --stop
48
        -- \
49
        perl \
50
        "/usr/share/koha/lib/C4/SIP/SIPServer.pm" \
51
        "/etc/koha/sites/${name}/SIPconfig.xml"
52
done
45
done
(-)a/debian/scripts/koha-upgrade-schema (-5 / +20 lines)
Lines 16-31 Link Here
16
# You should have received a copy of the GNU General Public License
16
# You should have received a copy of the GNU General Public License
17
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
18
19
20
set -e
19
set -e
21
20
21
# Read configuration variable file if it is present
22
[ -r /etc/default/koha-common ] && . /etc/default/koha-common
23
24
# include helper functions
25
if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then
26
    . "/usr/share/koha/bin/koha-functions.sh"
27
else
28
    echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2
29
    exit 1
30
fi
31
32
# Optionally use alternative paths for a dev install
33
adjust_paths_dev_install $1
34
if [ "$DEV_INSTALL" = "" ]; then
35
    CGI_PATH=$KOHA_HOME/intranet/cgi-bin
36
else
37
    CGI_PATH=$KOHA_HOME
38
fi
22
39
23
update="/usr/share/koha/intranet/cgi-bin/installer/data/mysql/updatedatabase.pl"
24
for name in "$@"
40
for name in "$@"
25
do
41
do
26
    echo "Upgrading database schema for $name"
42
    echo "Upgrading database schema for $name"
27
    KOHA_CONF="/etc/koha/sites/$name/koha-conf.xml" \
43
    KOHA_CONF="/etc/koha/sites/$name/koha-conf.xml" \
28
    PERL5LIB="/usr/share/koha/lib" \
44
    PERL5LIB=$PERL5LIB \
29
    "$update"
45
    "$CGI_PATH/installer/data/mysql/updatedatabase.pl"
30
done
46
done
31
(-)a/debian/templates/plack.psgi (-6 / +3 lines)
Lines 17-25 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use lib("/usr/share/koha/lib");
21
use lib("/usr/share/koha/lib/installer");
22
23
use Plack::Builder;
20
use Plack::Builder;
24
use Plack::App::CGIBin;
21
use Plack::App::CGIBin;
25
use Plack::App::Directory;
22
use Plack::App::Directory;
Lines 52-63 use CGI qw(-utf8 ); # we will loose -utf8 under plack, otherwise Link Here
52
    };
49
    };
53
}
50
}
54
51
52
my $home = $ENV{KOHA_HOME};
55
my $intranet = Plack::App::CGIBin->new(
53
my $intranet = Plack::App::CGIBin->new(
56
    root => '/usr/share/koha/intranet/cgi-bin'
54
    root => $ENV{DEV_INSTALL}? $home: "$home/intranet/cgi-bin"
57
)->to_app;
55
)->to_app;
58
56
59
my $opac = Plack::App::CGIBin->new(
57
my $opac = Plack::App::CGIBin->new(
60
    root => '/usr/share/koha/opac/cgi-bin/opac'
58
    root => $ENV{DEV_INSTALL}? "$home/opac": "$home/opac/cgi-bin/opac"
61
)->to_app;
59
)->to_app;
62
60
63
# my $api  = Plack::App::CGIBin->new(
61
# my $api  = Plack::App::CGIBin->new(
64
- 

Return to bug 16733