Skip to content

Commit

Permalink
feat: add support for compute module devices (#2218)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicomiguelino authored Feb 28, 2025
1 parent f76bb72 commit 3be2771
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions bin/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,11 @@ function install_ansible() {
function set_device_type() {
if [ ! -f /proc/device-tree/model ] && [ "$(uname -m)" = "x86_64" ]; then
export DEVICE_TYPE="x86"
elif grep -qF "Raspberry Pi 5" /proc/device-tree/model; then
elif grep -qF "Raspberry Pi 5" /proc/device-tree/model || grep -qF "Compute Module 5" /proc/device-tree/model; then
export DEVICE_TYPE="pi5"
elif grep -qF "Raspberry Pi 4" /proc/device-tree/model; then
elif grep -qF "Raspberry Pi 4" /proc/device-tree/model || grep -qF "Compute Module 4" /proc/device-tree/model; then
export DEVICE_TYPE="pi4"
elif grep -qF "Raspberry Pi 3" /proc/device-tree/model; then
elif grep -qF "Raspberry Pi 3" /proc/device-tree/model || grep -qF "Compute Module 3" /proc/device-tree/model; then
export DEVICE_TYPE="pi3"
elif grep -qF "Raspberry Pi 2" /proc/device-tree/model; then
export DEVICE_TYPE="pi2"
Expand Down
6 changes: 3 additions & 3 deletions bin/upgrade_containers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ fi
# Detect Raspberry Pi version
if [ ! -f /proc/device-tree/model ] && [ "$(uname -m)" = "x86_64" ]; then
export DEVICE_TYPE="x86"
elif grep -qF "Raspberry Pi 5" /proc/device-tree/model; then
elif grep -qF "Raspberry Pi 5" /proc/device-tree/model || grep -qF "Compute Module 5" /proc/device-tree/model; then
export DEVICE_TYPE="pi5"
elif grep -qF "Raspberry Pi 4" /proc/device-tree/model; then
elif grep -qF "Raspberry Pi 4" /proc/device-tree/model || grep -qF "Compute Module 4" /proc/device-tree/model; then
if [ "$(getconf LONG_BIT)" = "64" ]; then
export DEVICE_TYPE="pi4-64"
else
export DEVICE_TYPE="pi4"
fi
elif grep -qF "Raspberry Pi 3" /proc/device-tree/model; then
elif grep -qF "Raspberry Pi 3" /proc/device-tree/model || grep -qF "Compute Module 3" /proc/device-tree/model; then
export DEVICE_TYPE="pi3"
elif grep -qF "Raspberry Pi 2" /proc/device-tree/model; then
export DEVICE_TYPE="pi2"
Expand Down
6 changes: 3 additions & 3 deletions lib/device_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ def get_device_type():
with open('/proc/device-tree/model') as file:
content = file.read()

if 'Raspberry Pi 5' in content:
if 'Raspberry Pi 5' in content or 'Compute Module 5' in content:
return 'pi5'
elif 'Raspberry Pi 4' in content:
elif 'Raspberry Pi 4' in content or 'Compute Module 4' in content:
return 'pi4'
elif 'Raspberry Pi 3' in content:
elif 'Raspberry Pi 3' in content or 'Compute Module 3' in content:
return 'pi3'
elif 'Raspberry Pi 2' in content:
return 'pi2'
Expand Down

0 comments on commit 3be2771

Please sign in to comment.