Best dietpi OS detection

I use SaltStack for configuration management and have a mixture of Linux distributions in my environment, including DietPi. I know DietPi is based on Debian 9+ and is reflected in the /etc/os-release file. Distribution detection is primarily in lines 2063-2179 in the Salt grains core, but os-release doesn’t actually mention DietPi, so is detected as Debian/Raspbian which isn’t 100% accurate.

My question is: what would be the recommended way of detecting that an installation is in fact DietPi? A couple options I considered:

  • Presence of /boot/dietpi/
  • Presence of /boot/dietpi.txt

Those will work but feel very hacky. Any recommendations?

DietPi is not an own OS or Debian destro. It’s a set of bash script on top of Debian/Raspbian. There you can’t use /etc/os-release to detect a running DietPi system. Best is to check for the availibility of our scripts or current DietPi version /boot/dietpi/.version

1 Like

That’s perfect! Thank you for the suggestion, and for the clarification, I always considered it its own distro.

Yeah we are build on existing Debian, Armbian or Raspbian images, doing some modifications to get it Diet and offer end-to-end automation. :grinning: