kicad-install.sh and library-repos-install.sh utilize /etc/profile.d/kicad.sh for setting environment variables globally

This commit is contained in:
Dick Hollenbeck 2013-12-13 09:35:05 -06:00
parent 6c4518b015
commit 5c28285cdf
2 changed files with 36 additions and 8 deletions

View File

@ -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
}

View File

@ -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