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

Fix LXC installation (fixes #41) #42

Open
wants to merge 2 commits into
base: testing
Choose a base branch
from
Open

Fix LXC installation (fixes #41) #42

wants to merge 2 commits into from

Conversation

JimboJoe
Copy link

Problem

  • LXC detection doesn't work and installation fails

Solution

  • Fix LXC detection

PR Status

  • Code finished and ready to be reviewed/tested
  • The fix/enhancement were manually tested (if applicable)

Automatic tests

Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ after creating the PR, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization)

@JimboJoe
Copy link
Author

!testme

@yunohost-bot
Copy link
Contributor

Alrighty!
Test Badge

@yunohost-bot
Copy link
Contributor

📚 🪱
Test Badge

Copy link
Collaborator

@fflorent fflorent left a comment

Choose a reason for hiding this comment

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

Mostly good to me. I suggested an improvement.

@@ -49,7 +49,7 @@ ynh_script_progression --message="Increasing maximum map count (sysctl)..."
# Increase the maximum number of files inotify can monitor.
cp -a ../conf/90-max_map_count-elasticsearch.conf /etc/sysctl.d/
# Then, reload the kernel configuration.
if ! [ "${container:-}" = "lxc" ] # lxc doesn't allow sysctl to play with kernel options.
if ! [ "$(systemd-detect-virt)" == "lxc" ] # lxc doesn't allow sysctl to play with kernel options.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are you sure that it works? I don't see the == operator in man test page.

Otherwise, I propose this change:

Suggested change
if ! [ "$(systemd-detect-virt)" == "lxc" ] # lxc doesn't allow sysctl to play with kernel options.
if [ "$(systemd-detect-virt)" != "lxc" ] # lxc doesn't allow sysctl to play with kernel options.

Which improves the readability.

Copy link
Author

Choose a reason for hiding this comment

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

Well, it worked for me, and I just reused what's been done in the mastodon app here

Copy link
Collaborator

Choose a reason for hiding this comment

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

Right, I see that indeed both = and == are equivalent:
https://stackoverflow.com/questions/20449543/shell-equality-operators-eq

@@ -31,7 +31,7 @@ ynh_remove_logrotate
if [ -e "/etc/sysctl.d/90-max_map_count-elasticsearch.conf" ]; then
ynh_secure_remove --file="/etc/sysctl.d/90-max_map_count-elasticsearch.conf"
# Reload the kernel configuration.
if ! [ "${container:-}" = "lxc" ] # lxc doesn't allow sysctl to play with kernel options.
if ! [ "$(systemd-detect-virt)" == "lxc" ] # lxc doesn't allow sysctl to play with kernel options.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if ! [ "$(systemd-detect-virt)" == "lxc" ] # lxc doesn't allow sysctl to play with kernel options.
if [ "$(systemd-detect-virt)" != "lxc" ] # lxc doesn't allow sysctl to play with kernel options.

@@ -37,7 +37,7 @@ chown -R $app:www-data "$data_dir"
ynh_script_progression --message="Restoring various files..." --weight=1

ynh_restore_file --origin_path="/etc/sysctl.d/90-max_map_count-elasticsearch.conf"
if ! [ "${container:-}" = "lxc" ] # lxc doesn't allow sysctl to play with kernel options.
if ! [ "$(systemd-detect-virt)" == "lxc" ] # lxc doesn't allow sysctl to play with kernel options.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if ! [ "$(systemd-detect-virt)" == "lxc" ] # lxc doesn't allow sysctl to play with kernel options.
if [ "$(systemd-detect-virt)" != "lxc" ] # lxc doesn't allow sysctl to play with kernel options.

@@ -65,7 +65,7 @@ ynh_script_progression --message="Increasing maximum map count (sysctl)..."
# Increase the maximum number of files inotify can monitor.
cp -a ../conf/90-max_map_count-elasticsearch.conf /etc/sysctl.d/
# Then, reload the kernel configuration.
if ! [ "${container:-}" = "lxc" ] # lxc doesn't allow sysctl to play with kernel options.
if ! [ "$(systemd-detect-virt)" == "lxc" ] # lxc doesn't allow sysctl to play with kernel options.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if ! [ "$(systemd-detect-virt)" == "lxc" ] # lxc doesn't allow sysctl to play with kernel options.
if [ "$(systemd-detect-virt)" != "lxc" ] # lxc doesn't allow sysctl to play with kernel options.

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.

3 participants