Skip to content

Commit f72a86d

Browse files
authored
Detect parrot OS as asset.family debian (#6126)
It's debian with a pile of packages added on top. This will give is package and service support that currently do not work Signed-off-by: Tim Smith <tsmith84@gmail.com>
1 parent 4bfa60d commit f72a86d

File tree

3 files changed

+48
-1
lines changed

3 files changed

+48
-1
lines changed

providers/os/detector/detector_all.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,17 @@ var zorin = &PlatformResolver{
212212
},
213213
}
214214

215+
var parrot = &PlatformResolver{
216+
Name: "parrot",
217+
IsFamily: false,
218+
Detect: func(r *PlatformResolver, pf *inventory.Platform, conn shared.Connection) (bool, error) {
219+
if pf.Name == "parrot" {
220+
return true, nil
221+
}
222+
return false, nil
223+
},
224+
}
225+
215226
var raspbian = &PlatformResolver{
216227
Name: "raspbian",
217228
IsFamily: false,
@@ -983,7 +994,7 @@ var redhatFamily = &PlatformResolver{
983994
var debianFamily = &PlatformResolver{
984995
Name: "debian",
985996
IsFamily: true,
986-
Children: []*PlatformResolver{mxlinux, debian, ubuntu, raspbian, kali, linuxmint, popos, elementary, zorin},
997+
Children: []*PlatformResolver{mxlinux, debian, ubuntu, raspbian, kali, linuxmint, popos, elementary, zorin, parrot},
987998
Detect: func(r *PlatformResolver, pf *inventory.Platform, conn shared.Connection) (bool, error) {
988999
return true, nil
9891000
},

providers/os/detector/detector_platform_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -955,6 +955,17 @@ func TestZorinLinuxDetector(t *testing.T) {
955955
assert.Equal(t, []string{"debian", "linux", "unix", "os"}, di.Family)
956956
}
957957

958+
func TestParrotLinuxDetector(t *testing.T) {
959+
di, err := detectPlatformFromMock("./testdata/detect-parrot.toml")
960+
assert.Nil(t, err, "was able to create the provider")
961+
962+
assert.Equal(t, "parrot", di.Name, "os name should be identified")
963+
assert.Equal(t, "Parrot OS 5.3 (Electro Ara)", di.Title, "os title should be identified")
964+
assert.Equal(t, "5.3", di.Version, "os version should be identified")
965+
assert.Equal(t, "x86_64", di.Arch, "os arch should be identified")
966+
assert.Equal(t, []string{"debian", "linux", "unix", "os"}, di.Family)
967+
}
968+
958969
func TestSteamOSDetector(t *testing.T) {
959970
di, err := detectPlatformFromMock("./testdata/detect-steamos.toml")
960971
assert.Nil(t, err, "was able to create the provider")
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[commands."uname -s"]
2+
stdout = "Linux"
3+
4+
[commands."uname -m"]
5+
stdout = "x86_64"
6+
7+
[commands."uname -r"]
8+
stdout = "6.1.0-1parrot1-amd64"
9+
10+
[files."/etc/os-release"]
11+
content = """
12+
PRETTY_NAME="Parrot OS 5.3 (Electro Ara)"
13+
NAME="Parrot OS"
14+
VERSION_ID="5.3"
15+
VERSION="5.3 (Electro Ara)"
16+
VERSION_CODENAME=ara
17+
ID=parrot
18+
ID_LIKE=debian
19+
HOME_URL="https://www.parrotsec.org/"
20+
SUPPORT_URL="https://community.parrotsec.org/"
21+
BUG_REPORT_URL="https://community.parrotsec.org/"
22+
"""
23+
24+
[files."/etc/debian_version"]
25+
content = "parrot"

0 commit comments

Comments
 (0)