From a5e82117cb56e6e3b558eb76f002c2ec00b17d7e Mon Sep 17 00:00:00 2001 From: Dick Hollenbeck Date: Tue, 22 Oct 2013 09:28:30 -0500 Subject: [PATCH] Distro specific architecture in scripts/kicad-install.sh. --- scripts/kicad-install.sh | 70 ++++++++++++++++++++++++++++++++-------- 1 file changed, 57 insertions(+), 13 deletions(-) diff --git a/scripts/kicad-install.sh b/scripts/kicad-install.sh index d92d7e22ed..2f080e4fd6 100755 --- a/scripts/kicad-install.sh +++ b/scripts/kicad-install.sh @@ -1,7 +1,11 @@ #!/bin/bash -# Install KiCad from source onto a Ubuntu/Debian/Mint compatible linux system. -# The "installing pre-requisites" step is the only "distro dependent" one. Could modify -# that step for other linux distros probably. +# Install KiCad from source onto either: +# -> a Ubuntu/Debian/Mint or +# -> a Red Hat +# compatible linux system. +# +# The "install_prerequisites" step is the only "distro dependent" one. Could modify +# that step for other linux distros. # Set where the 3 source trees will go @@ -23,19 +27,57 @@ usage() } +install_prerequisites() +{ + # Find a package manager, PM + PM=$( command -v yum || command -v apt-get ) + + # assume all these Debian, Mint, Ubuntu systems have same prerequisites + if [ "$(expr match "$PM" '.*\(apt-get\)')" == "apt-get" ]; then + #echo "debian compatible system" + sudo apt-get install \ + bzr \ + bzrtools \ + build-essential \ + cmake \ + cmake-curses-gui \ + debhelper \ + doxygen \ + libssl-dev \ + libwxgtk2.8-dev + + # assume all yum systems have same prerequisites + elif [ "$(expr match "$PM" '.*\(yum\)')" == "yum" ]; then + #echo "red hat compatible system" + # Note: if you find this list not to be accurate, please submit a patch: + sudo yum install + bzr \ + bzrtools \ + build-essential \ + cmake \ + cmake-curses-gui \ + debhelper \ + doxygen \ + libgl1-mesa-dev \ + libglu1-mesa-dev \ + libssl-dev \ + libwxbase2.8-dev \ + libwxgtk2.8-dev \ + libx11-dev \ + mesa-common-dev + else + echo + echo "Incompatible System. Neither 'yum' nor 'apt-get' found. Not possible to continue." + echo + exit 1 + fi +} + + install_or_update() { echo "step 1) installing pre-requisites" - sudo apt-get install \ - bzr \ - bzrtools \ - build-essential \ - cmake \ - cmake-curses-gui \ - debhelper \ - doxygen \ - libssl-dev \ - libwxgtk2.8-dev + install_prerequisites echo "step 2) make $WORKING_TREES if it does not exist" @@ -123,10 +165,12 @@ install_or_update() if [ $# -eq 1 -a "$1" == "--remove-sources" ]; then # run this only once, kills .config & makes dirs + echo "deleting $WORKING_TREES" rm -rf "$WORKING_TREES" exit fi + if [ $# -eq 1 -a "$1" == "--install-or-update" ]; then install_or_update exit