blob: e323aaa9e98229798c38c1ff3d69c0a7a80d12bd (
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
54
55
56
57
58
59
60
61
62
63
64
65
|
#! /bin/sh
#
# Initialize the sh-ves system within a shell session by sourcing the relevant
# files to add function definitions for functionality that cannot be
# implemented via scripts, as well as initialing some local variables used by
# the system. This file should be sourced in your shell's rc or profile file.
#
# Note, the correct functioning of other sh-ves functions requires that this
# file be sourced prior to calling them. As such, they will check for
# SH_VES_INIT to be created prior to doing anything. If is not suggested to try
# to set this variable manually to get around sourcing this file.
#
# This file also provides default values for several sh-ves configuration
# variables. You may override these settings by setting the variables
# prior to sourcing this file, in which case they will not be modified,
# or by overwriting their values after sourcing the file.
if [ -z "${XDG_DATA_HOME+x}" ]; then
SHVES_ENV_DIR="$HOME/.local/share/ves/envs"
else
SHVES_ENV_DIR="$XDG_DATA_HOME/ves/envs"
fi
if [ -z "${SHVES_OVERRIDE_VARS+x}" ]; then
SHVES_OVERRIDE_VARS="PATH LDPATH LD_LIBRARY_PATH CPATH"
fi
if [ -z "${SHVES_SCRIPTS_DIR+x}" ]; then
SHVES_BIN="$HOME/.local/bin/ves_scripts"
else
SHVES_BIN="$SHVES_SCRIPTS_DIR"
fi
_shves_check_env_name() {
if ! echo $1 | grep "^[[:alpha:][:digit:]_-]*$" > /dev/null; then
printf "ERROR: Environment [%s] is invalid. Name must contain only letters, -, and _\n" $1 > /dev/stderr
return 1
fi
return 0
}
_shves_check_env_exists() {
if [ ! -f "$SHVES_ENV_DIR/$1" ]; then
if [ "$#" -lt 2 ]; then
printf "ERROR: Environment [%s] does not exist.\n" $1 > /dev/stderr
fi
return 1
fi
return 0
}
. "$SHVES_BIN"/ves.sh
. "$SHVES_BIN"/ves-export.sh
. "$SHVES_BIN"/ves-activate.sh
. "$SHVES_BIN"/ves-deactivate.sh
. "$SHVES_BIN"/ves-var-add.sh
. "$SHVES_BIN"/ves-var-rm.sh
. "$SHVES_BIN"/ves-create.sh
. "$SHVES_BIN"/ves-delete.sh
|