mirror of
https://github.com/YunoHost-Apps/lufi_ynh.git
synced 2024-09-03 19:36:28 +02:00
Merge pull request #16 from magikcypress/master
Fix bug for this issue #15
This commit is contained in:
commit
6129ae6ca0
7 changed files with 27 additions and 25 deletions
|
@ -15,7 +15,7 @@
|
|||
setup_public=1
|
||||
upgrade=1
|
||||
backup_restore=1
|
||||
multi_instance=1
|
||||
multi_instance=0
|
||||
wrong_user=1
|
||||
wrong_path=1
|
||||
incorrect_path=1
|
||||
|
|
|
@ -70,7 +70,7 @@ SETUP_SOURCE () { # Download source, decompress and copu into $final_path
|
|||
src=$(cat ../sources/source_md5 | awk -F' ' {'print $2'})
|
||||
sudo wget -nv -i ../sources/source_url -O $src
|
||||
# Checks the checksum of the downloaded source.
|
||||
# md5sum -c ../sources/source_md5 --status || ynh_die "Corrupt source"
|
||||
md5sum -c ../sources/source_md5 --status || ynh_die "Corrupt source"
|
||||
# Decompress source
|
||||
if [ "$(echo ${src##*.})" == "tgz" ]; then
|
||||
tar -x -f $src
|
||||
|
@ -108,25 +108,6 @@ CHECK_MD5_CONFIG () { # Created a backup of the config file if it was changed.
|
|||
fi
|
||||
}
|
||||
|
||||
FIND_PORT () { # Search free port
|
||||
if [ YNH_VERSION = "2.5" ]; then
|
||||
# $1 = Port number to start the search.
|
||||
port=$1
|
||||
while ! sudo yunohost app checkport $port ; do
|
||||
port=$((port+1))
|
||||
done
|
||||
CHECK_VAR "$port" "port empty"
|
||||
else
|
||||
# $1 = Port number to start the search.
|
||||
port=$1
|
||||
if [ "$(sudo yunohost tools port-available $port)" = "True" ]; then
|
||||
port=$((port+1))
|
||||
fi
|
||||
CHECK_VAR "$port" "port empty"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
### REMOVE SCRIPT
|
||||
|
||||
REMOVE_NGINX_CONF () { # Delete nginx configuration
|
||||
|
@ -179,6 +160,22 @@ REMOVE_SYS_USER () { # Delete user
|
|||
fi
|
||||
}
|
||||
|
||||
# Find a free port and return it
|
||||
#
|
||||
# example: port=$(ynh_find_port 8080)
|
||||
#
|
||||
# usage: ynh_find_port begin_port
|
||||
# | arg: begin_port - port to start to search
|
||||
ynh_find_port () {
|
||||
port=$1
|
||||
test -n "$port" || ynh_die "The argument of ynh_find_port must be a valid port."
|
||||
while netcat -z 127.0.0.1 $port # Check if the port is free
|
||||
do
|
||||
port=$((port+1)) # Else, pass to next port
|
||||
done
|
||||
echo $port
|
||||
}
|
||||
|
||||
#=================================================
|
||||
# BACKUP
|
||||
#=================================================
|
||||
|
|
|
@ -38,7 +38,7 @@ CHECK_FINALPATH # Check final path
|
|||
domain_regex=$(echo "$domain" | sed 's@-@.@g')
|
||||
CHECK_VAR "$domain_regex" "domain_regex empty"
|
||||
|
||||
FIND_PORT 8095 # Check port availability
|
||||
port=$(ynh_find_port 8096) # Check port availability
|
||||
|
||||
# Save app settings
|
||||
ynh_app_setting_set $app admin $admin
|
||||
|
|
|
@ -3,6 +3,11 @@
|
|||
# Exit on command errors and treat unset variables as an error
|
||||
set -u
|
||||
|
||||
if [ ! -e .fonctions ]; then
|
||||
# Get file fonction if not been to the current directory
|
||||
sudo cp ../settings/scripts/.fonctions ./.fonctions
|
||||
sudo chmod a+rx .fonctions
|
||||
fi
|
||||
source .fonctions # Loads the generic functions usually used in the script
|
||||
source /usr/share/yunohost/helpers # Source app helpers
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
lufi-master-7db7688bc1e8bbe206f6717c98ece78d6e6a05fe
|
||||
lufi-67dba4bf918abba65bcfc25be04f0c3fcb166d0f-67dba4bf918abba65bcfc25be04f0c3fcb166d0f
|
|
@ -1 +1 @@
|
|||
97091eb255f4b3389fd52e36b7860c1e lufi.zip
|
||||
81ef9862cc7ebb245f68e0dd5fd8eebc lufi.zip
|
|
@ -1 +1 @@
|
|||
https://framagit.org/luc/lufi/repository/archive.zip?ref=master
|
||||
https://framagit.org/luc/lufi/repository/archive.zip?ref=67dba4bf918abba65bcfc25be04f0c3fcb166d0f
|
Loading…
Reference in a new issue