aboutsummaryrefslogtreecommitdiff
path: root/tweed.hashdist.post-install
blob: edf1db01734c3089688598012e79c4d82c1874a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh
#
# Tweed --- Package management for engineering software
# Copyright (C) 2016  Paul Garlick <pgarlick@tourbillion-technology.com>
# 
# Tweed is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with Tweed.  If not, see <http://www.gnu.org/licenses/>.

# create a .hashdist-profile directory if it does not already exist
mkdir -p $HOME/.hashdist-profile

# set configuration filename
CONFIG_FILE=$HOME/.hashdist-profile/hashdist.sh

# remove previous configuration file (if it exists)
rm -f $CONFIG_FILE

# read link to profile in HashStack directory
PROFILE="$HASHSTACK_DIR/default"
PROFILE=$(readlink $PROFILE)
PROFILE=$(basename $PROFILE)
# confirm HashDist store location
HASHDIST_BUILD_STORE=$(grep build_stores: -A1 ~/.hashdist/config.yaml | tail -1 | cut -f2 -d: | tr -d ' ')
if [ "x$HASHDIST_BUILD_STORE" = "x./bld" ]; then
    HASHDIST_BUILD_STORE="$HOME/.hashdist/bld"
fi

# write environment variables to configuration file
cat << EOF > $CONFIG_FILE
# HashDist configuration file 
# created by $0 on $(date)

export PROFILE=$PROFILE
export PROFILE_INSTALL_DIR=$HASHDIST_BUILD_STORE/profile/\$PROFILE
export PATH=\$PROFILE_INSTALL_DIR/bin:\$PATH
export MANPATH=\$PROFILE_INSTALL_DIR/share/man:
export CMAKE_PREFIX_PATH=\$PROFILE_INSTALL_DIR:\$CMAKE_PREFIX_PATH
export PYTHONPATH=\$PROFILE_INSTALL_DIR/lib/python2.7/site-packages:\$PYTHONPATH
export PKG_CONFIG_PATH=\$PROFILE_INSTALL_DIR/lib/pkgconfig:\$PKG_CONFIG_PATH
export INSTANT_CACHE_DIR=\$HOME/.cache/instant/\$PROFILE
export INSTANT_ERROR_DIR=\$HOME/.cache/instant/\$PROFILE
export DIJITSO_CACHE_DIR=\$HOME/.cache/dijitso/\$PROFILE
EOF