Преглед на файлове

setup scripts fixed for broken symlinks

Fabian Peter Hammerle преди 9 години
родител
ревизия
22f4d9e34d
променени са 1 файла, в които са добавени 3 реда и са изтрити 0 реда
  1. 3 0
      setup

+ 3 - 0
setup

@@ -9,6 +9,7 @@ target_name="screenrc"
 
 target_path="$( relpath "${script_dir}/${target_name}" "$(dirname "${link_path}")" )"
 
+# equals false for broken symlinks
 if [ -e "${link_path}" ]; then
     # empty of link_path is not a link
     current_target="$(readlink "${link_path}")"
@@ -20,6 +21,8 @@ fi
 if [ -e "${link_path}" ]; then
     echo "sym link to '$target_path' already installed at '$link_path'"
 else
+    # delete possibly existing broken symlink
+    rm "$link_path" 2>/dev/null
     ln -s "$target_path" "$link_path"
     echo "installed sym link to '$target_path' at '$link_path'"
 fi