wok-next view wordpress/receipt @ rev 20079

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