diff --git a/installation/includes/02_helpers.sh b/installation/includes/02_helpers.sh index 4fd373565..440e10b08 100644 --- a/installation/includes/02_helpers.sh +++ b/installation/includes/02_helpers.sh @@ -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 } diff --git a/src/jukebox/components/rfid/hardware/rdm6300_serial/setup.inc.sh b/src/jukebox/components/rfid/hardware/rdm6300_serial/setup.inc.sh index 364f07cd9..c9935c739 100755 --- a/src/jukebox/components/rfid/hardware/rdm6300_serial/setup.inc.sh +++ b/src/jukebox/components/rfid/hardware/rdm6300_serial/setup.inc.sh @@ -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