@@ -54,6 +54,8 @@ motion:
5454 - RPi.GPIO
5555 unix:
5656 - wiringpi
57+ additional:
58+ - "https://www.example.com/motion_install.md"
5759` ` `
5860
5961# ## Modified `install.sh` Script
@@ -62,6 +64,7 @@ The install script below:
62641. Parses `python` and `unix` dependencies from each module's YAML file.
63652. Installs Unix dependencies with `apt-get install` and Python dependencies with `pip install`.
64663. Uses a **Python helper** embedded within the script to read YAML files (using `pyyaml`).
67+ 4. Outputs a summary of installed modules and dependencies. This includes any additional URLs for manual configuration.
6568
6669Here’s the modified `install.sh` script :
6770
@@ -72,9 +75,10 @@ Here’s the modified `install.sh` script:
7275python3 -m venv --system-site-packages myenv
7376source myenv/bin/activate
7477
75- # Initialize arrays for dependencies and active module names
78+ # Initialize arrays for dependencies and additional setup URLs
7679PYTHON_DEPENDENCIES=()
7780UNIX_DEPENDENCIES=()
81+ ADDITIONAL_URLS=()
7882ACTIVE_MODULES=()
7983
8084# Helper function to parse dependencies from YAML files using Python
@@ -87,20 +91,21 @@ module_name = os.path.basename(config_file).replace('.yml', '') # Get the modul
8791try:
8892 with open(config_file) as f:
8993 config = yaml.safe_load(f)
90- # Check if the top level of the config is a dictionary to avoid AttributeError
9194 if isinstance(config, dict):
9295 for section in config.values():
93- # Check if module is active before parsing dependencies
94- if isinstance(section, dict) and section.get('enabled') is True :
96+ # Ensure each section has 'enabled' set to true and ' dependencies' exists
97+ if isinstance(section, dict) and section.get('enabled', False) and 'dependencies' in section :
9598 print(f"MODULE:{module_name}")
96- if 'dependencies' in section:
97- for dep_type, deps in section['dependencies'].items():
98- if dep_type == 'python':
99- for dep in deps:
100- print(f"PYTHON:{dep}")
101- elif dep_type == 'unix':
102- for dep in deps:
103- print(f"UNIX:{dep}")
99+ for dep_type, deps in section['dependencies'].items():
100+ if dep_type == 'python':
101+ for dep in deps:
102+ print(f"PYTHON:{dep}")
103+ elif dep_type == 'unix':
104+ for dep in deps:
105+ print(f"UNIX:{dep}")
106+ elif dep_type == 'additional':
107+ for url in deps:
108+ print(f"ADDITIONAL:{module_name}:{url}")
104109except yaml.YAMLError as e:
105110 print(f"Error reading {config_file}: {e}", file=sys.stderr)
106111EOF
@@ -116,6 +121,8 @@ for config_file in config/*.yml; do
116121 PYTHON_DEPENDENCIES+=("${dependency#PYTHON:}")
117122 elif [[ $dependency == UNIX:* ]]; then
118123 UNIX_DEPENDENCIES+=("${dependency#UNIX:}")
124+ elif [[ $dependency == ADDITIONAL:* ]]; then
125+ ADDITIONAL_URLS+=("${dependency#ADDITIONAL:}")
119126 fi
120127 done < <(parse_dependencies "$config_file")
121128done
@@ -124,19 +131,20 @@ done
124131UNIQUE_PYTHON_DEPENDENCIES=($(echo "${PYTHON_DEPENDENCIES[@]}" | tr ' ' '\n ' | sort -u | tr '\n ' ' '))
125132UNIQUE_UNIX_DEPENDENCIES=($(echo "${UNIX_DEPENDENCIES[@]}" | tr ' ' '\n ' | sort -u | tr '\n ' ' '))
126133UNIQUE_ACTIVE_MODULES=($(echo "${ACTIVE_MODULES[@]}" | tr ' ' '\n ' | sort -u | tr '\n ' ' '))
134+ UNIQUE_ADDITIONAL_URLS=($(echo "${ADDITIONAL_URLS[@]}" | tr ' ' '\n ' | sort -u | tr '\n ' ' '))
127135
128- # Update apt-get and install Unix dependencies
129- if [ ${#UNIQUE_UNIX_DEPENDENCIES[@]} -ne 0 ]; then
130- sudo apt-get update
131- for dep in "${UNIQUE_UNIX_DEPENDENCIES[@]}"; do
132- sudo apt-get install -y "$dep"
133- done
134- fi
136+ # # Update apt-get and install Unix dependencies
137+ # if [ ${#UNIQUE_UNIX_DEPENDENCIES[@]} -ne 0 ]; then
138+ # sudo apt-get update
139+ # for dep in "${UNIQUE_UNIX_DEPENDENCIES[@]}"; do
140+ # sudo apt-get install -y "$dep"
141+ # done
142+ # fi
135143
136- # Install Python dependencies explicitly using the virtual environment's pip
137- for dep in "${UNIQUE_PYTHON_DEPENDENCIES[@]}"; do
138- myenv/bin/python3 -m pip install "$dep"
139- done
144+ # # Install Python dependencies explicitly using the virtual environment's pip
145+ # for dep in "${UNIQUE_PYTHON_DEPENDENCIES[@]}"; do
146+ # myenv/bin/python3 -m pip install "$dep"
147+ # done
140148
141149# Set execute permissions for additional scripts
142150chmod 777 startup.sh stop.sh
@@ -157,8 +165,14 @@ echo -e "\nUnix dependencies installed:"
157165for dep in "${UNIQUE_UNIX_DEPENDENCIES[@]}"; do
158166 echo " - $dep"
159167done
160- echo "============================="
161168
169+ if [ ${#UNIQUE_ADDITIONAL_URLS[@]} -ne 0 ]; then
170+ echo -e "\n ACTION REQUIRED: Additional manual configuration required for the following modules:"
171+ for dep in "${UNIQUE_ADDITIONAL_URLS[@]}"; do
172+ echo " - $dep"
173+ done
174+ fi
175+ echo "============================="
162176` ` `
163177
164178# ## Explanation of Changes
@@ -194,7 +208,7 @@ Remember, only **active modules** will have their dependencies installed.
194208
195209` ` ` plaintext
196210==== Installation Summary ====
197- Active modules installed: 12
211+ Active modules installed: 13
198212 - animate
199213 - braillespeak
200214 - buzzer
@@ -206,21 +220,26 @@ Active modules installed: 12
206220 - servos
207221 - tracking
208222 - translator
223+ - universalremote
209224 - vision
210225
211226Python dependencies installed:
212227 - adafruit-circuitpython-seesaw
213228 - googletrans==3.1.0a0
214229 - gpiozero
230+ - lirc
215231 - pigpio
232+ - pubsub
216233 - pypubsub
217234 - python3-munkres
218235 - python3-opencv
219236
220237Unix dependencies installed:
221238 - imx500-all
222- =============================
223- ` ` `
239+ - lirc
240+
241+ ACTION REQUIRED: Additional manual configuration required for the following modules:
242+ - motion:https://www.example.com/motion_install.md
224243
225244## Read More
226245
0 commit comments