-
-
Notifications
You must be signed in to change notification settings - Fork 283
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement config panel for swap management
- Loading branch information
1 parent
06dc3da
commit a54ec11
Showing
4 changed files
with
160 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
. /usr/share/yunohost/helpers | ||
|
||
do_pre_regen() { | ||
} | ||
|
||
do_post_regen() { | ||
|
||
swapfile_enabled="$(yunohost settings get 'swap.swapfile.swapfile_enabled')" | ||
swapfile_size="$(yunohost settings get 'swap.swapfile.swapfile_size')" | ||
|
||
if [ "${swapfile_enabled}" == "True" ]; then | ||
# If a swapfile is requested | ||
if [ $(stat -c%s /swap_file) -ne $swapfile_size ]; then | ||
# Let's delete it first if it is not of the requested size | ||
ynh_del_swap | ||
fi | ||
# create the swapfile | ||
ynh_add_swap --size=$swapfile_size | ||
else | ||
# If not, make sure it is deleted | ||
ynh_del_swap | ||
fi | ||
} | ||
|
||
do_$1_regen ${@:2} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters