mirror of
https://github.com/YunoHost-Apps/glitchsoc_ynh.git
synced 2024-09-03 19:15:59 +02:00
Add swap during upgrade and restore
This commit is contained in:
parent
d406a87de2
commit
b199de81f9
2 changed files with 36 additions and 0 deletions
|
@ -10,6 +10,8 @@
|
|||
source ../settings/scripts/_common.sh
|
||||
source ../settings/scripts/ynh_install_ruby
|
||||
source ../settings/scripts/ynh_add_extra_apt_repos__3
|
||||
source ../settings/scripts/ynh_add_swap
|
||||
source ../settings/scripts/ynh_check_ram
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
|
@ -80,6 +82,22 @@ chown -R $app: $final_path
|
|||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
#=================================================
|
||||
# ADD SWAP IF NEEDED
|
||||
#=================================================
|
||||
|
||||
total_memory=$(ynh_check_ram)
|
||||
total_swap=$(ynh_check_ram --only_swap)
|
||||
swap_needed=0
|
||||
|
||||
if [ $total_memory -lt 2560 ]; then
|
||||
# Need a minimum of 8Go of memory
|
||||
swap_needed=$((2560 - $total_memory))
|
||||
fi
|
||||
|
||||
ynh_script_progression --message="Adding $swap_needed Mo to swap..." --weight=1
|
||||
ynh_add_swap --size=$swap_needed
|
||||
|
||||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
source _common.sh
|
||||
source ynh_install_ruby
|
||||
source ynh_add_extra_apt_repos__3
|
||||
source ynh_add_swap
|
||||
source ynh_check_ram
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
|
@ -205,6 +207,22 @@ ynh_system_user_create --username=$app --home_dir=$final_path
|
|||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
# ADD SWAP IF NEEDED
|
||||
#=================================================
|
||||
|
||||
total_memory=$(ynh_check_ram)
|
||||
total_swap=$(ynh_check_ram --only_swap)
|
||||
swap_needed=0
|
||||
|
||||
if [ $total_memory -lt 2560 ]; then
|
||||
# Need a minimum of 8Go of memory
|
||||
swap_needed=$((2560 - $total_memory))
|
||||
fi
|
||||
|
||||
ynh_script_progression --message="Adding $swap_needed Mo to swap..." --weight=1
|
||||
ynh_add_swap --size=$swap_needed
|
||||
|
||||
#=================================================
|
||||
# INSTALLING RUBY AND BUNDLER
|
||||
#=================================================
|
||||
|
|
Loading…
Add table
Reference in a new issue