Browse Source

fixed existing conf check

master
Robin Thoni 4 years ago
parent
commit
c3b55f2824
6 changed files with 17 additions and 47 deletions
  1. 4
    9
      bash/install
  2. 3
    8
      git/install
  3. 2
    7
      gnome-terminal/install
  4. 3
    8
      i3/install
  5. 1
    1
      nma/install
  6. 4
    14
      vim/install

+ 4
- 9
bash/install View File

@@ -4,14 +4,9 @@ dir="$(dirname $(readlink -f "${0}"))"
4 4
 
5 5
 for file in bash_aliases bash_preexec bash_preexec_hooks bashrc git-prompt.sh nma_exclude
6 6
 do
7
-  if [ -e ~/."${file}" ]
7
+  if [ -f ~/."${file}" ]
8 8
   then
9
-    if [ -h ~/."${file}" ]
10
-    then
11
-      rm ~/."${file}"
12
-    else
13
-      mv ~/."${file}" ~/."${file}.old"
14
-    fi
15
-  fi
16
-  ln -s "${dir}/${file}" ~/."${file}"
9
+    mv ~/."${file}" ~/."${file}.old"
10
+  fi &&
11
+  ln -sf "${dir}/${file}" ~/."${file}"
17 12
 done

+ 3
- 8
git/install View File

@@ -4,14 +4,9 @@ dir="$(dirname $(readlink -f "${0}"))"
4 4
 
5 5
 for file in gitconfig
6 6
 do
7
-  if [ -e ~/."${file}" ]
7
+  if [ -f ~/."${file}" ]
8 8
   then
9
-    if [ -h ~/."${file}" ]
10
-    then
11
-      rm ~/."${file}"
12
-    else
13
-      mv ~/."${file}" ~/."${file}.old"
14
-    fi
15
-  fi
9
+    mv ~/."${file}" ~/."${file}.old"
10
+  fi &&
16 11
   ln -sf "${dir}/${file}" ~/."${file}"
17 12
 done

+ 2
- 7
gnome-terminal/install View File

@@ -1,12 +1,7 @@
1 1
 #! /usr/bin/env bash
2 2
 
3
-if [ -e ~/.gconf/apps/gnome-terminal ]
3
+if [ -d ~/.gconf/apps/gnome-terminal ]
4 4
 then
5
-  if [ -h ~/.gconf/apps/gnome-terminal ]
6
-  then
7
-    rm ~/.gconf/apps/gnome-terminal
8
-  else
9
-    mv ~/.gconf/apps/gnome-terminal ~/.gconf/apps/gnome-termnial.old
10
-  fi
5
+  mv ~/.gconf/apps/gnome-terminal ~/.gconf/apps/gnome-termnial.old
11 6
 fi &&
12 7
 ln -sf "$PWD"/gnome-terminal ~/.gconf/apps/gnome-terminal

+ 3
- 8
i3/install View File

@@ -2,13 +2,8 @@
2 2
 
3 3
 dir="$(dirname $(readlink -f "${0}"))"
4 4
 
5
-if [ -e ~/.i3 ]
5
+if [ -d ~/.i3 ]
6 6
 then
7
-  if [ -h ~/.i3 ]
8
-  then
9
-    rm ~/.i3
10
-  else
11
-    mv ~/.i3 ~/.i3.old
12
-  fi
7
+  mv ~/.i3 ~/.i3.old
13 8
 fi &&
14
-ln -s "${dir}/i3" ~/.i3
9
+ln -sf "${dir}/i3" ~/.i3

+ 1
- 1
nma/install View File

@@ -2,4 +2,4 @@
2 2
 
3 3
 dir="$(dirname $(readlink -f "${0}"))"
4 4
 
5
-cp "${dir}/nma" /usr/local/bin
5
+cp "${dir}/nma" /usr/local/bin/nma

+ 4
- 14
vim/install View File

@@ -2,25 +2,15 @@
2 2
 
3 3
 dir="$(dirname $(readlink -f "${0}"))"
4 4
 
5
-if [ -e ~/.vim ]
5
+if [ -d ~/.vim ]
6 6
 then
7
-  if [ -h ~/.vim ]
8
-  then
9
-    rm ~/.vim
10
-  else
11
-    mv ~/.vim ~/.vim.old
12
-  fi
7
+  mv ~/.vim ~/.vim.old
13 8
 fi &&
14 9
 ln -sf "${dir}/vim" ~/.vim &&
15 10
 
16
-if [ -e ~/.vimrc ]
11
+if [ -f ~/.vimrc ]
17 12
 then
18
-  if [ -h ~/.vimrc ]
19
-  then
20
-    rm ~/.vimrc
21
-  else
22
-    mv ~/.vimrc ~/.vimrc.old
23
-  fi
13
+  mv ~/.vimrc ~/.vimrc.old
24 14
 fi &&
25 15
 ln -sf "${dir}/vimrc" ~/.vimrc &&
26 16
 

Loading…
Cancel
Save