#! /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 " 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 <> "${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 < "$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#