From 605cc4f5d56ee58b8f03b7e756fe27b84108e1c3 Mon Sep 17 00:00:00 2001 From: Stephan Wendel Date: Wed, 2 Mar 2022 19:42:17 +0100 Subject: [PATCH 1/2] fix(update): version of apps were not checked nor updated Implemented Version Check and proper update function. Signed-off-by: Stephan Wendel --- tools/update.sh | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/tools/update.sh b/tools/update.sh index d84cca8..125af4a 100755 --- a/tools/update.sh +++ b/tools/update.sh @@ -14,6 +14,7 @@ BASE_USER=$(whoami) TITLE="crowsnest - A Webcam Daemon for Raspberry Pi OS" + ### Non root if [ ${UID} == '0' ]; then echo -e "DO NOT RUN THIS SCRIPT AS ROOT!\nExiting..." @@ -271,10 +272,47 @@ function build_apps { make all popd > /dev/null || exit 1 else - echo -e "All Apps are present ... [skipped]" + echo -e "All Apps are present ... [OK]" + update_ustreamer + update_rtsp fi } +function update_ustreamer { + local sm_version us_version + sm_version="$(cd bin/ustreamer && git describe --always --tags | sed 's/^v//')" + us_version="$(bin/ustreamer/ustreamer -v)" + echo -en "Checking ustreamer Version ${sm_version} ... \r" + if [ "${sm_version}" == "${us_version}" ]; then + echo -e "Checking ustreamer Version ${us_version} ... [SKIPPED]" + echo -e "\t==> Version match, no update needed." + else + echo -e "Checking ustreamer Version ${sm_version} ... [UPDATE]" + echo -e "\t==> Version (${us_version}) mismatch, update needed." + pushd bin/ &> /dev/null || exit 1 + make ustreamer + popd &> /dev/null || exit 1 + echo -e "Ustreamer Update ... [OK]" + fi +} + +function update_rtsp { + local dl_version rtsp_version + dl_version="$(cat bin/rtsp-simple-server/version)" + rtsp_version="$(bin/rtsp-simple-server/rtsp-simple-server --version)" + echo -en "Checking rtsp-simple-server Version ... \r" + if [ "${dl_version}" == "${rtsp_version}" ]; then + echo -e "Checking rtsp-simple-server Version ${dl_version} ... [SKIPPED]" + echo -e "\t==> Version match, no update needed." + else + echo -e "Checking rtsp-simple-server Version ... [UPDATE]" + echo -e "\t==> Version (${rtsp_version}) mismatch, update needed." + pushd bin/ &> /dev/null || exit 1 + make rtsp + popd &> /dev/null || exit 1 + echo -e "rtsp-simple-server Update ... [OK]" + fi +} #### MAIN From 4170a25b640fe03ba1fe0c0c1c4451d693023092 Mon Sep 17 00:00:00 2001 From: Stephan Wendel Date: Wed, 2 Mar 2022 19:45:42 +0100 Subject: [PATCH 2/2] chore(update): removed message if RTSPtoWebRTC is not installed To prettify output if uninstall is not needed. Signed-off-by: Stephan Wendel --- tools/update.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/tools/update.sh b/tools/update.sh index 125af4a..d096163 100755 --- a/tools/update.sh +++ b/tools/update.sh @@ -241,9 +241,6 @@ function uninstall_rtsp2webrtc { echo -e "Removing RTSPtoWebRTC ..." sudo rm -rf "${HOME}/crowsnest/bin/RTSPtoWebRTC" echo -e "Removing RTSPtoWebRTC ... [OK]" - else - echo -e "Removing RTSPtoWebRTC ... [SKIPPED]" - echo -e "RTSPtoWebRTC not installed ..." fi }