Skip to content

Commit

Permalink
Compare Grav version on startup and upgrade if necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
flojon committed Aug 6, 2018
1 parent fca2749 commit 42557dd
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions php7.2/apache/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
#!/bin/sh
set -e

message=""

if [ -z "$(ls -A /var/www/html)" ]; then
message="Grav not found in $PWD - copying now..."
else
# trick sort -V to handle -alpha, -beta, -rc etc. See https://stackoverflow.com/a/40391207
newest_version=`sed -n "s/^define('GRAV_VERSION', '\(.*\)');$/\1/p" system/defines.php /usr/src/grav-admin/system/defines.php | sed '/-/!{s/$/_/}' | sort -V | tail -1`
current_version=`sed -n "s/^define('GRAV_VERSION', '\(.*\)');$/\1/p" system/defines.php | sed '/-/!{s/$/_/}'`
if [ $newest_version != $current_version ]; then
message="Newer version of Grav found - copying now..."
fi
fi

if [ -n "$message" ]; then
echo $message
cp -a /usr/src/grav-admin/. /var/www/html/
chown -R www-data:www-data /var/www/html
if [ "$GRAV_REVERSE_PROXY" = "true" ]; then
Expand Down

0 comments on commit 42557dd

Please sign in to comment.