Skip to content

Commit

Permalink
Check files exist before reading them.
Browse files Browse the repository at this point in the history
  • Loading branch information
digininja authored Mar 15, 2022
1 parent b214b59 commit 9304479
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions Python/setup/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,22 @@ if [[ `(lsb_release -sd || grep ^PRETTY_NAME /etc/os-release) 2>/dev/null | grep
osinfo="Parrot"
fi

if [[ `cat /etc/issue | cut -d" " -f3 | head -n1 | grep "Alpine"` ]]; then
osinfo="Alpine"
if [ -f /etc/issue ];
then
if [[ `cat /etc/issue | cut -d" " -f3 | head -n1 | grep "Alpine"` ]]; then
osinfo="Alpine"
fi
fi

if [[ `cat /etc/redhat-release | grep "CentOS Linux release 7\.[0-9]\.[0-9]\+ (Core)"` ]]; then
osinfo="CentOS7"
fi
if [ -f /etc/redhat-release ];
then
if [[ `cat /etc/redhat-release | grep "CentOS Linux release 7\.[0-9]\.[0-9]\+ (Core)"` ]]; then
osinfo="CentOS7"
fi

if [[ `cat /etc/redhat-release | grep "Rocky Linux release 8\.[0-9]"` ]]; then
osinfo="RockyLinux8"
if [[ `cat /etc/redhat-release | grep "Rocky Linux release 8\.[0-9]"` ]]; then
osinfo="RockyLinux8"
fi
fi

# make sure we run from this directory
Expand Down

0 comments on commit 9304479

Please sign in to comment.