Skip to content

Commit c602003

Browse files
committed
Better way to detect the linux distibution #136
1 parent 8332369 commit c602003

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

usr/local/sbin/easyengine

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
LOGDIR=/var/log/easyengine
55
ERRORLOG=/var/log/easyengine/error.log
66
INSTALLLOG=/var/log/easyengine/install.log
7+
LINUX_DISTRO=$(lsb_release -i | cut -d':' -f2 | awk '{print $1}')
78

89
# Main EasyEngine Function To Log All The Outputs
910
EasyEngine()
@@ -53,14 +54,14 @@ PYTHONSOFTWARE()
5354

5455
NGINXREPO()
5556
{
56-
if [ -f /etc/lsb-release ]
57+
if [ "$LINUX_DISTRO" == "Ubuntu" ]
5758
then
5859
# Add Nginx Launchpad Repository
5960
echo -e "\033[34mAdding Brianmercer Nginx Launchpad Repository, Please Wait...\e[0m"
6061
add-apt-repository -y ppa:brianmercer/nginx &>> $INSTALLLOG \
6162
|| OwnError "Unable To Add Nginx Launchpad Repository"
6263

63-
elif [ -f /etc/debian_version ]
64+
elif [ "$LINUX_DISTRO" == "Debian" ]
6465
then
6566
# Add Nginx DotDeb Repository
6667
echo -e "\033[34mAdding Nginx DotDeb Repository, Please Wait...\e[0m"
@@ -75,14 +76,14 @@ NGINXREPO()
7576

7677
PHPREPO()
7778
{
78-
if [ -f /etc/lsb-release ]
79+
if [ "$LINUX_DISTRO" == "Ubuntu" ]
7980
then
8081
# Add PHP Launchpad Repository
8182
echo -e "\033[34mAdding Ondrej PHP5 Launchpad Repository, Please Wait...\e[0m"
8283
add-apt-repository -y ppa:ondrej/php5 &>> $INSTALLLOG \
8384
|| OwnError "Unable To Add PHP5 Launchpad Repository"
8485

85-
elif [ -f /etc/debian_version ]
86+
elif [ "$LINUX_DISTRO" == "Debian" ]
8687
then
8788
# Detect Debian Version To Select PHP Repo
8889
DEBIAN_VERSION=$(lsb_release -r | awk '{print($2)}' | cut -d'.' -f1)

0 commit comments

Comments
 (0)