# SliTaz package receipt. PACKAGE="wordpress" VERSION="6.0.1" CATEGORY="misc" SHORT_DESC="Blog Tool and Publishing Platform." MAINTAINER="slaxemulator@gmail.com" LICENSE="GPL2" WEB_SITE="https://wordpress.org/" TARBALL="$PACKAGE-$VERSION.tar.gz" WGET_URL="${WEB_SITE}$TARBALL" SUGGESTED="apache cherokee" DEPENDS="mysql php php-mysql" # What is the latest version available today? current_version() { wget -O - https://core.trac.wordpress.org/browser 2>/dev/null | \ sed 's|tags/||;s|<.*||' | sort -Vr | sed q } # Rules to gen a SliTaz package suitable for Tazpkg. genpkg_rules() { mkdir -p $fs/var/www/wordpress cp -a $src/* $fs/var/www/wordpress chown -R www.www $fs/var/www/wordpress } post_install() { local db=wordpress local db_user=wordpress local db_password=wordpress # Minimal configuration for wordpress. if [ -z "$1" ] then if ( ! mysqladmin -s ping > /dev/null ) then echo echo "Starting MySQL server" ( /etc/init.d/mysql start ; status ) || exit sleep 4 #let the mysql daemon start fi if ( ! mysql -u root -Be 'show databases' | grep -q $db ) then echo echo -n "Create $db database" mysql -Be "create database $db" status # We suppose that $DB_USER user does not exist. # It may be false. echo -n "Create user $db_user with password $db_password" mysql -Be "grant all privileges on $db.* to '"$db_user"'@'localhost' identified by '"$db_password"'" ; status # At last create the database for $PACKAGE. echo -n "Create $db database schema." #mysql -u glpi -pglpi -D glpi < /usr/share/glpi/install/mysql/glpi-${VERSION}-empty.sql ; status fi fi } post_remove() { local db=wordpress local db_user=wordpress local db_password=wordpress if [ -z "$1" ] then echo -n "Would you like to remove data and database files.(y/n) " read answer case $answer in (y|Y) echo -n "Removing data directories..." [ -d /var/lib/wordpress ] && rm -rf /var/lib/wordpress ; status if ( mysql -u root -Be 'show databases' | grep -q $db ) then echo -n "Deleting $db database" mysql -Be "drop database $db" status # We suppose that glpi user does not exist. # It may be false. echo -n "Delete user $db_user" mysql -Be "delete from mysql.db where user='"$db_user"'" status fi unset $answer ;; (*) ;; esac fi }