wok-6.x view mysql/receipt @ rev 2369

fix chroot in post_install
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Mar 06 10:53:07 2009 +0000 (2009-03-06)
parents ac38c3a33f71
children 4aa363a445f7
line source
1 # SliTaz package receipt.
3 PACKAGE="mysql"
4 VERSION="5.0.51b"
5 CATEGORY="misc"
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="busybox libmysqlclient mysql-client zlib slitaz-base-files"
12 CONFIG_FILES="/etc/my.cnf"
13 DATABASE_FILES="/var/lib/mysql"
15 # Rules to configure and make the package.
16 compile_rules()
17 {
19 cd $src
20 # --with-big-tables ?
21 ./configure --prefix=/usr --infodir=/usr/share/info \
22 --datadir=/usr/share --localstatedir=/var/lib/mysql \
23 --with-unix-socket-path=/var/run/mysqld/mysqld.sock \
24 --with-mysqld-user=mysql \
25 --mandir=/usr/share/man $CONFIGURE_ARGS
26 make
27 make DESTDIR=$PWD/_pkg install
28 cp ../stuff/*.files-list .
29 }
31 # Rules to gen a SliTaz package suitable for Tazpkg.
32 genpkg_rules()
33 {
34 mkdir -p $fs/usr/share $fs/etc/mysql.d $fs/var/lib/mysql $fs/var/run/mysqld
35 cp -a $_pkg/usr/bin $fs/usr
36 cp -a $_pkg/usr/libexec $fs/usr
37 cp -a $_pkg/usr/share/mysql $fs/usr/share
38 cp -a $src/support-files/my-medium.cnf $fs/etc/my.cnf
39 grep -q "bind-address" $fs/etc/my.cnf || sed -i \
40 's/^\[mysqld\]/[mysqld]\nbind-address\t= 127.0.0.1/' $fs/etc/my.cnf
41 chmod 600 $fs/etc/my.cnf
42 cp -a stuff/etc/init.d $fs/etc
43 cat $src/*.files-list | while read file; do
44 [ -f $fs$file ] && rm -f $fs$file
45 done
46 # Package all mysql pkgs
47 for i in $(cd $WOK; ls -d mysql-* libmysql*)
48 do
49 tazwok genpkg $i
50 done
51 }
53 # Pre and post install commands for Tazpkg.
54 post_install()
55 {
56 # adduser mysql if needed
57 if ! grep -q mysql $1/etc/passwd; then
58 echo -n "Adding user mysql..."
59 chroot $1/ /bin/adduser mysql -s /bin/false -H -D -S
60 status
61 fi
62 # addgroup mysql if needed
63 if ! grep -q mysql $1/etc/group; then
64 echo -n "Adding group mysql..."
65 chroot $1/ sh -c '/bin/addgroup mysql && /bin/addgroup mysql mysql'
66 status
67 fi
68 chroot $1/ /bin/chown mysql.mysql $(cat $1/$INSTALLED/$PACKAGE/files.list)
69 cat <<EOF
70 ----
71 To start $PACKAGE server you can run :
73 /etc/init.d/$PACKAGE start
75 Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf
76 ----
77 EOF
78 }
80 post_remove()
81 {
82 deluser mysql
83 delgroup mysql
84 }