From 75f0232503cd592b8ab2b0b5615d040e5a0d2605 Mon Sep 17 00:00:00 2001 From: Ken Johnson Date: Mon, 2 Nov 2020 14:57:43 -0800 Subject: [PATCH] Added wp-cli --- post_install.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/post_install.sh b/post_install.sh index 391453b..c2ff067 100755 --- a/post_install.sh +++ b/post_install.sh @@ -44,6 +44,11 @@ service nginx start 2>/dev/null service php-fpm start 2>/dev/null service mysql-server start 2>/dev/null +cd /tmp +curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar +chmod +x wp-cli.phar +sudo mv wp-cli.phar /usr/local/bin/wp + #https://docs.nextcloud.com/server/13/admin_manual/installation/installation_wizard.html do not use the same name for user and db USER="dbadmin" DB="wordpress" @@ -71,6 +76,7 @@ CREATE USER '${USER}'@'localhost' IDENTIFIED BY '${PASS}'; GRANT ALL PRIVILEGES ON *.* TO '${USER}'@'localhost' WITH GRANT OPTION; GRANT ALL PRIVILEGES ON ${DB}.* TO '${USER}'@'localhost'; FLUSH PRIVILEGES; +CREATE DATABASE ${DB}; EOF # Make the default log directory @@ -90,6 +96,7 @@ CREATE USER '${USER}'@'localhost' IDENTIFIED BY '${PASS}'; GRANT ALL PRIVILEGES ON *.* TO '${USER}'@'localhost' WITH GRANT OPTION; GRANT ALL PRIVILEGES ON ${DB}.* TO '${USER}'@'localhost'; FLUSH PRIVILEGES; +CREATE DATABASE ${DB}; EOF fi @@ -99,21 +106,14 @@ if [ -e "/etc/iocage-env" ] ; then echo "Using NAT Address: $IOCAGE_PLUGIN_IP" fi -#Use occ to complete Nextcloud installation -su -m www -c "php /usr/local/www/nextcloud/occ maintenance:install --database=\"mysql\" --database-name=\"nextcloud\" --database-user=\"$USER\" --database-pass=\"$PASS\" --database-host=\"localhost\" --admin-user=\"$NCUSER\" --admin-pass=\"$NCPASS\" --data-dir=\"/usr/local/www/nextcloud/data\"" -su -m www -c "php /usr/local/www/nextcloud/occ config:system:set trusted_domains 1 --value=\"${IOCAGE_PLUGIN_IP}\"" - -#workaround for occ (in shell just use occ instead of su -m www -c "....") -echo >> .cshrc -echo alias occ ./occ.sh >> .cshrc -echo 'su -m www -c php\ ``/usr/local/www/nextcloud/occ\ "$*"``' > ~/occ.sh -chmod u+x ~/occ.sh +#Use wp to complete the Wordpress installation +su -m www -c "wp core config --dbname=$DB --dbuser=$USER --dbpass=$PASS" +su -m www -c "wp core install --title=$DB --admin_user=$WPUSER --admin_password=$WPPASS --admin_email=ken@blkdoor.com # create sessions tmp dir outside nextcloud installation mkdir -p /usr/local/www/wordpress-sessions-tmp >/dev/null 2>/dev/null chmod o-rwx /usr/local/www/wordpress-sessions-tmp chown -R www:www /usr/local/www/wordpress-sessions-tmp - chmod -R o-rwx /usr/local/www/wordpress #updater needs this