mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
helpers: rewrite ynh_del_swap with a variable swap file location.
This commit is contained in:
parent
2aa14345fe
commit
0e90430419
1 changed files with 13 additions and 9 deletions
|
@ -190,16 +190,20 @@ ynh_add_swap () {
|
|||
# [packagingv1]
|
||||
#
|
||||
ynh_del_swap () {
|
||||
# If there a swap at this place
|
||||
if [ -e /swap_file ]
|
||||
then
|
||||
# Clean the fstab
|
||||
sed -i "/#Swap added by YunoHost config panel/d" /etc/fstab
|
||||
# Desactive the swap file
|
||||
swapoff /swap_file
|
||||
# And remove it
|
||||
rm /swap_file
|
||||
# Could be moved to an argument
|
||||
swapfile_dir="$(realpath /)"
|
||||
swapfile_path="$(realpath "$swapfile_dir/swap_file")"
|
||||
|
||||
if [ ! -f "$swapfile_path" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# Clean the fstab...
|
||||
sed -i "/#Swap added by $app/d" /etc/fstab
|
||||
# Desactive the swap file...
|
||||
swapoff "$swapfile_path"
|
||||
# And remove it.
|
||||
rm "$swapfile_path"
|
||||
}
|
||||
|
||||
# Check if the device of the provided directory is an SD card
|
||||
|
|
Loading…
Add table
Reference in a new issue