-
-
Notifications
You must be signed in to change notification settings - Fork 498
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
DietPi System Preparation | Add sysctl config values to our own .conf file #1247
Conversation
MichaIng
commented
Nov 20, 2017
- Generally we should try to add our values into our own files, if a '*.d/' folder exists. This enables package updates to overwrite the unchanged main .conf without overwriting our values.
- I chose "97-" prefix here as "99-" is used by systemd and "98-" by RPi raspberrypi-sys-mods.
- We could also check for/sed existing vm.swappiness entries, but I guess '/*.d' entries will overwrite anyway?
… file - Generally we should try to add our values into our own files, if a '*.d/' folder exists. This enables package updates to overwrite the unchanged main .conf without overwriting our values. - I chose "97-" prefix here as "99-" is used by systemd and "98-" by RPi raspberrypi-sys-mods. - We could also check for/sed existing vm.swappiness entries, but I guess '/*.d' entries will overwrite anyway?
...especially since we introduce "/sysctl.d/97-dietpi.conf" for our own adjustments.
PREP_SYSTEM_FOR_DIETPI.sh
Outdated
@@ -333,7 +333,7 @@ systemctl mask apt-daily.service | |||
systemctl mask apt-daily-upgrade.timer | |||
|
|||
#/etc/sysctl.conf | Check for a previous entry before adding this | |||
echo -e "vm.swappiness=1" >> /etc/sysctl.conf | |||
echo -e "vm.swappiness=1" >> /etc/sysctl.d/97-dietpi.conf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we use >
here, it will overwrite the file with the entry. >>
will append to end of existing file, if it exists (multiple entries if command used again with >>
, not with >
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh important point, thus > is necessary here, or touch filename first, if we add something earlier/optional.
Agree 👍
https://github.com/Fourdee/DietPi/pull/1247/files#r152038845 |
Yes, as we create and and just set this value so far, no check necessary. We could just check the other config files if some other package/default sets it also. I am not sure about priorities, if it is set multiple times in different configs, could run some checks about this later. |
@Fourdee But I will leave the |