From 58f461aa9cdf5d5197e3cffa030b077e9b02c47b Mon Sep 17 00:00:00 2001 From: AshyPinguin Date: Fri, 12 Jun 2026 21:31:38 +0200 Subject: [PATCH 1/2] *: add distribution branding support Signed-off-by: AshyPinguin --- CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 90f56de..f190140 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,14 @@ project(utils) option(ENABLE_WERROR "Treat compiler warnings as errors" OFF) +# Customize binaries for specific distributions +set(KNOWN_DISTRIBUTIONS debian gentoo generic) +option(DISTRIBUTION "Enable distribution specific functions" debian) # debian is the base of raspberry pi os +if(NOT DISTRIBUTION IN_LIST KNOWN_DISTRIBUTIONS) + message(STATUS "specified distribution not known - assuming generic distribution") + set(DISTRIBUTION generic) +endif() + # List of subsidiary CMakeLists add_subdirectory(dtapply) add_subdirectory(dtmerge) From 72e125a82667345d6615913435ba4770a6fcc4ef Mon Sep 17 00:00:00 2001 From: AshyPinguin Date: Fri, 12 Jun 2026 21:32:46 +0200 Subject: [PATCH 2/2] raspinfo: add distribution specific stuff This mostly adds package notifications for Gentoo and makes the wording on the not found messages similar. It also makes it easier for a distribution to add their specific stuff. Signed-off-by: AshyPinguin --- raspinfo/.gitignore | 2 ++ raspinfo/CMakeLists.txt | 37 +++++++++++++++++++++++++++++- raspinfo/{raspinfo => raspinfo.in} | 26 +++++++++------------ 3 files changed, 49 insertions(+), 16 deletions(-) create mode 100644 raspinfo/.gitignore rename raspinfo/{raspinfo => raspinfo.in} (91%) mode change 100755 => 100644 diff --git a/raspinfo/.gitignore b/raspinfo/.gitignore new file mode 100644 index 0000000..6ea0149 --- /dev/null +++ b/raspinfo/.gitignore @@ -0,0 +1,2 @@ +!.gitignore +raspinfo diff --git a/raspinfo/CMakeLists.txt b/raspinfo/CMakeLists.txt index 3827f7e..1c04436 100644 --- a/raspinfo/CMakeLists.txt +++ b/raspinfo/CMakeLists.txt @@ -2,8 +2,43 @@ cmake_minimum_required(VERSION 3.10...3.27) include(GNUInstallDirs) +# Customize binaries for specific distributions +set(KNOWN_DISTRIBUTIONS debian gentoo generic) +option(DISTRIBUTION "Enable distribution specific functions" debian) # debian is the base of raspberry pi os +if(NOT DISTRIBUTION IN_LIST KNOWN_DISTRIBUTIONS) + message(STATUS "specified distribution not known - assuming generic distribution") +endif() + +#defaults +set(KMS_NOTFOUND_MSG "kmsprint is not found.") +set(PACTL_NOTFOUND_MSG "pactl is not found.") +set(ETHTOOL_NOTFOUND_MSG "ethtool is not found.") +set(PINCTRL_NOTFOUND_MSG "pinctrl/raspi-gpio is not found.") +set(VCDBG_NOTFOUND_MSG "vcdbg is not found.") +set(RPI_EEPROM_UPDATE_NOTFOUND_MSG "rpi-eeprom-update is not found.") + +set(PKG_VERSION_CMD "echo \"current distribution is unknown - please check your package manager's instructions to check versions of applications\"") + +if(DISTRIBUTION STREQUAL debian) + set(KMS_NOTFOUND_MSG "kmsprint is not found. It can be installed with: sudo apt install kms++-utils") + set(PKG_VERSION_CMD "apt-cache policy raspberrypi-ui-mods | head -2 +apt-cache policy raspberrypi-sys-mods | head -2 +apt-cache policy openbox | head -2 +apt-cache policy lxpanel | head -2 +apt-cache policy pcmanfm | head -2 +apt-cache policy rpd-plym-splash | head -2") +elseif(DISTRIBUTION STREQUAL gentoo) + set(PACTL_NOTFOUND_MSG "pactl is not found. It can be installed with media-libs/libpulse") + set(ETHTOOL_NOTFOUND_MSG "ethtool is not found. It can be installed with sys-apps/ethtool") + set(RPI_EEPROM_UPDATE_NOTFOUND_MSG "rpi-eeprom-update is not found. It can be installed with dev-embedded/rpi-eeprom") + set(PKG_VERSION_CMD "emerge --info dev-embedded/raspberrypi-utils::gentoo | grep --color=never -A 1 \"^dev-embedded/raspberrypi-utils\"") +endif() + #set project name project(raspinfo) +#configure executable +configure_file(raspinfo.in raspinfo @ONLY) + #add executables -install(PROGRAMS raspinfo DESTINATION ${CMAKE_INSTALL_BINDIR}) +install(PROGRAMS raspinfo DESTINATION ${CMAKE_INSTALL_BINDIR} PERMISSIONS WORLD_EXECUTE) diff --git a/raspinfo/raspinfo b/raspinfo/raspinfo.in old mode 100755 new mode 100644 similarity index 91% rename from raspinfo/raspinfo rename to raspinfo/raspinfo.in index f228d26..f25601a --- a/raspinfo/raspinfo +++ b/raspinfo/raspinfo.in @@ -17,7 +17,7 @@ display_info_drm() { echo kmsprint -p else - echo "kmsprint is not installed. Install with: sudo apt install kms++-utils" + echo "@KMS_NOTFOUND_MSG@" fi echo @@ -159,12 +159,14 @@ audio_info() { echo aplay -L echo - systemctl --user status pipewire.socket pipewire.service pulseaudio.service pulseaudio.socket + if command -v systemctl > /dev/null; then + systemctl --user status pipewire.socket pipewire.service pulseaudio.service pulseaudio.socket + fi echo if command -v pactl > /dev/null; then pactl info else - echo pactl not installed + echo "@PACTL_NOTFOUND_MSG@" fi } @@ -198,7 +200,7 @@ network_info() { fi done else - echo "ethtool not installed" + echo "@ETHTOOL_NOTFOUND_MSG@" fi } @@ -222,8 +224,7 @@ echo cat /etc/os-release | head -4 echo -cat /etc/rpi-issue -echo +cat /etc/rpi-issue 2> /dev/null && echo uname -a cat /proc/cpuinfo | tail -3 @@ -264,12 +265,7 @@ echo "Package version information" echo "---------------------------" echo -apt-cache policy raspberrypi-ui-mods | head -2 -apt-cache policy raspberrypi-sys-mods | head -2 -apt-cache policy openbox | head -2 -apt-cache policy lxpanel | head -2 -apt-cache policy pcmanfm | head -2 -apt-cache policy rpd-plym-splash | head -2 +@PKG_VERSION_CMD@ echo echo "Networking Information" @@ -326,7 +322,7 @@ if command -v pinctrl > /dev/null; then elif command -v raspi-gpio > /dev/null; then raspi-gpio get 2>&1 else - echo "pinctrl/raspi-gpio not found" + echo "@PINCTRL_NOTFOUND_MSG@" fi echo @@ -339,7 +335,7 @@ if command -v vcdbg > /dev/null; then elif command -v vclog > /dev/null; then sudo vclog --msg 2>&1 else - echo "vcdbg not found" + echo "@VCDBG_NOTFOUND_MSG@" fi echo @@ -358,6 +354,6 @@ then if command -v rpi-eeprom-update > /dev/null; then sudo rpi-eeprom-update else - echo "rpi-eeprom-update not found" + echo "@RPI_EEPROM_UPDATE_NOTFOUND_MSG@" fi fi