From cf343490bc3ca463099c46b796c578980c3f7730 Mon Sep 17 00:00:00 2001 From: Josue-T Date: Mon, 27 Feb 2017 08:16:42 +0100 Subject: [PATCH 1/6] Update synapse * Add check_process * Solve error with custom certificat * Add link to chattroom --- README.md | 3 +++ scripts/_common.sh | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6c90a02..7f3a2de 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ Synapse for YunoHost ================== +Yunohost chattroom with matrix : [https://riot.im/app/#/room/#yunohost:matrix.org](https://riot.im/app/#/room/#yunohost:matrix.org) + +[Yunohost project](https://yunohost.org/#/) ## For ARM arch (or slow arch) diff --git a/scripts/_common.sh b/scripts/_common.sh index 8c45ee6..cb93e0e 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -77,7 +77,6 @@ do then sudo test -d "$path_to_set" && sudo setfacl -m user:$user:rx "$path_to_set" sudo test -f "$path_to_set" && sudo setfacl -m user:$user:r "$path_to_set" - sudo test -L "$path_to_set" && sudo setfacl -m user:$user:r "$path_to_set" fi fi done From 16db82770f987c65d22c672728172e7abd9ba452 Mon Sep 17 00:00:00 2001 From: Josue-T Date: Tue, 7 Mar 2017 15:53:52 +0100 Subject: [PATCH 2/6] Use new findport fonction (#6) --- scripts/_common.sh | 32 ++++++++++++-------------------- scripts/install | 10 ++++------ scripts/restore | 24 ------------------------ 3 files changed, 16 insertions(+), 50 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index cb93e0e..bb70f55 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -102,20 +102,6 @@ CHECK_VAR () { # Vérifie que la variable n'est pas vide. test -n "$1" || (echo "$2" >&2 && false) } -# Ignore the yunohost-cli log to prevent errors with conditionals commands -# usage: NO_LOG COMMAND -# Simply duplicate the log, execute the yunohost command and replace the log without the result of this command -# It's a very badly hack... -# Petite copie perso à mon usage ;) -NO_LOG() { - ynh_cli_log=/var/log/yunohost/yunohost-cli.log - sudo cp -a ${ynh_cli_log} ${ynh_cli_log}-move - eval $@ - exit_code=$? - sudo mv ${ynh_cli_log}-move ${ynh_cli_log} - return $? -} - CHECK_PATH () { # Vérifie la présence du / en début de path. Et son absence à la fin. if [ "${path:0:1}" != "/" ]; then # Si le premier caractère n'est pas un / path="/$path" # Ajoute un / en début de path @@ -138,16 +124,22 @@ CHECK_FINALPATH () { # Vérifie que le dossier de destination n'est pas déjà u fi } -FIND_PORT () { # Cherche un port libre. -# $1 = Numéro de port pour débuter la recherche. +# 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 - while ! sudo yunohost app checkport $port ; do - 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 - CHECK_VAR "$port" "port empty" + echo $port } - ### REMOVE SCRIPT REMOVE_NGINX_CONF () { # Suppression de la configuration nginx diff --git a/scripts/install b/scripts/install index 7f674cd..56e9687 100644 --- a/scripts/install +++ b/scripts/install @@ -16,12 +16,10 @@ CHECK_DOMAINPATH # Vérifie la disponibilité du path et du domaine. CHECK_FINALPATH # Vérifie que le dossier de destination n'est pas déjà utilisé. # Ouvre le port dans le firewall -NO_LOG FIND_PORT 8448 # Cherche un port libre. -synapse_tls_port=$port -NO_LOG FIND_PORT 8008 # Cherche un port libre. -synapse_port=$port -NO_LOG FIND_PORT 5349 # Cherche un port libre. -turnserver_tls_port=$port +synapse_tls_port=$(ynh_find_port 8448) +synapse_port=$(ynh_find_port 8008) +turnserver_tls_port=$(ynh_find_port 5349) + sudo yunohost firewall allow --no-upnp TCP $synapse_tls_port > /dev/null 2>&1 sudo yunohost firewall allow --no-upnp Both $turnserver_tls_port > /dev/null 2>&1 diff --git a/scripts/restore b/scripts/restore index a979e43..6db3805 100644 --- a/scripts/restore +++ b/scripts/restore @@ -111,20 +111,6 @@ CHECK_VAR () { # Vérifie que la variable n'est pas vide. test -n "$1" || (echo "$2" >&2 && false) } -# Ignore the yunohost-cli log to prevent errors with conditionals commands -# usage: NO_LOG COMMAND -# Simply duplicate the log, execute the yunohost command and replace the log without the result of this command -# It's a very badly hack... -# Petite copie perso à mon usage ;) -NO_LOG() { - ynh_cli_log=/var/log/yunohost/yunohost-cli.log - sudo cp -a ${ynh_cli_log} ${ynh_cli_log}-move - eval $@ - exit_code=$? - sudo mv ${ynh_cli_log}-move ${ynh_cli_log} - return $? -} - CHECK_PATH () { # Vérifie la présence du / en début de path. Et son absence à la fin. if [ "${path:0:1}" != "/" ]; then # Si le premier caractère n'est pas un / path="/$path" # Ajoute un / en début de path @@ -147,16 +133,6 @@ CHECK_FINALPATH () { # Vérifie que le dossier de destination n'est pas déjà u fi } -FIND_PORT () { # Cherche un port libre. -# $1 = Numéro de port pour débuter la recherche. - port=$1 - while ! sudo yunohost app checkport $port ; do - port=$((port+1)) - done - CHECK_VAR "$port" "port empty" -} - - ### REMOVE SCRIPT REMOVE_NGINX_CONF () { # Suppression de la configuration nginx From aade7199b088d2047f81832a21708123b0c91eb1 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Fri, 17 Mar 2017 21:02:57 +0100 Subject: [PATCH 3/6] Update check_process (#7) --- check_process | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/check_process b/check_process index 7c8ac68..b7b9e12 100644 --- a/check_process +++ b/check_process @@ -3,12 +3,13 @@ # Commentaire ignoré ; Manifest domain="$DOMAIN" (DOMAIN) + path="/_matrix" (PATH) is_public=1 (PUBLIC|public=1|private=0) ; Checks pkg_linter=1 setup_sub_dir=1 setup_root=0 - setup_nourl=1 + setup_nourl=0 setup_private=1 setup_public=1 upgrade=1 @@ -31,4 +32,4 @@ Level 7=auto Level 8=0 Level 9=0 - Level 10=0 \ No newline at end of file + Level 10=0 From ee559884c244e59850097e9dca1f58a260604e34 Mon Sep 17 00:00:00 2001 From: Josue-T Date: Fri, 17 Mar 2017 23:23:09 +0100 Subject: [PATCH 4/6] Solve Issue : https://github.com/YunoHost-Apps/synapse_ynh/issues/4 (#8) * Use new findport fonction * Solve problem about Source --- scripts/_common.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index bb70f55..e760d4f 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,5 +1,6 @@ #!/bin/bash +debian_repos="http://httpredir.debian.org/debian/" md5sum_python_nacl="34c44f8f5100170bae3b4329ffb43087" md5sum_python_ujson="5b65f8cb6bedef7971fdc557e09effbe" python_nacl_version="1.0.1-2" @@ -30,8 +31,8 @@ init_script() { install_arm_package_dep() { - wget -q -O '/tmp/python-nacl.deb' "http://ftp.ch.debian.org/debian/pool/main/p/python-nacl/python-nacl_${python_nacl_version}_armhf.deb" - wget -q -O '/tmp/python-ujson.deb' "http://ftp.ch.debian.org/debian/pool/main/u/ujson/python-ujson_${python_ujson_version}_armhf.deb" + wget -q -O '/tmp/python-nacl.deb' "${debian_repos}pool/main/p/python-nacl/python-nacl_${python_nacl_version}_armhf.deb" + wget -q -O '/tmp/python-ujson.deb' "${debian_repos}pool/main/u/ujson/python-ujson_${python_ujson_version}_armhf.deb" if ([[ ! -e '/tmp/python-nacl.deb' ]] || [[ $(md5sum '/tmp/python-nacl.deb' | cut -d' ' -f1) != $md5sum_python_nacl ]]) || \ ([[ ! -e '/tmp/python-ujson.deb' ]] || [[ $(md5sum '/tmp/python-ujson.deb' | cut -d' ' -f1) != $md5sum_python_ujson ]]) @@ -52,7 +53,10 @@ GET_DEBIAN_VERSION() { enable_backport_repos() { if [[ -z "$(grep -e "^deb .*/.* $debian_version-backports main" /etc/apt/sources.list ; grep -e "^deb .*/.* $debian_version-backports main" /etc/apt/sources.list.d/*.list)" ]] then - echo "deb $(grep -m 1 "^deb .* $debian_version .*main" /etc/apt/sources.list | cut -d ' ' -f2) $debian_version-backports main contrib non-free" | sudo tee -a "/etc/apt/sources.list" + debian_repos_url=$(grep -m 1 "^deb .* $debian_version .*main" /etc/apt/sources.list | cut -d ' ' -f2) + test -z "$(echo $debian_repos_url | grep '://')" && debian_repos_url="$debian_repos" + + echo "deb $debian_repos_url $debian_version-backports main contrib non-free" | sudo tee -a "/etc/apt/sources.list" fi ynh_package_update } From c04b2f959bf40329fe93a955c442d08cf56d39dc Mon Sep 17 00:00:00 2001 From: Josue-T Date: Sun, 19 Mar 2017 10:30:09 +0100 Subject: [PATCH 5/6] Don't check interface --- check_process | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/check_process b/check_process index b7b9e12..e0e79c3 100644 --- a/check_process +++ b/check_process @@ -7,9 +7,9 @@ is_public=1 (PUBLIC|public=1|private=0) ; Checks pkg_linter=1 - setup_sub_dir=1 + setup_sub_dir=0 setup_root=0 - setup_nourl=0 + setup_nourl=1 setup_private=1 setup_public=1 upgrade=1 From cdfef91d893ceadb2fccbb48c9443c0fad82317c Mon Sep 17 00:00:00 2001 From: JocelynDelalande Date: Tue, 21 Mar 2017 09:55:00 +0100 Subject: [PATCH 6/6] fix typo (#9) --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 426ccbf..4b7ba78 100644 --- a/manifest.json +++ b/manifest.json @@ -36,7 +36,7 @@ "type": "boolean", "ask": { "en": "Is it a public server ?", - "fr": "Est-ce un serveur publique ?" + "fr": "Est-ce un serveur public ?" }, "default": "0" }