wok view wordpress/receipt @ rev 8570

imported patch get/shell-fm
author Antoine Bodin <gokhlayeh@slitaz.org>
date Sun Feb 13 22:57:56 2011 +0100 (2011-02-13)
parents c7a65207a239
children b7657ab06793
line source
1 # SliTaz package receipt.
3 PACKAGE="wordpress"
4 VERSION="3.0.5"
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 src=$WOK/$PACKAGE/$PACKAGE
18 mkdir -p $fs/var/www/wordpress
19 cp -a $src/* $fs/var/www/wordpress
20 chown -R www.www $fs/var/www/wordpress
21 }
23 post_install()
24 {
25 local db=wordpress
26 local db_user=wordpress
27 local db_password=wordpress
29 # Minimal config for wordpress.
30 if [ -z $1 ]; then
31 if ( ! mysqladmin -s ping > /dev/null ); then
32 echo "Starting MySQL server"
33 ( /etc/init.d/mysql start ; status ) || exit
34 sleep 4 #let the mysql daemon start
35 fi
36 if ( ! mysql -u root -Be 'show databases' | grep -q $db ); then
37 echo -n "Create $db database"
38 mysql -Be "create database $db" ; status
39 # We suppose that $DB_USER user does not exist.
40 # It may be false.
41 echo -n "Create user $db_user with password $db_password"
42 mysql -Be "grant all privileges on $db.* to '"$db_user"'@'localhost'
43 identified by '"$db_password"'" ; status
44 # At last create the database for $PACKAGE.
45 echo -n "Create $db database schema."
46 #mysql -u glpi -pglpi -D glpi < /usr/share/glpi/install/mysql/glpi-${VERSION}-empty.sql ; status
47 fi
48 fi
50 }
52 post_remove()
53 {
54 local db=wordpress
55 local db_user=wordpress
56 local db_password=wordpress
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 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 }