1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/photoprism_ynh.git synced 2024-09-03 19:56:41 +02:00

Using gitlab method

This commit is contained in:
Limezy 2022-06-06 00:59:22 +07:00
parent c3a45d636a
commit 99c2834465
2 changed files with 15 additions and 25 deletions

View file

@ -62,15 +62,22 @@ ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=language --value=$language_key
#=================================================
# ADDING SWAP IF NEEDED
# ADD SWAP IF NEEDED
#=================================================
if [ $(ynh_get_ram -t) -lt "2000" ]; then
ynh_script_progression --message="Adding swap to help building Photoprism..." --time --weight=1
ynh_add_swap --size=1000
swapFlag=true
else
swapFlag=false
total_memory=$(ynh_get_ram --total)
swap_needed=0
# Need at least 2Go of RAM
if [ $total_memory -lt 2048 ]; then
swap_needed=$((2048 - total_memory))
fi
if [ $swap_needed -gt 0 ]; then
ynh_script_progression --message="Adding $swap_needed Mo to swap..."
if ! ynh_add_swap --size=$swap_needed; then
ynh_print_warn --message="Please add $swap_needed Mo to swap to make Photoprism work properly"
fi
fi
#=================================================
@ -164,15 +171,6 @@ pushd "$final_path"
ynh_secure_remove --file="$final_path/go"
popd
#=================================================
# REMOVING SWAP IF NEEDED
#=================================================
if [ "$swapFlag" == true ]; then
ynh_del_swap 2>&1
ynh_script_progression --message="Removing swap..." --time --weight=1
fi
#=================================================
# CREATE DATA DIRECTORY
#=================================================

View file

@ -45,17 +45,9 @@ ynh_add_swap () {
local swap_size=0
fi
echo $swap_size
echo $()
# If there's enough space for a swap, and no existing swap here
if [[ $swap_size -ne 0 ]] && [[ ! -e /swap_$app ]]
if [ $swap_size -ne 0 ] && [ ! -e /swap_$app ]
then
# Create file
truncate -s 0 /swap_$app
# set the No_COW attribute on the swapfile with chattr
#chattr +C /swap_$app
# Preallocate space for the swap file, fallocate may sometime not be used, use dd instead in this case
if ! fallocate -l ${swap_size}K /swap_$app
then