mirror of
https://github.com/MariaDB/server.git
synced 2025-02-01 19:41:47 +01:00
72 lines
1.9 KiB
Bash
Executable file
72 lines
1.9 KiB
Bash
Executable file
#! /bin/sh
|
|
|
|
set -e
|
|
|
|
prevver="$2"
|
|
|
|
install_plugin() {
|
|
cat /usr/share/mroonga/install.sql | \
|
|
mysql --defaults-file=/etc/mysql/debian.cnf || true
|
|
}
|
|
|
|
install_apparmor() {
|
|
mysql_apparmor_profile_name=usr.sbin.mysqld
|
|
mysql_apparmor_profile=/etc/apparmor.d/${mysql_apparmor_profile_name}
|
|
mysql_local_apparmor_profile=/etc/apparmor.d/local/${mysql_apparmor_profile_name}
|
|
apparmor_profile_name=mysql-server-mroonga
|
|
include_profile="#include <abstractions/${apparmor_profile_name}>"
|
|
local_apparmor_profile=/etc/apparmor.d/local/${apparmor_profile_name}
|
|
if test -f "${mysql_local_apparmor_profile}"; then
|
|
if ! grep -q "${include_profile}" "${mysql_local_apparmor_profile}"; then
|
|
echo >> "${mysql_local_apparmor_profile}"
|
|
echo "${include_profile}" >> "${mysql_local_apparmor_profile}"
|
|
fi
|
|
else
|
|
mysql_abstraction_apparmor_profile=/etc/apparmor.d/abstractions/mysql
|
|
mysql_plugin_dir=/usr/lib/mysql/plugin
|
|
if test -f "${mysql_abstraction_apparmor_profile}" && \
|
|
! grep -q "${mysql_plugin_dir}" \
|
|
"${mysql_abstraction_apparmor_profile}"; then
|
|
# For Lucid.
|
|
cat <<EOF >> "${mysql_abstraction_apparmor_profile}"
|
|
|
|
# ${apparmor_profile_name}: START
|
|
# Added by mysql-server-mroonga.
|
|
${mysql_plugin_dir}/ r,
|
|
${mysql_plugin_dir}/*.so* mr,
|
|
${include_profile}
|
|
# ${apparmor_profile_name}: END
|
|
EOF
|
|
fi
|
|
fi
|
|
|
|
if ! test -e "$local_apparmor_profile"; then
|
|
mkdir -p $(dirname "$local_apparmor_profile")
|
|
cat <<EOF > "$local_apparmor_profile"
|
|
# Site-specific additions and overrides for ${apparmor_profile_name}.
|
|
# For more details, please see /etc/apparmor.d/local/README.
|
|
EOF
|
|
fi
|
|
|
|
if aa-status --enabled 2>/dev/null; then
|
|
apparmor_parser -r -T -W "${mysql_apparmor_profile}" || true
|
|
fi
|
|
|
|
true
|
|
}
|
|
|
|
case "$1" in
|
|
configure)
|
|
install_apparmor
|
|
install_plugin
|
|
;;
|
|
abort-upgrade|abort-deconfigure|abort-remove)
|
|
:
|
|
;;
|
|
*)
|
|
echo "Called with unknown argument $1, bailing out."
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
#DEBHELPER#
|