Bug 30468: Restore 'set -e' and remove echos

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Jonathan Druart 2022-08-01 12:31:21 +02:00 committed by Tomas Cohen Arazi
parent e97b099d58
commit 4a00658e34
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -17,6 +17,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
set -e
umask 0077 umask 0077
# include helper functions # include helper functions
@ -48,20 +49,17 @@ is_instance "$name" || ( usage; die "Unknown instance '$name'" )
shift # remove instance name from argument list. shift # remove instance name from argument list.
kohaconfig="/etc/koha/sites/$name/koha-conf.xml" kohaconfig="/etc/koha/sites/$name/koha-conf.xml"
mysqlhost="$( xmlstarlet sel -t -v 'yazgfs/config/hostname' $kohaconfig )" || die "hostname missing from $kohaconfig" mysqlhost="$( xmlstarlet sel -t -v 'yazgfs/config/hostname' $kohaconfig )"
mysqldb="$( xmlstarlet sel -t -v 'yazgfs/config/database' $kohaconfig )" || die "database missing from $kohaconfig" mysqldb="$( xmlstarlet sel -t -v 'yazgfs/config/database' $kohaconfig )"
mysqluser="$( xmlstarlet sel -t -v 'yazgfs/config/user' $kohaconfig )" || die "user missing from $kohaconfig" mysqluser="$( xmlstarlet sel -t -v 'yazgfs/config/user' $kohaconfig )"
mysqlpass="$( xmlstarlet sel -t -v 'yazgfs/config/pass' $kohaconfig )" || die "pass missing from $kohaconfig" mysqlpass="$( xmlstarlet sel -t -v 'yazgfs/config/pass' $kohaconfig )"
mysqltz="$( xmlstarlet sel -t -v 'yazgfs/config/timezone' $kohaconfig )" mysqltz="$( xmlstarlet sel -t -v 'yazgfs/config/timezone' $kohaconfig || true )"
if [ $? -eq 0 ] if [ "$mysqltz" != "" ]
then then
echo "Using time zone $mysqltz" mysql --host="$mysqlhost" --user="$mysqluser" --password="$mysqlpass" --init-command="SET time_zone='$mysqltz'" \
mysql --host="$mysqlhost" --user="$mysqluser" --password="$mysqlpass" --init-command="SET time_zone = '$mysqltz'" \
"$mysqldb" "${@}" "$mysqldb" "${@}"
else else
echo "No time zone set for Koha, using database time zone."
mysql --host="$mysqlhost" --user="$mysqluser" --password="$mysqlpass" \ mysql --host="$mysqlhost" --user="$mysqluser" --password="$mysqlpass" \
"$mysqldb" "${@}" "$mysqldb" "${@}"
fi fi