diff options
author | NP-Hardass <np.hardass@gmail.com> | 2017-03-27 04:08:54 -0400 |
---|---|---|
committer | NP-Hardass <np.hardass@gmail.com> | 2017-03-27 04:08:54 -0400 |
commit | 062975f15e70f2ba08e92e1c37e1ec1a5dcb6959 (patch) | |
tree | 5635ec982ca97ae6d5b6baaef093c852c2495b49 | |
parent | wine.eselect: Renable desktop_database_update and silence (diff) | |
download | eselect-wine-062975f15e70f2ba08e92e1c37e1ec1a5dcb6959.tar.gz eselect-wine-062975f15e70f2ba08e92e1c37e1ec1a5dcb6959.tar.bz2 eselect-wine-062975f15e70f2ba08e92e1c37e1ec1a5dcb6959.zip |
wine.eselect: Better error handling for adding and removing symlinks
-rw-r--r-- | wine.eselect | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/wine.eselect b/wine.eselect index d571a5c..bf835f1 100644 --- a/wine.eselect +++ b/wine.eselect @@ -660,12 +660,6 @@ remove_symlinks() { v_arg="--${v}" fi - local active=$(get_active ${v_arg}) - if [[ "${active}" == "(unset)" ]]; then - return 0 - #die -q "No active links to remove" - fi - if ! are_symlinks_valid ${v_arg}; then die -q "Currently configured symlinks are invalid" fi @@ -699,6 +693,9 @@ remove_symlinks() { store_config "${CONFIG_DIR}/links/${v}" symlink_dirs "${symlink_vars}" done + # Remove active if it exists + store_config "${CONFIG_DIR}/active" "${v}" "" + desktop_database_update || die "Failed to update xorg desktop database" } @@ -748,9 +745,13 @@ set_symlinks() { store_config "${CONFIG_DIR}/links/${v}" symlink_dirs "bin" store_config "${CONFIG_DIR}/links/${v}" "bin" "" for b in "${wine_bin}"/*; do - #TODO detect errors and clean up link="${PREFIX}/usr/bin/${b##*/}${v_arg#-}" ln -s "${b}" "${link}" + if [[ $? -ne 0 ]]; then + write_warning_msg "Failed to set symlink from ${b} to ${link}" + write_warning_msg "Cleaning up" + remove_symlinks ${v_arg} + fi append_config "${CONFIG_DIR}/links/${v}" "bin" "${link}" done @@ -758,9 +759,13 @@ set_symlinks() { store_config "${CONFIG_DIR}/links/${v}" "man" "" for md in "${wine_man}"/*; do for m in "${md}"/*; do - #TODO detect errors and clean up link="${PREFIX}/usr/share/man/${md##*/}/${m##*/}${v_arg#-}" ln -s "${m}" "${link}" + if [[ $? -ne 0 ]]; then + write_warning_msg "Failed to set symlink from ${m} to ${link}" + write_warning_msg "Cleaning up" + remove_symlinks ${v_arg} + fi append_config "${CONFIG_DIR}/links/${v}" "man" "${link}" done done |