Skip to content

Commit 027554f

Browse files
authored
Merge pull request #86 from swampdogmash/patch-12
Fix inconsistent MAJOR_VERSION detection of OS
2 parents b3d82b1 + 3362a7c commit 027554f

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

  • agents/plugins

agents/plugins/yum

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ CACHE_PREV_UPTIME=$MK_VARDIR/cache/yum_uptime.cache
1414
LAST_UPDATE_TIMESTAMP=-1
1515

1616
# Check which major version we are running so we can run appropriate commands
17-
MAJOR_VERSION=$(grep -oP '(?<=^VERSION_ID=").*(?=")' /etc/os-release | cut -d '.' -f 1)
17+
if [ -f "/etc/os-release" ]; then
18+
MAJOR_VERSION=$(grep -oP '(?<=^VERSION_ID=").*(?=")' /etc/os-release | cut -d '.' -f 1)
19+
else
20+
MAJOR_VERSION=0
21+
fi
1822

1923
# get current yum state - use cache directory contents as fingerprint
2024
YUM_CURRENT="$(ls -lR /var/cache/{yum,dnf}/ 2>/dev/null)"

0 commit comments

Comments
 (0)