summaryrefslogtreecommitdiff
path: root/scripts/include/common.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/include/common.sh')
-rw-r--r--scripts/include/common.sh53
1 files changed, 35 insertions, 18 deletions
diff --git a/scripts/include/common.sh b/scripts/include/common.sh
index 78f046b..2afe31c 100644
--- a/scripts/include/common.sh
+++ b/scripts/include/common.sh
@@ -71,22 +71,6 @@ function common_run_package {
check_error $?
}
-function common_use_package {
- cd "${scriptsdir}"
- check_error $?
- export envfile="../env/run${envname}.sh"
- echo "#!/bin/bash" >"${envfile}"
- check_error $?
- echo "" >>"${envfile}"
- echo "package_use"
- package_use
- check_error $?
- echo "\$*" >>"${envfile}"
- check_error $?
- chmod 0755 "${envfile}"
- check_error $?
-}
-
function env_path {
echo "export PATH=${bindir}/$1:\$PATH" >>"${envfile}"
check_error $?
@@ -216,9 +200,42 @@ function run_switch_branch {
fi
}
+function repack_paths {
+ if [[ "$1" == "" ]]; then
+ return
+ fi
+ IFS=":"
+ packedpaths=""
+ for var in $1
+ do
+ packedpaths="${packedpaths}${bindir}/$var:"
+ done
+ unset IFS
+ echo "export $2=${packedpaths}\$$2" >>"${envfile}"
+ check_error $?
+}
+
function package_use {
- env_path "bin"
- env_lib_library_path "lib"
+ repack_paths "$ENV_PATH" "PATH"
+ repack_paths "$ENV_LD_LIBRARY_PATH" "LD_LIBRARY_PATH"
+ repack_paths "$ENV_PKG_CONFIG_PATH" "PKG_CONFIG_PATH"
+ repack_paths "$ENV_MANPATH" "MANPATH"
+}
+
+function common_use_package {
+ cd "${scriptsdir}"
+ check_error $?
+ export envfile="../env/run${envname}.sh"
+ echo "#!/bin/bash" >"${envfile}"
+ check_error $?
+ echo "" >>"${envfile}"
+ echo "package_use"
+ package_use
+ check_error $?
+ echo "\$*" >>"${envfile}"
+ check_error $?
+ chmod 0755 "${envfile}"
+ check_error $?
}
function package_get_source {