From 331461219387b733d7978171aa0947954ecedbe1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Floure?= Date: Sat, 11 Jul 2020 09:21:37 +0200 Subject: [PATCH] __matrix_riot: improve friendship with shellcheck --- type/__matrix_riot/files/config.json.sh | 2 +- type/__matrix_riot/gencode-remote | 4 ---- type/__matrix_riot/manifest | 9 ++++++--- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/type/__matrix_riot/files/config.json.sh b/type/__matrix_riot/files/config.json.sh index e7fca72..6cd1648 100755 --- a/type/__matrix_riot/files/config.json.sh +++ b/type/__matrix_riot/files/config.json.sh @@ -4,7 +4,7 @@ # https://github.com/vector-im/riot-web/blob/develop/docs/config.md generate_embedded_pages () { - if [ $EMBED_HOMEPAGE ]; then + if [ "$EMBED_HOMEPAGE" != "" ]; then cat << EOF "embeddedPages": { "homeUrl": "home.html" diff --git a/type/__matrix_riot/gencode-remote b/type/__matrix_riot/gencode-remote index 97c4777..dbc886c 100755 --- a/type/__matrix_riot/gencode-remote +++ b/type/__matrix_riot/gencode-remote @@ -24,10 +24,6 @@ OWNER=$(cat "$__object/parameter/owner") src="riot-v$VERSION" archive="$src.tar.gz" -config='config.json' -homepage='home.html' -welcomepage='welcome.html' -welcomelogo='welcome-logo.svg' url="https://github.com/vector-im/riot-web/releases/download/v$VERSION/$archive" # tar and curl are installed by the __matrix-riot manifest. mktemp is usually diff --git a/type/__matrix_riot/manifest b/type/__matrix_riot/manifest index a843f4b..544bd96 100755 --- a/type/__matrix_riot/manifest +++ b/type/__matrix_riot/manifest @@ -16,7 +16,10 @@ # # You should have received a copy of the GNU General Public License # along with cdist. If not, see . -# + +# Ignore "Declare and assign separately to avoid masking return values. [SC2155]" +# => not relevant for the type arguments. +# shellcheck disable=SC2155 INSTALL_DIR=$(cat "$__object/parameter/install_dir") @@ -51,8 +54,8 @@ if [ -f "$__object/parameter/welcomepage" ]; then fi if [ -f "$__object/parameter/custom_asset" ]; then - for file in $(cat "$__object/parameter/custom_asset"); do - require="__directory/$INSTALL_DIR/cdist" __file "$INSTALL_DIR/cdist/$(basename $file)" \ + "$__object/parameter/custom_asset" | while IFS= read -r file; do + require="__directory/$INSTALL_DIR/cdist" __file "$INSTALL_DIR/cdist/$(basename "$file")" \ --source "$file" \ --mode 0664 \ --state present