wok view wordpress/receipt @ rev 23875

Up alpine (2.23), ansible (2.9.10), wordpress (5.4.2)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Jun 27 16:47:12 2020 +0000 (2020-06-27)
parents 6de35f9c4eab
children 669f61f44760
line source
1 # SliTaz package receipt.
3 PACKAGE="wordpress"
4 VERSION="5.4.2"
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
22 cp -a $src/* $fs/var/www/wordpress
23 chown -R www.www $fs/var/www/wordpress
24 }
26 post_install()
27 {
28 local db=wordpress
29 local db_user=wordpress
30 local db_password=wordpress
32 # Minimal configuration for wordpress.
33 if [ -z "$1" ]
34 then
35 if ( ! mysqladmin -s ping > /dev/null )
36 then
37 echo
38 echo "Starting MySQL server"
39 ( /etc/init.d/mysql start ; status ) || exit
40 sleep 4 #let the mysql daemon start
41 fi
42 if ( ! mysql -u root -Be 'show databases' | grep -q $db )
43 then
44 echo
45 echo -n "Create $db database"
46 mysql -Be "create database $db"
47 status
48 # We suppose that $DB_USER user does not exist.
49 # It may be false.
50 echo -n "Create user $db_user with password $db_password"
51 mysql -Be "grant all privileges on $db.* to '"$db_user"'@'localhost'
52 identified by '"$db_password"'" ; status
53 # At last create the database for $PACKAGE.
54 echo -n "Create $db database schema."
55 #mysql -u glpi -pglpi -D glpi < /usr/share/glpi/install/mysql/glpi-${VERSION}-empty.sql ; status
56 fi
57 fi
59 }
61 post_remove()
62 {
63 local db=wordpress
64 local db_user=wordpress
65 local db_password=wordpress
67 if [ -z "$1" ]
68 then
69 echo -n "Would you like to remove data and database files.(y/n) "
70 read answer
72 case $answer in
73 y|Y)
74 echo -n "Removing data directories..."
75 [ -d /var/lib/wordpress ] && rm -rf /var/lib/wordpress ; status
76 if ( mysql -u root -Be 'show databases' | grep -q $db )
77 then
78 echo -n "Deleting $db database"
79 mysql -Be "drop database $db"
80 status
81 # We suppose that glpi user does not exist.
82 # It may be false.
83 echo -n "Delete user $db_user"
84 mysql -Be "delete from mysql.db where user='"$db_user"'"
85 status
86 fi
87 unset $answer
88 ;;
89 *)
90 ;;
91 esac
92 fi
93 }