Koha/debian/scripts/koha-create-dirs
Tomas Cohen Arazi 4a714313fe Bug 14674: koha-create should populate upload_path
This patch makes koha-create and koha-create-dirs aware of the new upload_path
configuration entry.

It defaults to /var/lib/koha/<instance>/uploads as proposed by Robin but lets the
user specify its own directory, using the --upload-path option switch that is
added by this patch.

koha-create-dirs is tweaked so it also creates this new directory.

The docs are updated accordingly.

To test:
- Apply the patch, have a packages setup (either by grabbing the relevant files [1]
  or by creating your own package).
- Run koha-create --create-db instance
=> SUCCESS: /var/lib/koha/instance/uploads directory is created
=> SUCCESS: /etc/koha/sites/instance/koha-config.xml has upload_path set correctly
- Create a new instance using the --upload-path making it point to whatever you want
=> SUCCESS: koha-conf.xml points to your chosen path
- Sign off :-D

Regards

Sponsored-by: Universidad Nacional de Cordoba

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Does not work in its current state. Needs a follow-up.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-10-23 10:09:32 -03:00

63 lines
2.1 KiB
Bash
Executable file

#!/bin/sh
#
# koha-create-dirs -- Create dirs for a Koha instance.
# Copyright 2010 Catalyst IT, Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
set -e
userdir() {
local username="$1-koha"
local directory="$2"
if [ ! -d "$directory" ]
then
install -d -o "$username" -g "$username" "$directory"
fi
}
rootdir() {
local directory="$1"
if [ ! -d "$directory" ]
then
install -d -o root -g root "$directory"
fi
}
for name in "$@"
do
rootdir "/var/spool/koha/$name"
userdir "$name" "/etc/koha/sites/$name"
userdir "$name" "/var/lib/koha/$name"
userdir "$name" "/var/lib/koha/$name/authorities"
userdir "$name" "/var/lib/koha/$name/authorities/key"
userdir "$name" "/var/lib/koha/$name/authorities/register"
userdir "$name" "/var/lib/koha/$name/authorities/shadow"
userdir "$name" "/var/lib/koha/$name/authorities/tmp"
userdir "$name" "/var/lib/koha/$name/biblios"
userdir "$name" "/var/lib/koha/$name/biblios/key"
userdir "$name" "/var/lib/koha/$name/biblios/register"
userdir "$name" "/var/lib/koha/$name/biblios/shadow"
userdir "$name" "/var/lib/koha/$name/biblios/tmp"
userdir "$name" "/var/lib/koha/$name/plugins"
userdir "$name" "/var/lib/koha/$name/uploads"
userdir "$name" "/var/lock/koha/$name"
userdir "$name" "/var/lock/koha/$name/authorities"
userdir "$name" "/var/lock/koha/$name/biblios"
userdir "$name" "/var/run/koha/$name"
userdir "$name" "/var/run/koha/$name/authorities"
userdir "$name" "/var/run/koha/$name/biblios"
done