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