Merge pull request #13546 from miska/maria-cleanup-update

MariaDB: cleanup & update
This commit is contained in:
Rosen Penev 2020-10-03 16:09:29 -07:00 committed by GitHub
commit 81f6d680a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 38 deletions

View file

@ -8,8 +8,8 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=mariadb PKG_NAME:=mariadb
PKG_VERSION:=10.4.13 PKG_VERSION:=10.4.14
PKG_RELEASE:=3 PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL := \ PKG_SOURCE_URL := \
@ -18,7 +18,7 @@ PKG_SOURCE_URL := \
https://ftp.yz.yamagata-u.ac.jp/pub/dbms/mariadb/$(PKG_NAME)-$(PKG_VERSION)/source \ https://ftp.yz.yamagata-u.ac.jp/pub/dbms/mariadb/$(PKG_NAME)-$(PKG_VERSION)/source \
https://downloads.mariadb.org/interstitial/$(PKG_NAME)-$(PKG_VERSION)/source https://downloads.mariadb.org/interstitial/$(PKG_NAME)-$(PKG_VERSION)/source
PKG_HASH:=45bbbb12d1de8febd9edf630e940c23cf14efd60570c743b268069516a5d91df PKG_HASH:=f92fcd59e0122461482f28c67c5ea01c7cf6979494a571db68074396864c86fc
PKG_MAINTAINER:=Michal Hrusecky <Michal@Hrusecky.net> PKG_MAINTAINER:=Michal Hrusecky <Michal@Hrusecky.net>
PKG_LICENSE:=GPL-2.0 PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=COPYING THIRDPARTY PKG_LICENSE_FILES:=COPYING THIRDPARTY

View file

@ -1,19 +1,22 @@
#!/bin/sh /etc/rc.common #!/bin/sh /etc/rc.common
# Copyright (C) 2010-2018 OpenWrt.org # Copyright (C) 2010-2018 OpenWrt.org
# shellcheck disable=SC2034
START=95 START=95
# shellcheck disable=SC2034
STOP=10 STOP=10
NAME=mysqld NAME=mysqld
LOGGER="/usr/bin/logger -p user.err -s -t $NAME --" LOGGER="/usr/bin/logger -p user.err -s -t $NAME --"
[ -x "$LOGGER" ] || LOGGER="echo"
MYSQLADMIN=/usr/bin/mysqladmin MYSQLADMIN="/usr/bin/mysqladmin"
MYSQLD=/usr/bin/$NAME MYSQLD="/usr/bin/$NAME"
MYSQLDSAFE=/usr/bin/mysqld_safe MYSQLDSAFE="/usr/bin/mysqld_safe"
# mysqladmin likes to read /root/.my.cnf which could cause issues. # mysqladmin likes to read /root/.my.cnf which could cause issues.
export HOME=/etc/mysql export HOME="/etc/mysql"
# Safeguard (relative paths, core dumps...) # Safeguard (relative paths, core dumps...)
cd / cd /
@ -40,8 +43,8 @@ mysqld_status() {
fi fi
ps_alive=0 ps_alive=0
pidfile=$(mysqld_get_param pid-file) pidfile="$(mysqld_get_param pid-file)"
if [ -f "$pidfile" ] && kill -0 $(cat "$pidfile") >/dev/null 2>&1; then if [ -f "$pidfile" ] && kill -0 "$(cat "$pidfile")" >/dev/null 2>&1; then
ps_alive=1 ps_alive=1
fi fi
@ -62,85 +65,87 @@ start() {
hint="please fix your server configuration in /etc/mysql/" hint="please fix your server configuration in /etc/mysql/"
for i in $MYSQLD $MYSQLADMIN $MYSQLDSAFE; do for i in "$MYSQLD" "$MYSQLADMIN" "$MYSQLDSAFE"; do
if [ ! -x $i ]; then if [ ! -x "$i" ]; then
$LOGGER $i is missing $LOGGER "$i is missing"
exit 1 exit 1
fi fi
done done
if [ ! -r $conf ]; then if [ ! -r "$conf" ]; then
$LOGGER $conf cannot be read $LOGGER "$conf cannot be read"
exit 1 exit 1
fi fi
config_load $NAME config_load "$NAME"
config_get_bool enabled general enabled 0 config_get_bool enabled general enabled 0
if [ $enabled -eq 0 ]; then # shellcheck disable=SC2154
$LOGGER service not enabled in /etc/config/$NAME if [ "$enabled" -eq 0 ]; then
$LOGGER "service not enabled in /etc/config/$NAME"
exit 1 exit 1
fi fi
config_get options general options config_get options general options
datadir=$(mysqld_get_param datadir) datadir="$(mysqld_get_param datadir)"
tmpdir=$(mysqld_get_param tmpdir) tmpdir="$(mysqld_get_param tmpdir)"
if [ -z "$datadir" ]; then if [ -z "$datadir" ]; then
$LOGGER datadir is not set $LOGGER "datadir is not set"
$LOGGER $hint $LOGGER "$hint"
exit 1 exit 1
fi fi
if [ -z "$tmpdir" ]; then if [ -z "$tmpdir" ]; then
$LOGGER tmpdir is not set $LOGGER "tmpdir is not set"
$LOGGER $hint $LOGGER "$hint"
exit 1 exit 1
fi fi
if [ ! -f "$datadir/mysql/tables_priv.MAD" ]; then if [ ! -f "$datadir/mysql/tables_priv.MAD" ]; then
args="--force" args="--force"
basedir=$(mysqld_get_param basedir) basedir="$(mysqld_get_param basedir)"
[ -n "$basedir" ] && args="$args --basedir=$basedir" [ -n "$basedir" ] && args="$args --basedir=$basedir"
$LOGGER Cannot detect privileges table. You might need to run $LOGGER "Cannot detect privileges table. You might need to run"
$LOGGER \'mysql_install_db "$args"\' $LOGGER "'mysql_install_db \"$args\"'"
$LOGGER to initialize the system tables. $LOGGER "to initialize the system tables."
exit 1 exit 1
fi fi
# Start daemon # Start daemon
if mysqld_status check_alive; then if mysqld_status check_alive; then
$LOGGER already running $LOGGER "server is already running"
else else
for i in $logdir $rundir; do for i in "$logdir" "$rundir"; do
opts="-m 0750" opts="-m 0750"
if ! [ -e $i ]; then if ! [ -e "$i" ]; then
# $rundir needs to be accessible for # $rundir needs to be accessible for
# clients # clients
if [ $i = $rundir ]; then if [ "$i" = "$rundir" ]; then
opts= opts=
fi fi
mkdir -p $opts $i # shellcheck disable=SC2086
[ -d $i ] && chown mariadb:mariadb $i mkdir -p $opts "$i"
[ -d "$i" ] && chown mariadb:mariadb "$i"
fi fi
done done
# shellcheck disable=SC2154,SC2086
$MYSQLDSAFE $options >/dev/null 2>&1 & "$MYSQLDSAFE" $options >/dev/null 2>&1 &
fi fi
} }
stop() { stop() {
if ! mysqld_status check_dead; then if ! mysqld_status check_dead; then
$MYSQLADMIN shutdown "$MYSQLADMIN" shutdown
fi fi
} }
reload() { reload() {
if mysqld_status check_alive; then if mysqld_status check_alive; then
$MYSQLADMIN reload "$MYSQLADMIN" reload
else else
$LOGGER not running $LOGGER "server is not running"
fi fi
} }