wok view wordpress/receipt @ rev 22876

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