From 777dea9073d03853b58665e514ff1b6876bc685c Mon Sep 17 00:00:00 2001 From: Johannes Theiner Date: Mon, 28 Oct 2019 10:19:48 +0000 Subject: [PATCH] Cleanup Code, add missing directory changes --- checkout-dev.sh | 2 +- install.sh | 60 ++++++++++++++++--------------------------------- update.sh | 2 +- 3 files changed, 21 insertions(+), 43 deletions(-) diff --git a/checkout-dev.sh b/checkout-dev.sh index 901c2b7..0e72823 100644 --- a/checkout-dev.sh +++ b/checkout-dev.sh @@ -12,5 +12,5 @@ for d in */; do cd .. done -cd +cd installation ./build.sh \ No newline at end of file diff --git a/install.sh b/install.sh index a8b46c5..233e961 100755 --- a/install.sh +++ b/install.sh @@ -1,58 +1,36 @@ #!/bin/bash -debian=false; -arch=false; -mac=false; - # get operating system -os_info() { +install_packages() { declare -A osInfo; - osInfo[/etc/arch-release]=arch - osInfo[/etc/debian_version]=debian - osInfo[/usr/local/Homebrew]=mac + osInfo[/usr/bin/pacman]=pacman + osInfo[/usr/bin/apt]=apt + osInfo[/usr/local/Homebrew]=brew for f in ${!osInfo[@]} do if [[ -f $f ]];then - if [[ ${osInfo[$f]} == 'arch' ]]; then - arch=true; - elif [[ ${osInfo[$f]} == 'debian' ]]; then - debian=true; - elif [[ ${osInfo[$f]} == 'mac' ]]; then - mac=true; + if [[ ${osInfo[$f]} == 'pacman' ]]; then + pacman -S clang make cmake fltk catch2 + + elif [[ ${osInfo[$f]} == 'apt' ]]; then + apt install clang make cmake clang-tidy libfltk1.3 libfltk1.3-dev + + git clone https://github.com/catchorg/Catch2.git + cd Catch2 + cmake -Bbuild -H. -DBUILD_TESTING=OFF + sudo cmake --build build/ --target install + + elif [[ ${osInfo[$f]} == 'brew' ]]; then + brew install llvm clang make cmake clang-format fltk catch2 + fi fi done } -# installing package, $1 = pacman; $2 = apt-get, $3 = homebrew -install() { - if [ $debian == true ] && [ $2 != 'null' ]; then - sudo apt-get install $2 - elif [ $arch == true ] && [ $1 != 'null' ]; then - sudo pacman -S $1 - elif [ $mac == true ] && [ $3 != 'null' ]; then - sudo brew install $3 - fi -} -os_info - -install 'clang' 'clang' 'clang' -install 'make' 'make' 'make' -install 'cmake' 'cmake' 'cmake' -install 'null' 'clang-tidy' 'clang-tidy' -install 'fltk' 'libfltk1.3 libfltk1.3-dev' 'fltk' -install 'catch2' 'null' 'catch2' - -if [[ $apt ]]; then - - git clone https://github.com/catchorg/Catch2.git - cd Catch2 - cmake -Bbuild -H. -DBUILD_TESTING=OFF - sudo cmake --build build/ --target install - -fi +install_packages echo "cloning repositories" cd .. diff --git a/update.sh b/update.sh index a164227..b1a0438 100755 --- a/update.sh +++ b/update.sh @@ -15,5 +15,5 @@ for d in */; do cd .. done -cd +cd installation ./build.sh \ No newline at end of file