wok view mysql/receipt @ rev 1147

mysql: init database in /etc/init.d/mysql, not post_install
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Jul 26 13:40:35 2008 +0000 (2008-07-26)
parents 6c71fe9f8fd5
children dd2aa8326cbc
line source
1 # SliTaz package receipt.
3 PACKAGE="mysql"
4 VERSION="5.0.51b"
5 CATEGORY="system"
6 SHORT_DESC="SQL database system."
7 MAINTAINER="pascal.bellard@slitaz.org"
8 TARBALL="$PACKAGE-$VERSION.tar.gz"
9 WEB_SITE="http://www.mysql.com/"
10 WGET_URL="http://mirrors.sunsite.dk/mysql/Downloads/MySQL-5.0/$TARBALL"
11 DEPENDS="libmysqlclient mysql-client zlib"
13 # Rules to configure and make the package.
14 compile_rules()
15 {
17 cd $src
18 # --with-big-tables ?
19 ./configure --prefix=/usr --infodir=/usr/share/info \
20 --datadir=/usr/share --localstatedir=/var/lib/mysql \
21 --with-unix-socket-path=/var/run/mysqld/mysqld.sock \
22 --with-mysqld-user=mysql \
23 --mandir=/usr/share/man $CONFIGURE_ARGS
24 make
25 make DESTDIR=$PWD/_pkg install
26 cp ../stuff/*.files-list .
27 }
29 # Rules to gen a SliTaz package suitable for Tazpkg.
30 genpkg_rules()
31 {
32 mkdir -p $fs/usr/share $fs/etc $fs/var/lib/mysql $fs/var/run/mysqld
33 cp -a $_pkg/usr/bin $fs/usr
34 cp -a $_pkg/usr/libexec $fs/usr
35 cp -a $_pkg/usr/share/mysql $fs/usr/share
36 cp -a $src/support-files/my-medium.cnf $fs/etc/my.cnf
37 chmod 600 $fs/etc/my.cnf
38 cp -a stuff/etc/init.d $fs/etc
39 cat $src/*.files-list | while read file; do
40 [ -f $fs$file ] && rm -f $fs$file
41 done
42 # Package all mysql pkgs
43 for i in $(cd $WOK; ls -d mysql-* libmysql*)
44 do
45 tazwok genpkg $i
46 done
47 }
49 # Pre and post install commands for Tazpkg.
50 post_install()
51 {
52 # adduser mysql if needed
53 if ! grep -q mysql $1/etc/passwd; then
54 echo -n "Adding user mysql..."
55 chroot $1/ adduser mysql -s /bin/false -H -D -S
56 status
57 fi
58 # addgroup mysql if needed
59 if ! grep -q mysql $1/etc/group; then
60 echo -n "Adding group mysql..."
61 chroot $1/ addgroup mysql && addgroup mysql mysql
62 status
63 fi
64 chroot $1/ chown mysql.mysql $(cat $1/$INSTALLED/$PACKAGE/files.list)
65 cat <<EOF
66 ----
67 To start $PACKAGE server you can run :
69 /etc/init.d/$PACKAGE start
71 Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf
72 ----
73 EOF
74 }
76 post_remove()
77 {
78 deluser mysql
79 delgroup mysql
80 }