wok annotate mysql/receipt @ rev 19766
mysql, mariadb: fix pre_install status (thanks Aleksej)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Mon Feb 20 09:35:09 2017 +0100 (2017-02-20) |
parents | ed8073aa8cf0 |
children | 970c5ec9a60a |
rev | line source |
---|---|
pascal@1140 | 1 # SliTaz package receipt. |
pascal@1140 | 2 |
pascal@1140 | 3 PACKAGE="mysql" |
slaxemulator@13187 | 4 VERSION="5.5.27" |
pankso@4171 | 5 CATEGORY="office" |
pascal@1140 | 6 SHORT_DESC="SQL database system." |
pascal@1140 | 7 MAINTAINER="pascal.bellard@slitaz.org" |
pascal@15001 | 8 LICENSE="GPL2" |
pascal@1140 | 9 TARBALL="$PACKAGE-$VERSION.tar.gz" |
pascal@1140 | 10 WEB_SITE="http://www.mysql.com/" |
pascal@17869 | 11 WGET_URL="ftp://mirror.switch.ch/mirror/mysql/Downloads/MySQL-${VERSION%.*}/$TARBALL" |
pascal@14772 | 12 CONFIG_FILES="/etc/mysql" |
pascal@2347 | 13 DATABASE_FILES="/var/lib/mysql" |
pascal@14772 | 14 TAZPANEL_DAEMON="man|edit::/etc/mysql/my.cnf|options|web::$WEB_SITE" |
pankso@10379 | 15 CROSS="bug: can not run test programm" |
pascal@1140 | 16 |
erjo@12033 | 17 DEPENDS="busybox libmysqlclient mysql-client zlib slitaz-base-files \ |
slaxemulator@13187 | 18 gcc-lib-base openssl readline" |
slaxemulator@13187 | 19 BUILD_DEPENDS="cmake openssl-dev zlib-dev ncurses-dev readline-dev" |
erjo@12033 | 20 |
pascal@1140 | 21 # Rules to configure and make the package. |
pascal@1140 | 22 compile_rules() |
pascal@1140 | 23 { |
slaxemulator@13187 | 24 mkdir -p $WOK/$PACKAGE/source/build |
slaxemulator@13187 | 25 cd $WOK/$PACKAGE/source/build |
slaxemulator@13187 | 26 # CFLAGS/CXXFLAGS as suggested upstream |
slaxemulator@13187 | 27 CFLAGS="-fPIC ${CFLAGS} -fno-strict-aliasing -DBIG_JOINS=1 -fomit-frame-pointer" \ |
slaxemulator@13187 | 28 CXXFLAGS="-fPIC ${CXXFLAGS} -fno-strict-aliasing -DBIG_JOINS=1 -felide-constructors -fno-rtti" \ |
slaxemulator@13187 | 29 cmake ../$PACKAGE-$VERSION \ |
slaxemulator@13187 | 30 -DCMAKE_BUILD_TYPE=Release \ |
slaxemulator@13187 | 31 -DCMAKE_INSTALL_PREFIX=/usr \ |
slaxemulator@13187 | 32 -DSYSCONFDIR=/etc/mysql \ |
slaxemulator@13187 | 33 -DMYSQL_DATADIR=/var/lib/mysql \ |
slaxemulator@13187 | 34 -DMYSQL_UNIX_ADDR=/var/run/mysqld/mysqld.sock \ |
slaxemulator@13187 | 35 -DDEFAULT_CHARSET=utf8 \ |
slaxemulator@13187 | 36 -DDEFAULT_COLLATION=utf8_general_ci \ |
slaxemulator@13187 | 37 -DENABLED_LOCAL_INFILE=ON \ |
slaxemulator@13187 | 38 -DINSTALL_INFODIR=share/mysql/docs \ |
slaxemulator@13187 | 39 -DINSTALL_MANDIR=share/man \ |
slaxemulator@13187 | 40 -DINSTALL_PLUGINDIR=/usr/lib/mysql/plugin \ |
slaxemulator@13187 | 41 -DINSTALL_SCRIPTDIR=bin \ |
slaxemulator@13187 | 42 -DINSTALL_INCLUDEDIR=include/mysql \ |
slaxemulator@13187 | 43 -DINSTALL_DOCREADMEDIR=share/mysql \ |
slaxemulator@13187 | 44 -DINSTALL_SUPPORTFILESDIR=share/mysql \ |
slaxemulator@13187 | 45 -DINSTALL_MYSQLSHAREDIR=share/mysql \ |
slaxemulator@13187 | 46 -DINSTALL_DOCDIR=share/mysql/docs \ |
slaxemulator@13187 | 47 -DINSTALL_SHAREDIR=share/mysql \ |
slaxemulator@13187 | 48 -DWITH_READLINE=ON \ |
slaxemulator@13187 | 49 -DWITH_ZLIB=system \ |
slaxemulator@13187 | 50 -DWITH_SSL=system \ |
slaxemulator@13187 | 51 -DWITH_LIBWRAP=OFF \ |
slaxemulator@13187 | 52 -DWITH_MYSQLD_LDFLAGS="${LDFLAGS}" \ |
slaxemulator@13187 | 53 -DWITH_EXTRA_CHARSETS=complex \ |
slaxemulator@13187 | 54 -DWITH_EMBEDDED_SERVER=ON \ |
slaxemulator@13187 | 55 -DWITH_INNOBASE_STORAGE_ENGINE=1 \ |
slaxemulator@13187 | 56 -DWITH_PARTITION_STORAGE_ENGINE=1 \ |
slaxemulator@13187 | 57 -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \ |
slaxemulator@13187 | 58 -DWITHOUT_ARCHIVE_STORAGE_ENGINE=1 \ |
slaxemulator@13187 | 59 -DWITHOUT_BLACKHOLE_STORAGE_ENGINE=1 \ |
pascal@15265 | 60 -DWITHOUT_FEDERATED_STORAGE_ENGINE=1 && |
slaxemulator@13187 | 61 make && make DESTDIR=$DESTDIR install |
pascal@1140 | 62 } |
pascal@1140 | 63 |
pascal@1140 | 64 # Rules to gen a SliTaz package suitable for Tazpkg. |
pascal@1140 | 65 genpkg_rules() |
pascal@1140 | 66 { |
pankso@3359 | 67 mkdir -p \ |
pankso@3359 | 68 $fs/usr/share \ |
pankso@3359 | 69 $fs/usr/lib/mysql/plugin \ |
pankso@3359 | 70 $fs/etc/mysql \ |
pankso@3359 | 71 $fs/etc/mysql.d \ |
pascal@16640 | 72 $fs/var/lib/mysql |
pankso@4171 | 73 |
erjo@12033 | 74 cp -a $install/usr/bin $fs/usr |
erjo@12033 | 75 cp -a $install/usr/lib/mysql/plugin/*.so* $fs/usr/lib/mysql/plugin |
erjo@12033 | 76 cp -a $install/usr/share/mysql $fs/usr/share |
pankso@4171 | 77 |
pankso@3359 | 78 # Configuration file |
erjo@12033 | 79 cp -a $stuff/etc/init.d $fs/etc |
slaxemulator@13187 | 80 cp -a $stuff/etc/mysql $fs/etc |
pankso@3359 | 81 grep -q "bind-address" $fs/etc/mysql/my.cnf || sed -i \ |
pankso@3359 | 82 's/^\[mysqld\]/[mysqld]\nbind-address\t= 127.0.0.1/' \ |
pankso@3359 | 83 $fs/etc/mysql/my.cnf |
pankso@4171 | 84 |
pankso@3359 | 85 # Permissions |
pankso@3359 | 86 chmod 600 $fs/etc/mysql/my.cnf |
pankso@4171 | 87 |
slaxemulator@9701 | 88 cat $stuff/*.files-list | while read file; do |
pascal@1140 | 89 [ -f $fs$file ] && rm -f $fs$file |
pascal@1140 | 90 done |
pankso@4171 | 91 |
pascal@1140 | 92 } |
pascal@1140 | 93 |
pascal@1140 | 94 # Pre and post install commands for Tazpkg. |
pascal@1140 | 95 post_install() |
pascal@1140 | 96 { |
erjo@12033 | 97 |
erjo@12033 | 98 local user |
erjo@12033 | 99 local group |
erjo@12033 | 100 |
erjo@12033 | 101 user=mysql |
erjo@12033 | 102 group=mysql |
erjo@12033 | 103 |
pascal@18730 | 104 if ! grep -q $user "$1/etc/passwd"; then |
erjo@12033 | 105 echo -n "Adding user/group $user..." |
pascal@18730 | 106 chroot "$1/" addgroup -S $group |
pascal@18730 | 107 chroot "$1/" adduser -s /bin/false -S -D -H -G $group $user |
erjo@7889 | 108 status |
erjo@7889 | 109 fi |
slaxemulator@13187 | 110 # adduser mysql if needed |
pascal@18730 | 111 if ! grep -q ${user} "$1/etc/passwd"; then |
slaxemulator@13187 | 112 echo -n "Adding user MySQL..." |
pascal@18730 | 113 chroot "$1/" /bin/adduser -s /bin/false -h /dev/null \ |
slaxemulator@13187 | 114 -g "MySQL Daemon user" -u 27 -H -D -S -G ${group} ${user} |
slaxemulator@13187 | 115 status |
slaxemulator@13187 | 116 fi |
pascal@18732 | 117 #chroot "$1/" /bin/chown ${user}.${group} $(cat "$1/$INSTALLED/$PACKAGE/files.list") |
pascal@16681 | 118 chroot "$1/" /bin/chown -R ${user}.${group} /var/lib/mysql |
slaxemulator@13187 | 119 chroot "$1/" mysql_install_db --user=${user} --basedir=/usr |
pascal@1147 | 120 cat <<EOF |
pascal@1147 | 121 ---- |
pascal@1147 | 122 To start $PACKAGE server you can run : |
pascal@1147 | 123 |
pascal@1147 | 124 /etc/init.d/$PACKAGE start |
pascal@1147 | 125 |
pascal@1147 | 126 Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf |
pascal@1147 | 127 ---- |
pascal@1147 | 128 EOF |
pascal@1140 | 129 } |
pascal@1140 | 130 |
pankso@3359 | 131 pre_install() |
pankso@3359 | 132 { |
pankso@3359 | 133 # Cleanup old files |
pascal@18730 | 134 rm -f "$1/usr/libexec/mysql"* |
pankso@3359 | 135 # Mv config |
pascal@19766 | 136 [ -f "$1/etc/my.cnf" ] && |
pascal@19766 | 137 mv -f "$1/etc/my.cnf" "$1/etc/mysql/my.cnf" || true |
pankso@3359 | 138 } |
pankso@3359 | 139 |
pascal@1140 | 140 post_remove() |
pascal@1140 | 141 { |
slaxemulator@13187 | 142 echo "Removing user/group mysql" |
slaxemulator@13187 | 143 chroot "$1/" deluser mysql |
pascal@1140 | 144 } |