Skip to content

Commit

Permalink
Use correct raspi-config command for bookworm (#2450)
Browse files Browse the repository at this point in the history
* use correct raspi-config command for bookworm

* simplify _get_boot_file_path

* fix path

* revert last commit

* merge fixes

* merge fixes

---------

Co-authored-by: Alvin Schiller <[email protected]>
  • Loading branch information
s-martin and AlvinSchiller authored Nov 7, 2024
1 parent 32798da commit bdc1a23
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 13 deletions.
43 changes: 31 additions & 12 deletions installation/includes/02_helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,23 +75,42 @@ get_architecture() {
echo $arch
}

_get_boot_file_path() {
local filename="$1"
is_debian_based() {
local os_release_id=$( . /etc/os-release; printf '%s\n' "$ID"; )
if [[ "$os_release_id" == *"raspbian"* ]] || [[ "$os_release_id" == *"debian"* ]]; then
echo true
else
echo false
fi
}

_get_debian_version_number() {
if [ "$(is_debian_based)" = true ]; then
local debian_version_number=$( . /etc/os-release; printf '%s\n' "$VERSION_ID"; )
echo "$debian_version_number"
else
echo "-1"
fi
}

# Bullseye and lower
if [ "$debian_version_number" -le 11 ]; then
echo "/boot/${filename}"
# Bookworm and higher
elif [ "$debian_version_number" -ge 12 ]; then
echo "/boot/firmware/${filename}"
else
echo "unknown"
fi
is_debian_version_at_least() {
local expected_version=$1
local debian_version_number=$(get_debian_version_number)

if [ "$debian_version_number" -ge "$expected_version" ]; then
echo true
else
echo false
fi
}

_get_boot_file_path() {
local filename="$1"
local is_debian_version_number_at_least_12=$(is_debian_version_at_least 12)
if [ "$(is_debian_version_number_at_least_12)" = true ]; then
echo "/boot/firmware/${filename}"
else
echo "unknown"
echo "/boot/${filename}"
fi
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
#!/usr/bin/env bash

source ../../../../../../installation/includes/02_helpers.sh

echo "Entering setup.inc.sh"

echo "Disabling login shell to be accessible over serial"
sudo raspi-config nonint do_serial 1

if [ "$(is_debian_version_at_least 12)" = true ]; then
sudo raspi-config nonint do_serial_hw 1
sudo raspi-config nonint do_serial_cons 1
else
sudo raspi-config nonint do_serial 1
end

echo "Enabling serial port hardware"
sudo raspi-config nonint set_config_var enable_uart 1 /boot/config.txt
Expand Down

0 comments on commit bdc1a23

Please sign in to comment.