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]
|
# [packagingv1]
|
||||||
#
|
#
|
||||||
ynh_del_swap () {
|
ynh_del_swap () {
|
||||||
# If there a swap at this place
|
# Could be moved to an argument
|
||||||
if [ -e /swap_file ]
|
swapfile_dir="$(realpath /)"
|
||||||
then
|
swapfile_path="$(realpath "$swapfile_dir/swap_file")"
|
||||||
# Clean the fstab
|
|
||||||
sed -i "/#Swap added by YunoHost config panel/d" /etc/fstab
|
if [ ! -f "$swapfile_path" ]; then
|
||||||
# Desactive the swap file
|
return
|
||||||
swapoff /swap_file
|
|
||||||
# And remove it
|
|
||||||
rm /swap_file
|
|
||||||
fi
|
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
|
# Check if the device of the provided directory is an SD card
|
||||||
|
|
Loading…
Add table
Reference in a new issue