mirror of
https://github.com/YunoHost-Apps/duniter_ynh.git
synced 2024-09-03 18:26:35 +02:00
Revert "[enh] Add ynh_find_port helper"
This reverts commit 03feb876a2
.
This commit is contained in:
parent
2ef0c293b3
commit
3960ca8e79
2 changed files with 4 additions and 18 deletions
|
@ -56,20 +56,3 @@ fi
|
||||||
# Remove Duniter package
|
# Remove Duniter package
|
||||||
sudo dpkg -r duniter
|
sudo dpkg -r duniter
|
||||||
}
|
}
|
||||||
|
|
||||||
# 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
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,10 @@ sudo yunohost app checkurl "${domain}${path}" -a "$app" \
|
||||||
|| ynh_die "Path not available: ${domain}${path}"
|
|| ynh_die "Path not available: ${domain}${path}"
|
||||||
|
|
||||||
# Check port availability
|
# Check port availability
|
||||||
port=$(ynh_find_port $port)
|
sudo yunohost app checkport $port
|
||||||
|
if [[ ! $? -eq 0 ]]; then
|
||||||
|
ynh_die "Port not available: ${port}"
|
||||||
|
fi
|
||||||
|
|
||||||
# Check node availability
|
# Check node availability
|
||||||
if curl --output /dev/null --silent --head --fail "$sync_node:$sync_port/node/summary"; then
|
if curl --output /dev/null --silent --head --fail "$sync_node:$sync_port/node/summary"; then
|
||||||
|
|
Loading…
Add table
Reference in a new issue