package distro
import "github.com/purpleidea/mgmt/util/distro"
Package distro is for utilities that deal with os/distro things. Best to keep these all in one place so that adding this data happens all in the same file.
Index ¶
- Constants
- Variables
- func Distro(ctx context.Context) (string, error)
- func Family(ctx context.Context) (string, error)
- func IsDistroArchLinux(ctx context.Context) (bool, error)
- func IsDistroDebian(ctx context.Context) (bool, error)
- func IsDistroFedora(ctx context.Context) (bool, error)
- func IsFamilyArchLinux(ctx context.Context) (bool, error)
- func IsFamilyDebian(ctx context.Context) (bool, error)
- func IsFamilyRedHat(ctx context.Context) (bool, error)
- func ToBootstrapPackages(distro string) ([]string, bool)
- func ToGuestfsPackages(distro string) ([]string, bool)
Constants ¶
const ( // FamilyRedHat represents distros like Fedora and RHEL. FamilyRedHat = "redhat" // FamilyDebian represents distros like Debian and Ubuntu. FamilyDebian = "debian" // FamilyArchLinux represents primarily ArchLinux. FamilyArchLinux = "archlinux" // DistroDebian is the Debian distro. DistroDebian = "debian" // DistroFedora is the Fedora distro. DistroFedora = "fedora" )
Variables ¶
var ( // MapDistroToBootstrapPackages is a map of distro to packages needed to // run our software. MapDistroToBootstrapPackages = map[string][]string{ DistroDebian: { "libaugeas-dev", "libvirt-dev", "packagekit-tools", }, DistroFedora: { "augeas-devel", "libvirt-devel", "PackageKit", }, } // MapDistroToGuestfsPackages is a map of distro to packages needed to // run the virt-builder software and guestfs suite. MapDistroToGuestfsPackages = map[string][]string{ DistroDebian: { "guestfs-tools", }, DistroFedora: { "guestfs-tools", }, } )
Functions ¶
func Distro ¶
Distro returns the distro name.
func Family ¶
Family returns the distro family.
func IsDistroArchLinux ¶
IsDistroArchLinux detects if the os distro is archlinux.
func IsDistroDebian ¶
IsDistroDebian detects if the os distro is debian. (Not ubuntu!)
func IsDistroFedora ¶
IsDistroFedora detects if the os distro is fedora.
func IsFamilyArchLinux ¶
IsFamilyArchLinux detects if the os family is archlinux.
func IsFamilyDebian ¶
IsFamilyDebian detects if the os family is debian.
func IsFamilyRedHat ¶
IsFamilyRedHat detects if the os family is redhat.
func ToBootstrapPackages ¶
ToBootstrapPackages returns the list of packages corresponding to the distro for bootstrapping. This returns false if the value doesn't exist.
func ToGuestfsPackages ¶
ToGuestfsPackages returns the list of packages corresponding to the distro for running the virt-builder software and guestfs suite. This returns false if the value doesn't exist.
Source Files ¶
- Version
- v0.0.0-20250322185616-c50a578426f1 (latest)
- Published
- Mar 22, 2025
- Platform
- linux/amd64
- Imports
- 3 packages
- Last checked
- 4 days ago –
Tools for package owners.