Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions raspinfo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
!.gitignore
raspinfo
37 changes: 36 additions & 1 deletion raspinfo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
26 changes: 11 additions & 15 deletions raspinfo/raspinfo → raspinfo/raspinfo.in
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -198,7 +200,7 @@ network_info() {
fi
done
else
echo "ethtool not installed"
echo "@ETHTOOL_NOTFOUND_MSG@"
fi
}

Expand All @@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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