From b9eecab00d2f971e6c795aaa3b9bc9b32b37023d Mon Sep 17 00:00:00 2001 From: Ark74 Date: Tue, 21 Nov 2023 02:03:59 -0600 Subject: [PATCH 1/2] excalidraw-backend.sh: update string for match test and add restart services function. --- excalidraw-backend.sh | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/excalidraw-backend.sh b/excalidraw-backend.sh index ccef625..2245bbb 100644 --- a/excalidraw-backend.sh +++ b/excalidraw-backend.sh @@ -26,6 +26,22 @@ printwc "${Blue}" "\n#--------------------------------------------------" printwc "${Blue}" "\n# $1" printwc "${Blue}" "\n#--------------------------------------------------\n" } +restart_jibri() { +if [ "$(dpkg-query -W -f='${Status}' "jibri" 2>/dev/null | grep -c "ok installed")" == "1" ] +then + systemctl restart jibri + systemctl restart jibri-icewm + systemctl restart jibri-xorg +else + echo "Jibri service not installed" +fi +} +restart_services() { + systemctl restart jitsi-videobridge2 + systemctl restart jicofo + restart_jibri + systemctl restart prosody +} while getopts m: option do @@ -61,7 +77,7 @@ WS_MATCH1='# ensure all static content can always be found first' PROS_MATCH1='"av_moderation";' PROS_MATCH2='breakout_rooms_muc = "breakout.' PROS_MATCH3='VirtualHost "recorder.' -CONFIG_MATCH1='Settings for the GIPHY integration' +CONFIG_MATCH1='List of undocumented settings used in jitsi-meet' EXCALIDRAW_HOME="/opt/excalidraw" EXCAL_MATCH1="prometheus.metrics(io" EXCAL_NEW_PORT="9091" @@ -100,14 +116,14 @@ sudo -u excalidraw cp .env.development .env.production # Use documented port to get some sort of standarization. if sed -n "/$EXCAL_MATCH1/,/});/p" "$EXCAL_PORT_FILE" |grep -q port: ; then - echo "> Update predefined port for metrics to $EXCAL_NEW_PORT\n" + echo -e "> Update predefined port for metrics to $EXCAL_NEW_PORT\n" sed -i "/$EXCAL_MATCH1/,/});/s|port:.*,|port: $EXCAL_NEW_PORT,|" "$EXCAL_PORT_FILE" else - echo "> Define new port from default to $EXCAL_NEW_PORT\n" + echo -e "> Define new port from default to $EXCAL_NEW_PORT\n" sed -i "/$EXCAL_MATCH1/a \ \ \ \ port: $EXCAL_NEW_PORT," "$EXCAL_PORT_FILE" fi -printf "\nInstalling npm backend.\n" +printf "Installing npm backend.\n" sudo -u excalidraw npm install sudo -u excalidraw npm run build @@ -191,3 +207,4 @@ systemctl enable excalidraw.service systemctl start excalidraw.service printwc "${Green}" "\nExcalidraw setup complete!\n" +restart_services From b7e81a04992a7848867d85e546a0856599ce022f Mon Sep 17 00:00:00 2001 From: Ark74 Date: Tue, 21 Nov 2023 02:15:49 -0600 Subject: [PATCH 2/2] excalidraw-backend.sh: move function to its place and fix printf use. --- excalidraw-backend.sh | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/excalidraw-backend.sh b/excalidraw-backend.sh index 2245bbb..505b8fe 100644 --- a/excalidraw-backend.sh +++ b/excalidraw-backend.sh @@ -42,6 +42,15 @@ restart_services() { restart_jibri systemctl restart prosody } +test_match() { +if grep -q "$1" "$2" ; then + echo "$(basename "$2") - OK..." +else + echo "$(basename "$2"), FAIL..." + echo "Please report this to https://forge.switnet.net/switnet/quick-jibri-installer" + exit +fi +} while getopts m: option do @@ -83,17 +92,6 @@ EXCAL_MATCH1="prometheus.metrics(io" EXCAL_NEW_PORT="9091" EXCAL_PORT_FILE="$EXCALIDRAW_HOME/backend/src/index.ts" - -# Test for matches -test_match() { -if grep -q "$1" "$2" ; then - echo "$(basename "$2") - OK..." -else - echo "$(basename "$2"), FAIL..." - echo "Please report this to https://forge.switnet.net/switnet/quick-jibri-installer" - exit -fi -} # Make sure we can rely on the match strings. printf "Testing match strings on config files.\n" test_match "$WS_MATCH1" "$WS_CONF" @@ -158,7 +156,7 @@ else sed -i "/$PROS_MATCH3/i \\\n" "$PROSODY_FILE" fi -printf "\n# Checking for whitebord setup at $(basename "$MEET_CONF").\n" +printf "\n# Checking for whitebord setup at %s.\n" "$(basename "$MEET_CONF")" if [ -z "$(sed -n '/whiteboard: {/,/},/p' "$MEET_CONF")" ]; then echo "> No present configuration on current config.js file" sed -i "/$CONFIG_MATCH1/i \\\n" "$MEET_CONF"