Commit 5c28285c authored by Dick Hollenbeck's avatar Dick Hollenbeck
Browse files

kicad-install.sh and library-repos-install.sh utilize /etc/profile.d/kicad.sh...

kicad-install.sh and library-repos-install.sh utilize /etc/profile.d/kicad.sh for setting environment variables globally
parent 6c4518b0
Loading
Loading
Loading
Loading
+32 −5
Original line number Diff line number Diff line
@@ -71,6 +71,7 @@ install_prerequisites()
            cmake-curses-gui \
            debhelper \
            doxygen \
            grep \
            libbz2-dev \
            libcairo2-dev \
            libglew-dev \
@@ -86,13 +87,14 @@ install_prerequisites()
        sudo yum install \
            bzr \
            bzrtools \
            bzip2-libs \
            bzip2-devel \
            cmake \
            cmake-gui \
            doxygen \
            bzip2-libs \
            bzip2-devel \
            cairo-devel \
            glew-devel \
            grep \
            openssl-devel \
            wxGTK-devel \
            wxPython
@@ -136,6 +138,33 @@ cmake_uninstall()
}


# Function set_env_var
# sets an environment variable globally.
set_env_var()
{
    local VAR=$1
    local VAL=$2

    if [ -d /etc/profile.d ]; then
        if [ ! -e /etc/profile.d/kicad.sh ] || ! grep "$VAR" /etc/profile.d/kicad.sh; then
            echo
            echo "Adding environment variable $VAR to file /etc/profile.d/kicad.sh"
            echo "Please logout and back in after this script completes for environment"
            echo "variable to get set into environment."
            sudo sh -c "echo export $VAR=$VAL >> /etc/profile.d/kicad.sh"
        fi

    elif [ -e /etc/environment ]; then
        if ! grep "$VAR" /etc/environment; then
            echo
            echo "Adding environment variable $VAR to file /etc/environment"
            echo "Please reboot after this script completes for environment variable to get set into environment."
            sudo sh -c "echo $VAR=$VAL >> /etc/environment"
        fi
    fi
}


install_or_update()
{
    echo "step 1) installing pre-requisites"
@@ -231,9 +260,7 @@ install_or_update()
    echo 'All KiCad "--install-or-update" steps completed, you are up to date.'

    if [ -z "${KIGITHUB}" ]; then
        echo "Please set an environment variable by adding:"
        echo "export KIGITHUB=https://github.com/KiCad"
        echo "to your ~/.bashrc file.  Then reboot."
        set_env_var KIGITHUB https://github.com/KiCad
    fi
}

+4 −3
Original line number Diff line number Diff line
@@ -17,9 +17,10 @@
#    on https://github.com using Github plugin.  After running this script you should be able to
#      a)  $ cp ~/kicad_sources/library-repos/kicad-library/template/fp-lib-table.for-pretty ~/fp-lib-table
#    and then
#      b) set your environment variable KISYSMOD to "~/kicad_sources/library-repos"
#    before starting pcbnew.  This will use the KiCad plugin against the *.pretty dirs in that base dir.

#      b) set your environment variable KISYSMOD to "~/kicad_sources/library-repos".
#         Edit /etc/profile.d/kicad.sh, then reboot.
#
#    This will use the KiCad plugin against the *.pretty dirs in that base dir.


# Set where the library repos will go, use a full path