File discourse-update of Package discourse

#!/bin/sh
# if [ "x$(id -un)" != "xdiscourse" ] ; then
#   echo "Please run this script as discourse user" 1>&2
#   exit 1
# fi
set -e
export RAILS_ENV="${RAILS_ENV:=production}"
export LC_ALL="en_US.UTF-8"
export LANG="en_US.UTF-8"
echo "Hoping into the basedir within env $RAILS_ENV"
BUNDLER="BUNDLER_REPLACE"
cd /srv/www/vhosts/discourse/
if [ ! -e tmp/rebuild.txt ] ; then
  echo "Nothing to do for discourse-update. Exiting"
  exit 0
fi
echo "Running rake"
$BUNDLER exec /usr/bin/rake.@RUBY_SUFFIX@ db:migrate
$BUNDLER exec /usr/bin/rake.@RUBY_SUFFIX@ assets:clean
$BUNDLER exec /usr/bin/rake.@RUBY_SUFFIX@ assets:precompile
if [ ! -e vendor/data/GeoLite2-City.mmdb ] ; then
$BUNDLER exec /usr/bin/rake.@RUBY_SUFFIX@ maxminddb:get
chown root:discourse vendor/data/*.mmdb
chmod u=rw,g=r,o=    vendor/data/*.mmdb
fi
echo "Fixing permissions"
chown -R discourse:discourse tmp/ app/assets/javascripts/plugins/ public/plugins/
chmod -R go+rX public/{assets,images,javascripts,plugins,tombstone,uploads}
find public/backups -type d -print0 | xargs -r0 chmod u=rwx,go=x
echo "Trigger tmp/restart.txt"
touch tmp/restart.txt
echo "Finalize rebuild"
rm -f tmp/rebuild.txt
openSUSE Build Service is sponsored by