From 08818db9168b73182fbd10352bb618b9f42e15c0 Mon Sep 17 00:00:00 2001 From: AJ Jordan Date: Sun, 13 Oct 2024 16:33:53 -0400 Subject: [PATCH] Fix seagl-setup-app crashing with no args --- bin/seagl-setup-app | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/bin/seagl-setup-app b/bin/seagl-setup-app index 7ee23ef..6830942 100755 --- a/bin/seagl-setup-app +++ b/bin/seagl-setup-app @@ -3,6 +3,10 @@ set -euo pipefail set -x +# XXX this doesn't work if the user actually *explicitly* passes empty string, i.e. +# seagl-setup-app '' +arg="${1-empty string}" + if [ $(id -u) == 0 ]; then echo fatal: cannot be run as root >&2 exit 1 @@ -19,15 +23,15 @@ function start_and_link_app() { nohup gio launch $desktop_file_full >/dev/null 2>&1 } -if [ $1 == obs ]; then +if [ "$arg" == obs ]; then # TODO provision RTMP keys start_and_link_app com.obsproject.Studio -elif [ $1 == nextcloud ]; then +elif [ "$arg" == nextcloud ]; then nextcloud --userid 2024laptops --apppassword "$(jq .nextcloudAppPassword < /var/lib/seagl/config-data.json)" --isvfsenabled 0 --serverurl 'https://cloud.seagl.org/' start_and_link_app com.nextcloud.desktopclient.nextcloud -elif [ $1 == firefox ]; then +elif [ "$arg" == firefox ]; then sudo sed -i "s;AV_TEST_RESULTS_PLACEHOLDER;$(jq .avTestResultsSheetURL < /var/lib/seagl/config-data.json);" /etc/firefox/policies/policies.json start_and_link_app org.mozilla.firefox else - echo fatal: application to be set up must be one of obs, nextcloud, firefox + echo fatal: application to be set up must be one of obs, nextcloud, firefox, but received $arg fi