Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add swap #102

Closed
wants to merge 4 commits into from
Closed

Add swap #102

wants to merge 4 commits into from

Conversation

ericgaspar
Copy link
Member

@ericgaspar ericgaspar commented Jan 2, 2021

Problem

Solution

  • Add ynh_add_swap

PR Status

  • Code finished.
  • Tested with Package_check.
  • Fix or enhancement tested.
  • Upgrade from last version tested.
  • Can be reviewed and tested.

Validation


Minor decision

  • Upgrade previous version :
  • Code review :
  • Approval (LGTM) :
  • Approval (LGTM) :
  • CI succeeded :
    Build Status

@ericgaspar ericgaspar requested a review from kay0u January 2, 2021 16:56
@ericgaspar ericgaspar changed the title Swap Add swap Jan 2, 2021
Comment on lines +57 to +69
total_memory=$(ynh_get_ram --total)
total_swap=$(ynh_get_ram --total --only_swap)
swap_needed=0

if [ $total_memory -lt 4096 ]; then
# Need a minimum of 4GB of memory
swap_needed=$((4096 - $total_memory))
fi

# Need at least 2GB of swap
if [ $(($total_swap + $swap_needed)) -lt 2048 ]; then
swap_needed=$((2048 - $total_swap))
fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, did you try using ynh_require_ram for this ? Or was it not matching what you aim to want to do ? Can you elaborate on this ? (So that maybe we can improve the official helper)

@ericgaspar ericgaspar closed this Mar 2, 2021
@ericgaspar ericgaspar deleted the swap branch March 2, 2021 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants