forked from open-edge-platform/edge-ai-suites
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.sh
More file actions
63 lines (52 loc) · 1.86 KB
/
init.sh
File metadata and controls
63 lines (52 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
SOURCE="src"
CHART="chart"
if [ ! -f "${SOURCE}/secrets/browser.auth" ]; then
bash ${SOURCE}/secrets/generate_secrets.sh
fi
if [ ! -f .env ]; then
touch .env
fi
USER_UID=$(stat -c '%u' "${SOURCE}"/* | sort -rn | head -1)
USER_GID=$(stat -c '%g' "${SOURCE}"/* | sort -rn | head -1)
echo "UID=$USER_UID" > .env
echo "GID=$USER_GID" >> .env
if [ ! -d "${SOURCE}/dlstreamer-pipeline-server/videos" ] || [ -z "$(find "${SOURCE}/dlstreamer-pipeline-server/videos" -type f -name "*.ts" 2>/dev/null)" ]; then
VIDEO_BRANCH="main"
VIDEO_URL="https://github.com/open-edge-platform/edge-ai-resources/raw/refs/heads/${VIDEO_BRANCH}/videos"
VIDEOS=("1122east_h264.ts" "1122west_h264.ts" "1122north_h264.ts" "1122south_h264.ts")
VIDEO_DIR="${SOURCE}/dlstreamer-pipeline-server/videos"
mkdir -p "${VIDEO_DIR}"
echo "Downloading videos in parallel..."
for VIDEO in "${VIDEOS[@]}"; do
curl -k -L -s "${VIDEO_URL}/${VIDEO}" -o "${VIDEO_DIR}/${VIDEO}" &
done
# # Dummy download to potentially improve bandwidth allocation
# curl -k -L -s "${VIDEO_URL}/LICENSE" -o "${VIDEO_DIR}/LICENSE" &
wait
for VIDEO in "${VIDEOS[@]}"; do
if [ ! -f "${VIDEO_DIR}/${VIDEO}" ]; then
echo "Error: Failed to download ${VIDEO}"
exit 1
fi
done
fi
# Copy files to chart
mkdir -p ${CHART}/files
mkdir -p ${CHART}/files/dlstreamer-pipeline-server/user_scripts/gvapython/sscape
mkdir -p ${CHART}/files/webserver
cp -r \
${SOURCE}/controller \
${SOURCE}/grafana \
${SOURCE}/mosquitto \
${SOURCE}/node-red \
${CHART}/files
cp -r \
${SOURCE}/dlstreamer-pipeline-server/user_scripts \
${CHART}/files/dlstreamer-pipeline-server
cp \
${SOURCE}/dlstreamer-pipeline-server/config.json \
${CHART}/files/dlstreamer-pipeline-server/config.json
cp \
${SOURCE}/webserver/user_access_config.json \
${CHART}/files/webserver/user_access_config.json