SliTaz Packages

Community Doc Forum Pro Shop Bugs Hg
.

Receipt for package "mysql"

# SliTaz package receipt.

PACKAGE="mysql"
VERSION="5.1.54"
CATEGORY="office"
SHORT_DESC="SQL database system."
MAINTAINER="pascal.bellard@slitaz.org"
TARBALL="$PACKAGE-$VERSION.tar.gz"
WEB_SITE="http://www.mysql.com/"
WGET_URL="http://mirrors.sunsite.dk/mysql/Downloads/MySQL-5.1/$TARBALL"
CONFIG_FILES="/etc/mysql/my.cnf"
DATABASE_FILES="/var/lib/mysql"
CROSS="bug: can not run test programm"

DEPENDS="busybox libmysqlclient mysql-client zlib slitaz-base-files \
gcc-lib-base"

# Rules to configure and make the package.
compile_rules()
{

    cd $src
    grep -q skip_do_abi_check Makefile.am ||
    sed -i 's/^do_abi_check/&:\n\techo "Skipping &"\n\nreally_&/' Makefile.*
    ./configure \
        --prefix=/usr \
        --infodir=/usr/share/info \
        --datadir=/usr/share \
        --localstatedir=/var/lib/mysql \
        --sysconfdir=/etc/mysql \
        --libexecdir=/usr/sbin \
        --with-unix-socket-path=/var/run/mysqld/mysqld.sock \
        --with-mysqld-user=mysql \
        --enable-thread-safe-client \
        --with-plugins=innobase,innodb_plugin \
        --mandir=/usr/share/man \
        --build=$HOST_SYSTEM \
        --host=$HOST_SYSTEM &&
    make $MAKEFLAGS &&
    make install
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
    mkdir -p \
        $fs/usr/share \
        $fs/usr/lib/mysql/plugin \
        $fs/etc/mysql \
        $fs/etc/mysql.d \
        $fs/var/lib/mysql \
        $fs/var/run/mysqld

    cp -a $install/usr/bin $fs/usr
    cp -a $install/usr/sbin $fs/usr
    cp -a $install/usr/lib/mysql/plugin/*.so* $fs/usr/lib/mysql/plugin
    cp -a $install/usr/share/mysql $fs/usr/share

    # Configuration file
    cp -a $stuff/etc/init.d $fs/etc
    cp -a $src/support-files/my-medium.cnf $fs/etc/mysql/my.cnf
    cp -a $src/support-files/my-small.cnf $fs/etc/mysql
    grep -q "bind-address" $fs/etc/mysql/my.cnf || sed -i \
        's/^\[mysqld\]/[mysqld]\nbind-address\t= 127.0.0.1/' \
        $fs/etc/mysql/my.cnf

    # Permissions
    chmod 600 $fs/etc/mysql/my.cnf

    cat $stuff/*.files-list | while read file; do
        [ -f $fs$file ] && rm -f $fs$file
    done

}

# Pre and post install commands for Tazpkg.
post_install()
{
    
    local user
    local group
    
    user=mysql
    group=mysql
    
    if ! grep -q $user $1/etc/passwd; then
        echo -n "Adding user/group $user..."
        chroot $1/ addgroup -S $group
        chroot $1/ adduser -s /bin/false -S -D -H -G $group $user
        status
    fi

    chroot $1/ chown -R ${user}.${group} /var/lib/mysql /var/run/mysqld
    
    cat <<EOF
----
To start $PACKAGE server you can run :

    /etc/init.d/$PACKAGE start

Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf
----
EOF
}

pre_install()
{
    # Cleanup old files
    rm -f $1/usr/libexec/mysql*
    # Mv config
    [ -f $1/etc/my.cnf ] && mv -f $1/etc/my.cnf $1/etc/mysql/my.cnf
}

post_remove()
{
    echo "Removing user/group squid"
    deluser mysql
}
3382 packages and 430813 files in stable database (Mon Mar 4 17:53:49 2019)