-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
63 lines (47 loc) · 1.95 KB
/
entrypoint.sh
File metadata and controls
63 lines (47 loc) · 1.95 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
# Omada Controller entrypoint for Home Assistant (no-AVX version)
# This is a modified version of mbentley's entrypoint with AVX check disabled
set -e
# ======================================
# Home Assistant specific preprocessing
# ======================================
echo "INFO: [HA Add-on] Setting up directories..."
mkdir -p "/data/logs"
if [ ! -d /data/data ]; then
echo "INFO: [HA Add-on] /data/data created from docker image backup"
cp -r /opt/tplink/EAPController/data_backup /data/data
directories=(db keystore pdf)
for dir in "${directories[@]}"; do
if [ -d "/data/$dir" ]; then
cp -r /data/$dir "/data/data/"
rm -rf /data/$dir
echo "INFO: [HA Add-on] Migrated /data/$dir to /data/data/$dir"
fi
done
fi
chown -R 508:508 "/data"
export ROOTLESS=false
# ======================================
# Override check_cpu_features BEFORE sourcing mbentley script
# This works because we define it as a function that will be
# called later, not executed immediately
# ======================================
# First, source the mbentley script but prevent execution
# by temporarily redefining the main entry point check
# Save original args
ORIGINAL_ARGS=("$@")
# The mbentley script checks ROOTLESS at the end to decide which main to run
# We need to intercept this. Let's use a different approach:
# Create a wrapper that sources mbentley but skips the final execution
# Temporarily disable the final if block by making ROOTLESS undefined during source
# Actually, let's just patch the script inline
# Create a modified version of the entrypoint
sed 's/^check_cpu_features$/check_cpu_features_disabled/' /mbentley/entrypoint.sh > /tmp/mbentley_modified.sh
echo '
check_cpu_features() {
echo "INFO: Skipping AVX/CPU feature check - using MongoDB compiled without AVX requirements"
}
' >> /tmp/mbentley_modified.sh
# Now source and run
source /tmp/mbentley_modified.sh
# The script should have executed main_root or main_rootless