wok annotate wordpress/receipt @ rev 18963
Up wget (1.17)
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Wed Mar 09 19:55:45 2016 +0200 (2016-03-09) |
parents | 2a21689b0af7 |
children | 970c5ec9a60a |
rev | line source |
---|---|
slaxemulator@7399 | 1 # SliTaz package receipt. |
slaxemulator@7399 | 2 |
slaxemulator@7399 | 3 PACKAGE="wordpress" |
slaxemulator@13184 | 4 VERSION="3.4.1" |
slaxemulator@7399 | 5 CATEGORY="misc" |
slaxemulator@7399 | 6 SHORT_DESC="Blog Tool and Publishing Platform." |
slaxemulator@7399 | 7 MAINTAINER="slaxemulator@gmail.com" |
pascal@15363 | 8 LICENSE="GPL2" |
pascal@13024 | 9 SUGGESTED="apache cherokee" |
slaxemulator@7399 | 10 TARBALL="$PACKAGE-$VERSION.tar.gz" |
slaxemulator@7399 | 11 WEB_SITE="http://wordpress.org" |
slaxemulator@7399 | 12 WGET_URL="$WEB_SITE/$TARBALL" |
slaxemulator@7399 | 13 |
pascal@15363 | 14 DEPENDS="php mysql php-mysql" |
pascal@15363 | 15 |
slaxemulator@7399 | 16 # Rules to gen a SliTaz package suitable for Tazpkg. |
slaxemulator@7399 | 17 genpkg_rules() |
slaxemulator@7399 | 18 { |
slaxemulator@7399 | 19 mkdir -p $fs/var/www/wordpress |
slaxemulator@7399 | 20 cp -a $src/* $fs/var/www/wordpress |
erjo@8354 | 21 chown -R www.www $fs/var/www/wordpress |
slaxemulator@7399 | 22 } |
slaxemulator@7399 | 23 |
erjo@8354 | 24 post_install() |
erjo@8354 | 25 { |
erjo@8354 | 26 local db=wordpress |
erjo@8354 | 27 local db_user=wordpress |
erjo@8354 | 28 local db_password=wordpress |
erjo@8354 | 29 |
erjo@8354 | 30 # Minimal config for wordpress. |
pascal@18730 | 31 if [ -z "$1" ]; then |
erjo@8354 | 32 if ( ! mysqladmin -s ping > /dev/null ); then |
erjo@8354 | 33 echo "Starting MySQL server" |
erjo@8354 | 34 ( /etc/init.d/mysql start ; status ) || exit |
erjo@8354 | 35 sleep 4 #let the mysql daemon start |
erjo@8354 | 36 fi |
erjo@8354 | 37 if ( ! mysql -u root -Be 'show databases' | grep -q $db ); then |
erjo@8354 | 38 echo -n "Create $db database" |
erjo@8354 | 39 mysql -Be "create database $db" ; status |
erjo@8354 | 40 # We suppose that $DB_USER user does not exist. |
erjo@8354 | 41 # It may be false. |
erjo@8354 | 42 echo -n "Create user $db_user with password $db_password" |
erjo@8354 | 43 mysql -Be "grant all privileges on $db.* to '"$db_user"'@'localhost' |
erjo@8354 | 44 identified by '"$db_password"'" ; status |
erjo@8354 | 45 # At last create the database for $PACKAGE. |
erjo@8354 | 46 echo -n "Create $db database schema." |
erjo@8354 | 47 #mysql -u glpi -pglpi -D glpi < /usr/share/glpi/install/mysql/glpi-${VERSION}-empty.sql ; status |
erjo@8354 | 48 fi |
erjo@8354 | 49 fi |
erjo@8354 | 50 |
erjo@8354 | 51 } |
erjo@8354 | 52 |
erjo@8354 | 53 post_remove() |
erjo@8354 | 54 { |
slaxemulator@8651 | 55 local db=wordpress |
slaxemulator@8651 | 56 local db_user=wordpress |
slaxemulator@8651 | 57 local db_password=wordpress |
erjo@8354 | 58 |
pascal@18730 | 59 if [ -z "$1" ]; then |
erjo@8354 | 60 echo -n "Would you like to remove data and database files.(y/n) " |
erjo@8354 | 61 read answer |
erjo@8354 | 62 |
erjo@8354 | 63 case $answer in |
erjo@8354 | 64 y|Y) |
erjo@8354 | 65 echo -n "Removing data directories..." |
slaxemulator@8651 | 66 [ -d /var/lib/wordpress ] && rm -rf /var/lib/wordpress ; status |
erjo@8354 | 67 if ( mysql -u root -Be 'show databases' | grep -q $db ); then |
erjo@8354 | 68 echo -n "Deleting $db database" |
erjo@8354 | 69 mysql -Be "drop database $db" ; status |
erjo@8354 | 70 # We suppose that glpi user does not exist. |
erjo@8354 | 71 # It may be false. |
erjo@8354 | 72 echo -n "Delete user $db_user" |
erjo@8354 | 73 mysql -Be "delete from mysql.db where user='"$db_user"'" ; status |
erjo@8354 | 74 fi |
erjo@8354 | 75 unset $answer |
erjo@8354 | 76 ;; |
erjo@8354 | 77 *) |
erjo@8354 | 78 ;; |
erjo@8354 | 79 esac |
slaxemulator@8651 | 80 fi |
erjo@8354 | 81 } |