From 667e56b33a2c6034bd62b87f9cb2cd7ad3a1678e Mon Sep 17 00:00:00 2001 From: Gregory Bartholomew Date: Jan 13 2022 00:34:18 +0000 Subject: Avoid redownload and reinstalling things when possible --- diff --git a/.gitignore b/.gitignore index c075be2..c17f91a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .vagrant /cid-* /opt +/srv /mariadb diff --git a/run.sh b/run.sh index 9b6bad6..c1e807e 100755 --- a/run.sh +++ b/run.sh @@ -8,6 +8,8 @@ DATABASE='wordpress_blog' USERNAME='wordpress' PASSWORD='chahL5oomaiHiezie8thei)h5' +WPPLUGIN='yet-another-related-posts-plugin co-authors-plus' + set -e rm -f cid-* @@ -22,6 +24,13 @@ if ! [[ -e opt ]]; then chmod +x opt/wp fi +if ! [[ -e srv ]]; then + mkdir srv + for plugin in $WPPLUGIN; do + curl -L -s --output-dir srv -O https://downloads.wordpress.org/plugin/$plugin.zip + done +fi + function wordpress_stop { echo podman pod stop $PODMANNS @@ -57,6 +66,7 @@ podman run \ --env WORDPRESS_DB_USER="$USERNAME" \ --env WORDPRESS_DB_PASSWORD="$PASSWORD" \ --volume $PWD/opt:/opt:Z \ + --volume $PWD/srv:/srv:Z \ --volume $PWD/fedoramagazine:/var/www/html/wp-content/themes/fedoramagazine:Z \ --detach docker.io/library/wordpress @@ -64,16 +74,25 @@ WP="podman exec wordpress /opt/wp --allow-root" sleep 10 -$WP core install \ - --url="localhost:$HOSTPORT" \ - --title='pants' \ - --admin_user='admin' \ - --admin_password='password' \ - --admin_email='null@fedoraproject.org' \ +if ! $WP core is-installed; then + $WP core install \ + --url="localhost:$HOSTPORT" \ + --title='pants' \ + --admin_user='admin' \ + --admin_password='password' \ + --admin_email='null@fedoraproject.org' \ + +fi + +if ! $WP theme is-active fedoramagazine; then + $WP theme activate fedoramagazine +fi -$WP theme activate fedoramagazine -$WP plugin install yet-another-related-posts-plugin --activate -$WP plugin install co-authors-plus --activate +for plugin in $WPPLUGIN; do + if ! $WP plugin is-installed $plugin; then + $WP plugin install /srv/$plugin.zip --activate + fi +done echo "wordpress is listening on http://localhost:$HOSTPORT/; press ctrl-c to stop" sleep infinity