From 114fd1cfe701425c8b5f363e06a790981901eb40 Mon Sep 17 00:00:00 2001 From: wipedlifepotato Date: Mon, 31 Jul 2023 22:18:34 +0700 Subject: [PATCH] LSB Release instead uname if we can --- dependencies.sh | 59 +++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 50 insertions(+), 9 deletions(-) diff --git a/dependencies.sh b/dependencies.sh index 2b2b7d6..d44f3dd 100755 --- a/dependencies.sh +++ b/dependencies.sh @@ -14,14 +14,55 @@ dependWin="mingw-w64-x86_64-boost \ mingw-w64-x86_64-zlib" kernel=`uname -a` +function isLsbReleaseExists() { + if which lsb_release > /dev/null; # do whereis can be too? + then + return 0 + else + return 1 + fi +} -case "$kernel" in -*Ubuntu*|*Debian*) - sudo apt install $dependNix;; -*gentoo*) - sudo emerge --deep --newuse dev-libs/boost dev-libs/openssl;; -*MINGW64*) - pacman -S $dependWin;; -*) - echo "Just install libboost and libopenssl dev packages on your pc";; +function anotherDistr(){ + echo "Just install libboost and libopenssl dev packages on your pc"; + return 0 +} + +function installDeb(){ + sudo apt-get install $dependNix; + return 0 +} +function installOnGentoo(){ + sudo emerge --deep --newuse dev-libs/boost dev-libs/openssl; + return 0 +} +function installOnWin() { + pacman -S $depenWin; + return 0 +} + +function doInstallDepencies() { +case "$1" in + *Ubuntu*|*Debian*) + installDeb + ;; + *gentoo*) + installOnGentoo + ;; + *MINGW64*) + installOnWin + ;; + *) + anotherDistr + ;; esac +} + +if isLsbReleaseExists ; +then + distr=`lsb_release -i` + doInstallDepencies "$distr" +else # + doInstallDepencies "$kernel" +fi +