Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: pin streaming backends to specific commits #216

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
# Changelog
All notable changes to Crowsnest will be documented in this file.

## [4.1.5](https://github.com/mainsail-crew/crowsnest/releases/tag/v4.1.5) - 2024-02-28
### Bug Fixes and Improvements

- Fix ustreamer binary path for v5.52 changes ([#245](https://github.com/mainsail-crew/crowsnest/pull/245))

## [4.1.4](https://github.com/mainsail-crew/crowsnest/releases/tag/v4.1.4) - 2024-02-17
### Bug Fixes and Improvements

Expand Down
50 changes: 48 additions & 2 deletions bin/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ set -Ee
# Base Path
BASE_CN_BIN_PATH="$(dirname "$(readlink -f "${0}")")"

. "${BASE_CN_BIN_PATH%%/bin}/resources/backend_versions.txt"

# Clone Flags
CLONE_FLAGS=(--depth=1 --single-branch)
CLONE_FLAGS=(--single-branch)

# Ustreamer repo
USTREAMER_PATH="ustreamer"
Expand All @@ -54,6 +56,34 @@ ALL_PATHS=(
"${BASE_CN_BIN_PATH}"/"${CSTREAMER_PATH}"
)

### Messages
error_msg_build() {
printf "Something went wrong!\nPlease copy the latest output, head over to\n"
printf "\thttps://discord.gg/mainsail\n"
printf "and open a ticket in #supportforum..."
}

status_msg_build() {
local msg status
msg="${1}"
status="${2}"
printf "%s\r" "${msg}"
if [[ "${status}" == "0" ]]; then
printf "%s [\e[32mOK\e[0m]\n" "${msg}"
fi
if [[ "${status}" == "1" ]]; then
printf "%s [\e[31mFAILED\e[0m]\n" "${msg}"
error_msg_build
exit 1
fi
if [[ "${status}" == "2" ]]; then
printf "%s [\e[33mSKIPPED\e[0m]\n" "${msg}"
fi
if [[ "${status}" == "3" ]]; then
printf "%s [\e[33mFAILED\e[0m]\n" "${msg}"
fi
}

# Helper messages
show_help() {
printf "Usage %s [options]\n" "$(basename "${0}")"
Expand Down Expand Up @@ -124,10 +154,16 @@ clone_ustreamer() {
printf "%s already exist ... [SKIPPED]\n" "${USTREAMER_PATH}"
return
fi

printf "\nCloning ustreamer ...\n"
git clone "${CROWSNEST_USTREAMER_REPO_SHIP}" \
-b "${CROWSNEST_USTREAMER_REPO_BRANCH}" \
"${BASE_CN_BIN_PATH}"/"${USTREAMER_PATH}" \
"${CLONE_FLAGS[@]}"

printf "\nReset to specified ustreamer commit ...\n"
git -C "${BASE_CN_BIN_PATH}"/"${USTREAMER_PATH}" \
reset --hard "${CROWSNEST_USTREAMER_REPO_COMMIT}"
}

### Clone camera-streamer
Expand All @@ -141,19 +177,29 @@ clone_cstreamer() {
printf "Device is not supported! Cloning camera-streamer ... [SKIPPED]\n"
return
fi

if [[ -d "${BASE_CN_BIN_PATH}"/"${CSTREAMER_PATH}" ]]; then
printf "%s already exist ... [SKIPPED]\n" "${CSTREAMER_PATH}"
return
fi

CROWSNEST_CAMERA_STREAMER_REPO_COMMIT="${CROWSNEST_CAMERA_STREAMER_REPO_COMMIT_MASTER}"
if [[ "$(is_bookworm)" = "1" ]]; then
printf "\nBookworm detected!\n"
printf "Using main branch of camera-streamer for Bookworm ...\n\n"
printf "Using main branch of camera-streamer for Bookworm ...\n"
CROWSNEST_CAMERA_STREAMER_REPO_BRANCH="main"
CROWSNEST_CAMERA_STREAMER_REPO_COMMIT="${CROWSNEST_CAMERA_STREAMER_REPO_COMMIT_MAIN}"
fi

printf "\nCloning camera-streamer ...\n"
git clone "${CROWSNEST_CAMERA_STREAMER_REPO_SHIP}" \
-b "${CROWSNEST_CAMERA_STREAMER_REPO_BRANCH}" \
"${BASE_CN_BIN_PATH}"/"${CSTREAMER_PATH}" \
"${CLONE_FLAGS[@]}" --recurse-submodules --shallow-submodules

printf "\nReset to specified camera-streamer commit ...\n"
git -C "${BASE_CN_BIN_PATH}"/"${CSTREAMER_PATH}" \
reset --hard "${CROWSNEST_CAMERA_STREAMER_REPO_COMMIT}"
}

### Clone Apps
Expand Down
12 changes: 12 additions & 0 deletions resources/backend_versions.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#### crowsnest - A webcam Service for multiple Cams and Stream Services.
####
#### Written by Patrick Gehrsitz aka mryel00 <[email protected]>
#### Copyright 2023 - till today
#### https://github.com/mainsail-crew/crowsnest
####
#### This File is distributed under GPLv3
####

CROWSNEST_USTREAMER_REPO_COMMIT="81756811f3c925174f05300a9301bb722b9cbfb5"
CROWSNEST_CAMERA_STREAMER_REPO_COMMIT_MASTER="fe701b83da35598af4fc1d77c717c8a67cac9edd"
CROWSNEST_CAMERA_STREAMER_REPO_COMMIT_MAIN="bc231917d811e4a6661fc0b01b3e3750c6babd59"
12 changes: 2 additions & 10 deletions tools/libs/build_apps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,7 @@ clone_cstreamer() {
}

build_apps() {
msg "Build dependend Stream Apps ..."
msg "Cloning ustreamer repository ..."
clone_ustreamer
## Detect Image build for Raspberrys
if [[ "${CN_INSTALL_CS}" = "1" ]]; then
msg "Cloning camera-streamer repository ..."
clone_cstreamer
else
msg "Install of camera-streamer skipped, only supported on Raspberry SBC's! ... "
fi
export CN_INSTALL_CS
sudo -E -u "${BASE_USER}" "${PWD}"/bin/build.sh --reclone
sudo -u "${BASE_USER}" "${PWD}"/bin/build.sh --build
}
Loading