mirror of
https://github.com/YunoHost-Apps/glitchsoc_ynh.git
synced 2024-09-03 19:15:59 +02:00
Merge pull request #24 from nemsia/patch-2
[fix] Reinstall dependencies on restore + check .fonctions on remove
This commit is contained in:
commit
35275b3a78
3 changed files with 42 additions and 3 deletions
|
@ -29,10 +29,12 @@ ynh_backup "/etc/cron.d/${app}" "cron.conf"
|
|||
ynh_backup "/etc/systemd/system/mastodon-web.service" "systemd_web.service"
|
||||
ynh_backup "/etc/systemd/system/mastodon-sidekiq.service" "systemd_sidekiq.service"
|
||||
ynh_backup "/etc/systemd/system/mastodon-streaming.service" "systemd_streaming.service"
|
||||
ynh_backup "/etc/apt/sources.list.d/backports.list" "apt_backports.list"
|
||||
ynh_backup "/etc/apt/sources.list.d/yarn.list" "apt_yarn.list"
|
||||
|
||||
# Backup db
|
||||
sudo su - postgres <<COMMANDS
|
||||
pg_dump --role=mastodon -U postgres --no-password mastodon_production > mastodon_db.sql
|
||||
COMMANDS
|
||||
ynh_backup "/var/lib/postgresql/${app}_db.sql" "${app}_db.sql"
|
||||
ynh_secure_remove /var/lib/postgresql/mastodon_db.sql
|
||||
ynh_secure_remove /var/lib/postgresql/mastodon_db.sql
|
||||
|
|
|
@ -3,6 +3,12 @@
|
|||
# Exit on command errors and treat unset variables as an error
|
||||
set -u
|
||||
|
||||
if [ ! -e .fonctions ]; then
|
||||
# Get file fonction if not been to the current directory
|
||||
sudo cp ../settings/scripts/.fonctions ./.fonctions
|
||||
sudo chmod a+rx .fonctions
|
||||
fi
|
||||
|
||||
source .fonctions # Loads the generic functions usually used in the script
|
||||
# Source app helpers
|
||||
source /usr/share/yunohost/helpers
|
||||
|
|
|
@ -65,6 +65,39 @@ fi
|
|||
# Create user unix
|
||||
sudo adduser $app --home /opt/$app --gecos "First Last,RoomNumber,WorkPhone,HomePhone" --disabled-password --disabled-login
|
||||
|
||||
# Reinstall dependencies
|
||||
# Install debian package
|
||||
ynh_package_install imagemagick libpq-dev libxml2-dev libxslt1-dev file curl apt-transport-https
|
||||
|
||||
# Install redis package
|
||||
ynh_package_install redis-server redis-tools
|
||||
|
||||
# Install postgresql
|
||||
ynh_package_install postgresql postgresql-contrib
|
||||
|
||||
# Install Ruby
|
||||
ynh_package_install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev
|
||||
|
||||
# Install source.list debian package backports & yarn
|
||||
sudo cp ./apt_backports.list /etc/apt/sources.list.d/backports.list
|
||||
sudo curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
|
||||
sudo cp ./apt_yarn.list /etc/apt/sources.list.d/yarn.list
|
||||
ynh_package_update
|
||||
|
||||
# Install debian package backports
|
||||
sudo apt-get -t jessie-backports -y install ffmpeg
|
||||
|
||||
# Install de Node.js
|
||||
pushd /opt
|
||||
curl -sL https://deb.nodesource.com/setup_4.x | sudo bash -
|
||||
sudo apt-get -y install nodejs
|
||||
|
||||
# Install Yarn
|
||||
ynh_package_install yarn
|
||||
|
||||
# Return to home
|
||||
popd
|
||||
|
||||
# Restore sources & data
|
||||
sudo cp -a ./sources/. "$final_path"
|
||||
|
||||
|
@ -73,8 +106,6 @@ sudo chown -R $app: "$final_path"
|
|||
|
||||
sudo ls -alh "$final_path"
|
||||
|
||||
# Change directory for create user & database postgresql
|
||||
|
||||
# Set UTF8 encoding by default
|
||||
sudo su -c "psql" postgres <<< \
|
||||
"update pg_database set datistemplate='false' where datname='template1';"
|
||||
|
|
Loading…
Add table
Reference in a new issue