[arch-commits] Commit in mysql/trunk (PKGBUILD mysql.install)

Andrea Scarpino andrea at archlinux.org
Tue Mar 23 18:37:19 CET 2010


    Date: Tuesday, March 23, 2010 @ 13:37:18
  Author: andrea
Revision: 73176

set rights in PKGBUILD

Modified:
  mysql/trunk/PKGBUILD
  mysql/trunk/mysql.install

---------------+
 PKGBUILD      |    5 +++++
 mysql.install |   11 +++--------
 2 files changed, 8 insertions(+), 8 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2010-03-23 17:11:52 UTC (rev 73175)
+++ PKGBUILD	2010-03-23 17:37:18 UTC (rev 73176)
@@ -108,6 +108,7 @@
   install=mysql.install
   depends=('mysql-clients')
   optdepends=('perl-dbi' 'perl-dbd-mysql')
+  options=('emptydirs') # we need the empty /var/lib/mysql directory
 
   cd ${srcdir}/${pkgbase}-${pkgver}  
   make DESTDIR=${pkgdir} install
@@ -117,6 +118,10 @@
   install -Dm755 ${srcdir}/mysqld ${pkgdir}/etc/rc.d/mysqld || return 1
   install -Dm644 ${srcdir}/mysqld.conf.d ${pkgdir}/etc/conf.d/mysqld || return 1
 
+  # create default MYSQLD_ROOT dir and set mysql rights
+  install -d ${pkgdir}/var/lib/mysql || return 1
+  chown 89:89 ${pkgdir}/var/lib/mysql
+
   # provided by libmysqlclient
   rm -f ${pkgdir}/usr/bin/{mysql_config,mysql_client_test_embedded,mysqltest_embedded}
   rm -rf ${pkgdir}/usr/{include,lib}

Modified: mysql.install
===================================================================
--- mysql.install	2010-03-23 17:11:52 UTC (rev 73175)
+++ mysql.install	2010-03-23 17:37:18 UTC (rev 73176)
@@ -1,17 +1,12 @@
-MYSQLD_ROOT="/var/lib/mysql"
-
 post_install(){
   groupadd -g 89 mysql &>/dev/null
-  useradd -u 89 -g mysql -d ${MYSQLD_ROOT} -s /bin/false mysql &>/dev/null
-  usr/bin/mysql_install_db --datadir=${MYSQLD_ROOT#/} --user=mysql
-  chown -R mysql:mysql ${MYSQLD_ROOT#/} &>/dev/null
+  useradd -u 89 -g mysql -d /var/lib/mysql -s /bin/false mysql &>/dev/null
+  usr/bin/mysql_install_db --datadir=var/lib/mysql --user=mysql
 }
 
 post_upgrade(){
-  [ -f etc/conf.d/mysqld ] && source etc/conf.d/mysqld &>/dev/null
   getent group mysql >/dev/null 2>&1 || groupadd -g 89 mysql &>/dev/null
-  getent passwd mysql >/dev/null 2>&1 || useradd -u 89 -g mysql -d ${MYSQLD_ROOT} -s /bin/false mysql &>/dev/null
-  chown -R mysql:mysql ${MYSQLD_ROOT#/} &>/dev/null
+  getent passwd mysql >/dev/null 2>&1 || useradd -u 89 -g mysql -d /var/lib/mysql -s /bin/false mysql &>/dev/null
 }
 
 post_remove(){



More information about the arch-commits mailing list