setup 845 B

123456789101112131415161718192021222324252627282930
  1. #!/bin/bash
  2. pip install --user pydbus
  3. # relpath
  4. script_dir="$( dirname "${BASH_SOURCE[0]}" )"
  5. source ${script_dir}/../bash/functions
  6. link_path="$HOME/.screenrc"
  7. target_name="screenrc"
  8. target_path="$( relpath "${script_dir}/${target_name}" "$(dirname "${link_path}")" )"
  9. # equals false for broken symlinks
  10. if [ -e "${link_path}" ]; then
  11. # empty of link_path is not a link
  12. current_target="$(readlink "${link_path}")"
  13. if [ "$current_target" != "$target_path" ]; then
  14. mv --backup=numbered "$link_path" "${link_path}.old"
  15. fi
  16. fi
  17. if [ -e "${link_path}" ]; then
  18. echo "sym link to '$target_path' already installed at '$link_path'"
  19. else
  20. # delete possibly existing broken symlink
  21. rm "$link_path" 2>/dev/null
  22. ln -s "$target_path" "$link_path"
  23. echo "installed sym link to '$target_path' at '$link_path'"
  24. fi