aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'wine.eselect')
-rw-r--r--wine.eselect59
1 files changed, 53 insertions, 6 deletions
diff --git a/wine.eselect b/wine.eselect
index bf835f1..8bdd06a 100644
--- a/wine.eselect
+++ b/wine.eselect
@@ -66,7 +66,13 @@ are_symlinks_valid() {
shift
done
- local active=$(load_config "${CONFIG_DIR}/active" ${v})
+ local v_arg
+ if [[ ${v} != "wine" ]]; then
+ v_arg="--${v}"
+ fi
+
+ local active=$(get_active ${v_arg})
+ local tgt="${active}"
if [[ "${active}" == "(unset)" ]]; then
write_error_message "Invalid active config"
return 1
@@ -74,7 +80,52 @@ are_symlinks_valid() {
set_dir_env
- #TODO check links manually and by config
+ local possible_vars=( bin man )
+ local symlink_vars=$(load_config "${CONFIG_DIR}/links/${v}" symlink_dirs)
+ if [[ -z "${symlink_vars}" ]]; then
+ die -q "Missing any configured symlink_dirs"
+ fi
+ local var
+
+ for var in ${possible_vars[@]}; do
+ if has ${var} ${symlink_vars[@]}; then
+ symlink_vars=$(list_rm_item "${var}" "${symlink_vars}")
+ else
+ write_warning_message "Missing '${var}' in ${v} config"
+ write_warning_message "Might want to re-run set or update"
+ fi
+ done
+ if [[ ! -z ${symlink_vars} ]]; then
+ die -q "Config contains unknown symlink_dirs ${symlink_vars}"
+ fi
+
+ symlink_vars=$(load_config "${CONFIG_DIR}/links/${v}" symlink_dirs)
+ for var in ${symlink_vars[@]}; do
+ local symlinks=$(load_config "${CONFIG_DIR}/links/${v}" ${var})
+ local symlink
+
+ if [[ -z "${symlinks}" ]]; then
+ die -q "Missing listing of ${var} symlinks"
+ fi
+ for symlink in ${symlinks[@]}; do
+ if [[ ! -L ${symlink} ]]; then
+ die -q "${symlink} is not a symlink"
+ else
+ local file=$(canonicalise ${symlink})
+ if [[ ! -e "${file}" ]]; then
+ die -q "${symlink} points to nonexistant ${file}"
+ else
+ eval path=\${wine_${var}}
+ path=$(canonicalise "${path}")
+ if [[ "${file}" != "${path%/}"/* ]]; then
+ write_error_msg "${symlink} points to ${file}"
+ die -q "which doesn't appear to be part of wine"
+ fi
+ fi
+ fi
+ done
+ done
+
unset_dir_env
}
@@ -660,10 +711,6 @@ remove_symlinks() {
v_arg="--${v}"
fi
- if ! are_symlinks_valid ${v_arg}; then
- die -q "Currently configured symlinks are invalid"
- fi
-
local symlink_vars=$(load_config "${CONFIG_DIR}/links/${v}" symlink_dirs)
if [[ -z "${symlink_vars}" ]]; then
die -q "Missing listing of configured symlinks"