aboutsummaryrefslogtreecommitdiff
path: root/scripts/install
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/install')
-rw-r--r--scripts/install48
1 files changed, 20 insertions, 28 deletions
diff --git a/scripts/install b/scripts/install
index f234e78..819296b 100644
--- a/scripts/install
+++ b/scripts/install
@@ -8,6 +8,7 @@
source _common.sh
source /usr/share/yunohost/helpers
+source ynh_install_ruby
#=================================================
# MANAGE SCRIPT FAILURE
@@ -149,32 +150,14 @@ chown -R "$app": "$final_path"
#=================================================
# SPECIFIC SETUP
#=================================================
-# ...
+# INSTALLING RUBY
#=================================================
-# TODO: try to use ynh_install_ruby from https://github.com/YunoHost-Apps/Experimental_helpers
-# Install de rbenv
-(
- cd $final_path/.rbenv
- src/configure && make -C src
-
- echo "export PATH=\"$final_path/.rbenv/bin:$final_path/live/bin:\$PATH\"
-eval \"\$(rbenv init -)\"" > $final_path/.profile
- echo "export PATH=\"$final_path/.rbenv/bin:$final_path/live/bin:\$PATH\"" > $final_path/.bashrc
-)
-
-# Install ruby-build
-(
- exec_as "$app" $final_path/.rbenv/bin/rbenv install 2.6.0 || true
- exec_as "$app" $final_path/.rbenv/bin/rbenv global 2.6.0 || true
- exec_as "$app" $final_path/.rbenv/versions/2.6.0/bin/ruby -v
-)
+ynh_install_ruby --ruby_version=2.6.0
-# Create symlink for ruby
-rm /usr/bin/ruby || true
-ln -s $final_path/.rbenv/versions/2.6.0/bin/ruby /usr/bin/ruby || true
-
-# Adjust Mastodon config
+#=================================================
+# MODIFY A CONFIG FILE
+#=================================================
cp -a $final_path/live/.env.production.sample $final_path/live/.env.production
ynh_replace_string "REDIS_HOST=redis" "REDIS_HOST=127.0.0.1" "${final_path}/live/.env.production"
@@ -202,16 +185,25 @@ ynh_replace_string "SMTP_FROM_ADDRESS=notifications@example.com" "SMTP_FROM_ADDR
ynh_replace_string "#SMTP_AUTH_METHOD=plain" "SMTP_AUTH_METHOD=none" "${final_path}/live/.env.production"
ynh_replace_string "#SMTP_OPENSSL_VERIFY_MODE=peer" "SMTP_OPENSSL_VERIFY_MODE=none" "${final_path}/live/.env.production"
-# Preconfig CSS & JS
-# Install Mastodon
-# Give right permission for the app
+#=================================================
+# STORE THE CONFIG FILE CHECKSUM
+#=================================================
+
+# Calculate and store the config file checksum into the app settings
+ynh_store_file_checksum "${final_path}/live/.env.production"
+
+#=================================================
+# INSTALLING MASTODON
+#=================================================
+ynh_print_info "Installing Mastodon..."
+
chown -R "$app": "$final_path"
(
cd "$final_path/live"
su mastodon <<INSTALL
- $final_path/.rbenv/versions/2.6.0/bin/gem install bundler:1.16.6 --no-ri --no-rdoc
- $final_path/.rbenv/versions/2.6.0/bin/gem install bundler
+ $final_path/.rbenv/versions/2.6.0/bin/gem update --system
+ $final_path/.rbenv/versions/2.6.0/bin/gem install bundler --no-document
$final_path/.rbenv/versions/2.6.0/bin/bundle install \
-j$(getconf _NPROCESSORS_ONLN) \
--deployment --without development test