From 603eeea2e0c2b52b32ccd5f69d857b1e713411a4 Mon Sep 17 00:00:00 2001 From: Fabian Wilkens Date: Sat, 20 Mar 2021 13:37:41 +0100 Subject: [PATCH] Update installer --- scripts/install | 14 ++++++-------- scripts/restore | 25 ++----------------------- scripts/upgrade | 14 ++++++-------- 3 files changed, 14 insertions(+), 39 deletions(-) diff --git a/scripts/install b/scripts/install index 252bad7..6052d09 100644 --- a/scripts/install +++ b/scripts/install @@ -84,6 +84,7 @@ ynh_script_progression --message="Setting up source files..." --weight=16 git clone $SOURCE "$final_path/live" --quiet pushd "$final_path/live" git checkout $COMMIT --quiet + git submodule update --init --recursive --quiet popd #================================================= @@ -110,6 +111,8 @@ ynh_system_user_create --username=$app --home_dir=$final_path ynh_script_progression --message="Installing Ruby... ( This may take a while... )" --weight=100 #212 ynh_install_ruby --ruby_version=$RUBY_VERSION +/opt/rbenv/versions/$RUBY_VERSION/bin/gem update --system --no-document --quiet +/opt/rbenv/versions/$RUBY_VERSION/bin/gem install bundler --no-document --quiet #================================================= # MODIFY A CONFIG FILE @@ -134,19 +137,15 @@ ynh_replace_string --match_string="SF_DEFAULT_SERVER=http://localhost:3000" --re #================================================= ynh_script_progression --message="Building... ( This may take a while... )" --weight=100 #497 -ENV_PATH="$ynh_node_load_PATH:/opt/rbenv/versions/$RUBY_VERSION/bin" - chown -R $app: "$final_path" pushd "$final_path/live" - git submodule update --init --recursive --quiet ynh_use_nodejs - /opt/rbenv/versions/$RUBY_VERSION/bin/gem install bundler --quiet - /opt/rbenv/versions/$RUBY_VERSION/bin/bundler install --quiet exec_as $app /opt/rbenv/versions/$RUBY_VERSION/bin/bundle config set --local path 'vendor/bundle' + exec_as $app /opt/rbenv/versions/$RUBY_VERSION/bin/bundle config set with 'development' exec_as $app /opt/rbenv/versions/$RUBY_VERSION/bin/bundle install -j$(getconf _NPROCESSORS_ONLN) --quiet - exec_as $app $ENV_PATH yarn install --pure-lockfile - exec_as $app $ENV_PATH yarn bundle + exec_as $app env PATH=$ynh_node_load_PATH yarn install --pure-lockfile + exec_as $app env PATH=$ynh_node_load_PATH yarn bundle exec_as $app /opt/rbenv/versions/$RUBY_VERSION/bin/bundle exec rails assets:precompile --quiet popd @@ -159,7 +158,6 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=3 # Create a dedicated systemd config ynh_add_systemd_config --others_var="\ port \ - ENV_PATH \ RUBY_VERSION \ " diff --git a/scripts/restore b/scripts/restore index f1dc252..feca86f 100755 --- a/scripts/restore +++ b/scripts/restore @@ -88,29 +88,8 @@ ynh_install_app_dependencies $pkg_dependencies ynh_install_nodejs --nodejs_version=$NODEJS_VERSION ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" ynh_install_ruby --ruby_version=$RUBY_VERSION - - -#================================================= -# BUILDING -#================================================= -ynh_script_progression --message="Reinstalling $app... ( This may take a while... )" --weight=100 #222 - - -ENV_PATH="$ynh_node_load_PATH:/opt/rbenv/versions/$RUBY_VERSION/bin" - -chown -R $app: "$final_path" - -pushd "$final_path/live" - git submodule update --init --recursive --quiet - ynh_use_nodejs - /opt/rbenv/versions/$RUBY_VERSION/bin/gem install bundler --quiet - /opt/rbenv/versions/$RUBY_VERSION/bin/bundler install --quiet - exec_as $app /opt/rbenv/versions/$RUBY_VERSION/bin/bundle config set --local path 'vendor/bundle' - exec_as $app /opt/rbenv/versions/$RUBY_VERSION/bin/bundle install -j$(getconf _NPROCESSORS_ONLN) --quiet - exec_as $app $ENV_PATH yarn install --pure-lockfile - exec_as $app $ENV_PATH yarn bundle - exec_as $app /opt/rbenv/versions/$RUBY_VERSION/bin/bundle exec rails assets:precompile --quiet -popd +/opt/rbenv/versions/$RUBY_VERSION/bin/gem update --system --no-document --quiet +/opt/rbenv/versions/$RUBY_VERSION/bin/gem install bundler --no-document --quiet #================================================= # RESTORE USER RIGHTS diff --git a/scripts/upgrade b/scripts/upgrade index 4585e64..5fbf510 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -103,6 +103,7 @@ then git clone $SOURCE "$final_path/live" --quiet pushd "$final_path/live" git checkout $COMMIT --quiet + git submodule update --init --recursive --quiet popd # Restore files if [ -d $tmpdir/log ] ; then @@ -135,6 +136,8 @@ ynh_system_user_create --username=$app --home_dir=$final_path ynh_script_progression --message="Installing Ruby... ( This may take a while... )" --weight=100 #331 ynh_install_ruby --ruby_version=$RUBY_VERSION +/opt/rbenv/versions/$RUBY_VERSION/bin/gem update --system --no-document --quiet +/opt/rbenv/versions/$RUBY_VERSION/bin/gem install bundler --no-document --quiet #================================================= # MODIFY A CONFIG FILE @@ -163,19 +166,15 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Building... ( This may take a while... )" --weight=100 #131 - ENV_PATH="$ynh_node_load_PATH:/opt/rbenv/versions/$RUBY_VERSION/bin" - chown -R $app: "$final_path" pushd "$final_path/live" - git submodule update --init --recursive --quiet ynh_use_nodejs - /opt/rbenv/versions/$RUBY_VERSION/bin/gem install bundler --quiet - /opt/rbenv/versions/$RUBY_VERSION/bin/bundler install --quiet exec_as $app /opt/rbenv/versions/$RUBY_VERSION/bin/bundle config set --local path 'vendor/bundle' + exec_as $app /opt/rbenv/versions/$RUBY_VERSION/bin/bundle config set with 'development' exec_as $app /opt/rbenv/versions/$RUBY_VERSION/bin/bundle install -j$(getconf _NPROCESSORS_ONLN) --quiet - exec_as $app $ENV_PATH yarn install --pure-lockfile - exec_as $app $ENV_PATH yarn bundle + exec_as $app env PATH=$ynh_node_load_PATH yarn install --pure-lockfile + exec_as $app env PATH=$ynh_node_load_PATH yarn bundle exec_as $app /opt/rbenv/versions/$RUBY_VERSION/bin/bundle exec rails assets:precompile --quiet popd fi @@ -188,7 +187,6 @@ ynh_script_progression --message="Upgrading systemd configuration..." --weight=4 # Create a dedicated systemd config ynh_add_systemd_config --others_var="\ port \ - ENV_PATH \ RUBY_VERSION \ "