From c95e407a6b7311b8af73af9f4a5c8202cbec535d Mon Sep 17 00:00:00 2001 From: Augustin Trancart Date: Wed, 2 Mar 2022 09:12:56 +0100 Subject: [PATCH] Fix node version --- scripts/_common.sh | 2 +- scripts/bundle_app | 8 ++++++-- scripts/install | 4 +++- scripts/remove | 6 ++++++ scripts/restore | 5 +++-- scripts/upgrade | 10 +++++++++- 6 files changed, 28 insertions(+), 7 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 53faf0c..467fe33 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,5 +1,5 @@ #!/bin/bash -pkg_dependencies="build-essential cmake libssl-dev libcurl4-dev libxml2-dev libxslt-dev imagemagick ghostscript curl libmagickwand-dev git libpq-dev redis-server nodejs postgresql bison " +pkg_dependencies="build-essential cmake libssl-dev libcurl4-dev libxml2-dev libxslt-dev imagemagick ghostscript curl libmagickwand-dev git libpq-dev redis-server postgresql bison " ruby_build_dependencies="bison libffi-dev libgdbm-dev libncurses5-dev libsqlite3-dev libyaml-dev pkg-config sqlite3 zlib1g-dev libgmp-dev libreadline-dev libssl-dev libjemalloc-dev" current_tag="v0.7.17.0" diff --git a/scripts/bundle_app b/scripts/bundle_app index d3b5fbb..03a76d8 100644 --- a/scripts/bundle_app +++ b/scripts/bundle_app @@ -9,7 +9,9 @@ bin/bundle install --full-index --with=postgresql EOF # for some reason rake logs a lot in stderr (tried --quiet, didn't change anything) # redirecting it to stdout to have a saner log on yunohost side -sudo -u $app --login << EOF +sudo -u $app /bin/bash -l << EOF +source /usr/share/yunohost/helpers +ynh_use_nodejs cd diaspora RAILS_ENV=production bundle exec rake db:migrate 2>&1 EOF @@ -18,7 +20,9 @@ EOF # ASSETS PRECOMPILATION #================================================= -sudo -u $app --login << EOF +sudo -u $app /bin/bash << EOF +source /usr/share/yunohost/helpers +ynh_use_nodejs cd diaspora RAILS_ENV=production bin/rake assets:precompile 2>&1 EOF diff --git a/scripts/install b/scripts/install index ab4568f..2da3dd1 100755 --- a/scripts/install +++ b/scripts/install @@ -90,10 +90,12 @@ chmod 0750 $final_path -R chown $app:www-data $final_path #================================================= -# INSTALL RVM AND RUBY FOR CURRENT USER +# INSTALL RVM, RUBY AND NODE FOR CURRENT USER #================================================= ynh_script_progression --message="Installing rvm and ruby... (will take a long time)" --weight=20 source ./install_ruby +ynh_script_progression --message="Installing node" --weight=10 +ynh_install_nodejs --nodejs_version=14 #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE diff --git a/scripts/remove b/scripts/remove index f107e3c..b709dfd 100644 --- a/scripts/remove +++ b/scripts/remove @@ -94,6 +94,12 @@ ynh_script_progression --message="Remove ruby (if this is the last app using it) source $final_path/Experimental_helpers/ynh_install_ruby/ynh_install_ruby ynh_remove_ruby +#================================================= +# REMOVE NODE +#================================================= +ynh_script_progression --message="Remove nodejs for this app" +ynh_remove_nodejs + #================================================= # REMOVE APP MAIN DIR #================================================= diff --git a/scripts/restore b/scripts/restore index fce2886..0c10e11 100644 --- a/scripts/restore +++ b/scripts/restore @@ -69,11 +69,12 @@ chmod 0750 $final_path -R chown $app:www-data $final_path #================================================= -# INSTALL RVM AND RUBY FOR CURRENT USER +# INSTALL RVM, RUBY AND NODE FOR CURRENT USER #================================================= ynh_script_progression --message="Reinstalling rbenv and ruby..." --weight=10 - source ./install_ruby +ynh_script_progression --message="Reinstalling node" --weight=10 +ynh_install_nodejs --nodejs_version=14 #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE diff --git a/scripts/upgrade b/scripts/upgrade index cddcf5a..0a190cd 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -58,17 +58,25 @@ ynh_script_progression --message="Installing dependencies..." ynh_install_app_dependencies $pkg_dependencies $ruby_build_dependencies +#================================================= +# INSTALL NODE +#================================================= +ynh_script_progression --message="Install node" +ynh_install_nodejs --nodejs_version=14 + #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= # migrate from rvm to rbenv -ynh_script_progression --message="Remove rvm..." +ynh_script_progression --message="Remove rvm if needed..." if [ -e "$final_path/.rvm" ]; then sudo -u $app --login << EOF rvm implode --force EOF fi +ynh_script_progression --message="Install ruby" source ./install_ruby + # remove old gpg keys for rvm ynh_script_progression --message="Remove old rvm keys..." if gpg --list-keys mpapis@gmail.com >/dev/null 2>&1; then