Ajouter 'mastodon/install-miaou.sh'

This commit is contained in:
Dryusdan 2019-01-08 21:44:06 +01:00
parent a31e84e050
commit ef33a1682f
1 changed files with 81 additions and 0 deletions

81
mastodon/install-miaou.sh Normal file
View File

@ -0,0 +1,81 @@
#!/bin/sh
#systemctl stop mastodon-web mastodon-sidekiq mastodon-streaming
cd /home/mastodon
echo "########################################"
echo "# #"
echo "# Backup database #"
echo "# #"
echo "########################################"
sudo -u postgres /usr/bin/pg_dump mastodon > /home/mastodon/mastodon.dump
echo "########################################"
echo "# #"
echo "# End #"
echo "# #"
echo "########################################"
cd /home/mastodon/www
git reset --hard
git pull
cd /home/mastodon/mastodon-patch/
git pull
cd /home/mastodon/www
sed -i -e "s/Toot/Meow/" app/javascript/mastodon/locales/en.json
sed -i -e "s/toot/meow/" app/javascript/mastodon/locales/en.json
git diff > ../mastodon-patch/change-toot-word-en.patch
git reset --hard
sed -i -e "s/Pouet/Miaou/" app/javascript/mastodon/locales/fr.json
sed -i -e "s/pouet/miaou/" app/javascript/mastodon/locales/fr.json
git diff > ../mastodon-patch/change-toot-word-fr.patch
git reset --hard
cd ../mastodon-patch
git add change-toot-word-fr.patch change-toot-word-en.patch
git commit -m "update locale"
git push
cd ../www
git apply --whitespace=nowarn /home/mastodon/mastodon-patch/*.patch
rbenv_required=`cat /home/mastodon/www/.ruby-version`
if ruby -v | grep -q $rbenv_required; then
echo "Ruby version is OK, continue without compilation";
else
cd /home/mastodon/.rbenv/plugins/ruby-build && git pull && cd -
rbenv install $rbenv_required
rbenv global $rbenv_required
source /home/mastodon/.bashrc
fi
echo "########################################"
echo "# #"
echo "# Normal mascot #"
echo "# #"
echo "########################################"
cp /home/mastodon/kittens/* /home/mastodon/www/app/javascript/flavours/glitch/images
#echo "########################################"
#echo "# #"
#echo "# Halloween mascot #"
#echo "# #"
#echo "########################################"
#cp /home/mastodon/halloween/* /home/mastodon/www/app/javascript/flavours/glitch/images
gem update bundler
bundle install
npm upgrade yarn
yarn install
RAILS_ENV=production bundle exec rails assets:precompile
RAILS_ENV=production bundle exec rails db:migrate
RAILS_ENV=production bundle exec rails assets:clean
echo "########################################"
echo "# #"
echo "# Rstart Mastodon #"
echo "# #"
echo "########################################"
sudo /bin/systemctl restart mastodon-web mastodon-sidekiq mastodon-streaming
echo "########################################"
echo "# #"
echo "# End of update #"
echo "# #"
echo "########################################"