wok-6.x annotate mysql/receipt @ rev 7961

Made mysql post_install have uuser and group id number 27. This is mostly so we can start having normal numbers for user and group ids.
author Christopher Rogers <slaxemulator@gmail.com>
date Sun Jan 16 12:04:56 2011 +0000 (2011-01-16)
parents 08d062d6c6db
children d1768332cee0
rev   line source
pascal@1140 1 # SliTaz package receipt.
pascal@1140 2
pascal@1140 3 PACKAGE="mysql"
slaxemulator@7658 4 VERSION="5.1.54"
pankso@4171 5 CATEGORY="office"
pascal@1140 6 SHORT_DESC="SQL database system."
pascal@1140 7 MAINTAINER="pascal.bellard@slitaz.org"
pascal@1140 8 TARBALL="$PACKAGE-$VERSION.tar.gz"
pascal@1140 9 WEB_SITE="http://www.mysql.com/"
pankso@3359 10 WGET_URL="http://mirrors.sunsite.dk/mysql/Downloads/MySQL-5.1/$TARBALL"
pascal@5004 11 DEPENDS="busybox libmysqlclient mysql-client zlib slitaz-base-files \
pascal@5004 12 gcc-lib-base"
pankso@3359 13 CONFIG_FILES="/etc/mysql/my.cnf"
pascal@2347 14 DATABASE_FILES="/var/lib/mysql"
pascal@1140 15
pascal@1140 16 # Rules to configure and make the package.
pascal@1140 17 compile_rules()
pascal@1140 18 {
pascal@1140 19
pascal@1140 20 cd $src
pascal@5735 21 grep -q skip_do_abi_check Makefile.am ||
pascal@5735 22 sed -i 's/^do_abi_check/&:\n\techo "Skipping &"\n\nreally_&/' Makefile.*
pascal@1140 23 ./configure --prefix=/usr --infodir=/usr/share/info \
pascal@1140 24 --datadir=/usr/share --localstatedir=/var/lib/mysql \
pankso@3359 25 --sysconfdir=/etc/mysql --libexecdir=/usr/sbin \
pascal@1140 26 --with-unix-socket-path=/var/run/mysqld/mysqld.sock \
pascal@1140 27 --with-mysqld-user=mysql \
pascal@3318 28 --enable-thread-safe-client \
erjo@5772 29 --with-plugins=innobase,innodb_plugin \
pascal@2773 30 --mandir=/usr/share/man $CONFIGURE_ARGS &&
pascal@5735 31 make -j 4 &&
pascal@1140 32 make DESTDIR=$PWD/_pkg install
pascal@1140 33 }
pascal@1140 34
pascal@1140 35 # Rules to gen a SliTaz package suitable for Tazpkg.
pascal@1140 36 genpkg_rules()
pascal@1140 37 {
pankso@3359 38 mkdir -p \
pankso@3359 39 $fs/usr/share \
pankso@3359 40 $fs/usr/lib/mysql/plugin \
pankso@3359 41 $fs/etc/mysql \
pankso@3359 42 $fs/etc/mysql.d \
pankso@3359 43 $fs/var/lib/mysql \
pankso@3359 44 $fs/var/run/mysqld
pankso@4171 45
pascal@1140 46 cp -a $_pkg/usr/bin $fs/usr
pankso@3359 47 cp -a $_pkg/usr/sbin $fs/usr
pankso@3359 48 cp -a $_pkg/usr/lib/mysql/plugin/*.so* $fs/usr/lib/mysql/plugin
pascal@1140 49 cp -a $_pkg/usr/share/mysql $fs/usr/share
pankso@4171 50
pankso@3359 51 # Configuration file
pascal@1140 52 cp -a stuff/etc/init.d $fs/etc
pankso@3359 53 cp -a $src/support-files/my-medium.cnf $fs/etc/mysql/my.cnf
pankso@3359 54 cp -a $src/support-files/my-small.cnf $fs/etc/mysql
pankso@3359 55 grep -q "bind-address" $fs/etc/mysql/my.cnf || sed -i \
pankso@3359 56 's/^\[mysqld\]/[mysqld]\nbind-address\t= 127.0.0.1/' \
pankso@3359 57 $fs/etc/mysql/my.cnf
pankso@4171 58
pankso@3359 59 # Permissions
pankso@3359 60 chmod 600 $fs/etc/mysql/my.cnf
pankso@4171 61
pankso@3359 62 cat $WOK/$PACKAGE/stuff/*.files-list | while read file; do
pascal@1140 63 [ -f $fs$file ] && rm -f $fs$file
pascal@1140 64 done
pankso@4171 65
pascal@1140 66 }
pascal@1140 67
pascal@1140 68 # Pre and post install commands for Tazpkg.
pascal@1140 69 post_install()
pascal@1140 70 {
erjo@7889 71 # addgroup mysql if needed
erjo@7889 72 if ! grep -q mysql $1/etc/group; then
erjo@7889 73 echo -n "Adding group MySQL..."
slaxemulator@7961 74 chroot $1/ /bin/addgroup -g 27 mysql
erjo@7889 75 status
erjo@7889 76 fi
pascal@1140 77 # adduser mysql if needed
pascal@1140 78 if ! grep -q mysql $1/etc/passwd; then
pankso@3359 79 echo -n "Adding user MySQL..."
pankso@3359 80 chroot $1/ /bin/adduser -s /bin/false -h /dev/null \
slaxemulator@7961 81 -g "MySQL Daemon user" -u 27 -H -D -S -G mysql mysql
pascal@1140 82 status
pascal@1140 83 fi
pascal@2279 84 chroot $1/ /bin/chown mysql.mysql $(cat $1/$INSTALLED/$PACKAGE/files.list)
pascal@1147 85 cat <<EOF
pascal@1147 86 ----
pascal@1147 87 To start $PACKAGE server you can run :
pascal@1147 88
pascal@1147 89 /etc/init.d/$PACKAGE start
pascal@1147 90
pascal@1147 91 Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf
pascal@1147 92 ----
pascal@1147 93 EOF
pascal@1140 94 }
pascal@1140 95
pankso@3359 96 pre_install()
pankso@3359 97 {
pankso@3359 98 # Cleanup old files
pankso@3359 99 rm -f $1/usr/libexec/mysql*
pankso@3359 100 # Mv config
pankso@4171 101 [ -f $1/etc/my.cnf ] && mv -f $1/etc/my.cnf $1/etc/mysql/my.cnf
pankso@3359 102 }
pankso@3359 103
pascal@1140 104 post_remove()
pascal@1140 105 {
pascal@1140 106 deluser mysql
pascal@1140 107 }