mirror of
https://github.com/YunoHost-Apps/diaspora_ynh.git
synced 2024-09-03 18:26:13 +02:00
Use experimental helpers to install ruby (and switch from rvm to rbenv)
This commit is contained in:
parent
9efa5b7689
commit
d930323806
7 changed files with 36 additions and 38 deletions
|
@ -1,4 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
pkg_dependencies="build-essential cmake libssl-dev libcurl4-openssl-dev libxml2-dev libxslt-dev imagemagick ghostscript curl libmagickwand-dev git libpq-dev redis-server nodejs 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"
|
||||
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"
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
#!/bin/bash
|
||||
pushd $final_path/diaspora
|
||||
# here we *absolutely* need bash (not dash) because dash does not understand what rvm puts in .profile
|
||||
# (wtf rvm for assuming everybody uses bash as default shell??)
|
||||
# we also need a login shell to make sure .profile is loaded
|
||||
sudo -u $app /bin/bash --login << EOF
|
||||
rvm use --default 2.4
|
||||
rvm 2.4 do gem install bundler:1.17.3
|
||||
echo 2.6.6 > .ruby-version # overwrite 2.4 default from diaspora because rbenv does not understand it
|
||||
sudo -u $app --login << EOF
|
||||
gem install bundler:1.17.3
|
||||
cd diaspora
|
||||
script/configure_bundler
|
||||
bin/bundle install --full-index --with=postgresql
|
||||
EOF
|
||||
sudo -u $app /bin/bash --login << EOF
|
||||
sudo -u $app --login << EOF
|
||||
cd diaspora
|
||||
RAILS_ENV=production bundle exec rake db:migrate
|
||||
EOF
|
||||
|
||||
#=================================================
|
||||
# ASSETS PRECOMPILATION
|
||||
#=================================================
|
||||
sudo -u $app /bin/bash --login << EOF
|
||||
sudo -u $app --login << EOF
|
||||
cd diaspora
|
||||
RAILS_ENV=production bin/rake assets:precompile
|
||||
EOF
|
||||
popd
|
||||
|
|
|
@ -11,9 +11,6 @@ can_remove_db=0
|
|||
can_remove_home=0
|
||||
can_remove_user=0
|
||||
|
||||
# flag to make clean_setup display rvm log if rvm build has failed
|
||||
should_display_rvm_log=0
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
|
@ -27,12 +24,6 @@ source /usr/share/yunohost/helpers
|
|||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_clean_setup() {
|
||||
# print rvm logs
|
||||
if [ $should_display_rvm_log -eq 1 ]; then
|
||||
find $final_path/.rvm/log/ -name make.log -exec cat {} \;
|
||||
fi
|
||||
}
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
|
@ -101,7 +92,7 @@ chown $app:www-data $final_path
|
|||
# INSTALL RVM AND RUBY FOR CURRENT USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing rvm and ruby..." --weight=240
|
||||
source ./install_rvm_ruby
|
||||
source ./install_ruby
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
|
|
18
scripts/install_ruby
Normal file
18
scripts/install_ruby
Normal file
|
@ -0,0 +1,18 @@
|
|||
#!/bin/bash
|
||||
# some stuff we don't care about really.
|
||||
# clone ynh_experimental helpers
|
||||
pushd $final_path
|
||||
if [ -x Experimental_helpers ]; then
|
||||
pushd Experimental_helpers
|
||||
git fetch
|
||||
popd
|
||||
else
|
||||
git clone https://github.com/YunoHost-Apps/Experimental_helpers.git
|
||||
fi
|
||||
pushd Experimental_helpers
|
||||
git checkout 606b60cf6bb3906d32020392f0a824d1f9971e96
|
||||
source ./ynh_install_ruby/ynh_install_ruby
|
||||
popd
|
||||
popd
|
||||
ynh_install_ruby --ruby_version=2.6.6
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
#!/bin/bash
|
||||
# some stuff we don't care about really.
|
||||
cp -v ../conf/piotr.kuczynski\@gmail.com.pgp ../conf/mpapis\@gmail.com.pgp $final_path
|
||||
chown $app:$app $final_path/piotr.kuczynski\@gmail.com.pgp $final_path/mpapis\@gmail.com.pgp
|
||||
sudo -u $app gpg --import $final_path/piotr.kuczynski\@gmail.com.pgp $final_path/mpapis\@gmail.com.pgp
|
||||
pushd $final_path
|
||||
sudo -u $app curl -sSL https://get.rvm.io | sudo -u $app bash -s stable
|
||||
sudo -u $app $final_path/.rvm/bin/rvm autolibs read-fail
|
||||
# avoid some issues where /tmp is not big enough
|
||||
export TMPDIR=$final_path/.gcc_tmp
|
||||
sudo -u $app mkdir -p $TMPDIR
|
||||
# unfortunately no prebuilt for debian... this will be long
|
||||
should_display_rvm_log=1
|
||||
sudo -u $app TMPDIR=$TMPDIR $final_path/.rvm/bin/rvm install 2.4
|
||||
should_display_rvm_log=0
|
||||
popd
|
||||
|
|
@ -87,6 +87,13 @@ if [ $can_remove_user -eq 1 ]; then
|
|||
ynh_system_user_delete $app
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# REMOVE RUBY
|
||||
#=================================================
|
||||
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 APP MAIN DIR
|
||||
#=================================================
|
||||
|
|
|
@ -69,7 +69,7 @@ chown $app:www-data $final_path
|
|||
# INSTALL RVM AND RUBY FOR CURRENT USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reinstalling rvm and ruby..." --weight=50
|
||||
source ./install_rvm_ruby
|
||||
source ./install_ruby
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
|
|
Loading…
Add table
Reference in a new issue