Browse Source

Initial commit.

Ian Adam Naval 7 years ago
commit
8705a75fba
3 changed files with 95 additions and 0 deletions
  1. 21
    0
      LICENSE
  2. 3
    0
      README.md
  3. 71
    0
      install-dotfiles.sh

+ 21
- 0
LICENSE View File

@@ -0,0 +1,21 @@
1
+The MIT License
2
+
3
+Copyright (c) Ian Adam Naval, https://ianonavy.com/
4
+
5
+Permission is hereby granted, free of charge, to any person obtaining a copy
6
+of this software and associated documentation files (the "Software"), to deal
7
+in the Software without restriction, including without limitation the rights
8
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+copies of the Software, and to permit persons to whom the Software is
10
+furnished to do so, subject to the following conditions:
11
+
12
+The above copyright notice and this permission notice shall be included in
13
+all copies or substantial portions of the Software.
14
+
15
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+THE SOFTWARE.

+ 3
- 0
README.md View File

@@ -0,0 +1,3 @@
1
+# Ian's Dotfiles
2
+
3
+Nothing to see here; just my dotfiles.

+ 71
- 0
install-dotfiles.sh View File

@@ -0,0 +1,71 @@
1
+#!/usr/bin/env bash
2
+#
3
+# Symlinks ALL the things! (really just all the .dotfile files)
4
+
5
+set -e
6
+
7
+cd "$(dirname $0)"
8
+export DOTFILES_ROOT="`pwd`"
9
+
10
+create_link () {
11
+  ln -s $1 $2
12
+  echo "linked $1 to $2"
13
+}
14
+
15
+overwrite_all=false
16
+backup_all=false
17
+skip_all=false
18
+
19
+for src in `find $DOTFILES_ROOT -name \*.dotfile`
20
+do
21
+  dest="$HOME/.`basename \"${src%.*}\"`"
22
+
23
+  if [ -f $dest ] || [ -d $dest ]
24
+  then
25
+    overwrite=false
26
+    backup=false
27
+    skip=false
28
+
29
+    if [ "$overwrite_all" == "false" ] && [ "$backup_all" == "false" ] && [ "$skip_all" == "false" ]
30
+    then
31
+      echo "conflict adding $dest"
32
+      echo "[s]kip, [S]kip all, [o]verwrite, [O]verwrite all, [b]ackup, [B]ackup all: "
33
+      echo -n "> "
34
+      read -n 1 cmd
35
+      echo ""
36
+
37
+      case "$cmd" in
38
+        o ) overwrite=true;;
39
+        O ) overwrite_all=true;;
40
+        b ) backup=true;;
41
+        B ) backup_all=true;;
42
+        s ) skip=true;;
43
+        S ) skip_all=true;;
44
+        * ) ;;
45
+      esac
46
+    fi
47
+
48
+    if [ "$overwrite" == "true" ] || [ "$overwrite_all" == "true" ]
49
+    then
50
+      rm -rf $dest
51
+      echo "removed $dest"
52
+    fi
53
+
54
+    if [ "$backup" == "true" ] || [ "$backup_all" == "true" ]
55
+    then
56
+      mv $dest $dest\.bak
57
+      echo "moved $dest to $dest.bak"
58
+    fi
59
+
60
+    if [ "$skip" == "true" ] || [ "$skip_all" == "true" ]
61
+    then
62
+      echo "skipped $src"
63
+    else
64
+      create_link $src $dest
65
+    fi
66
+  else
67
+    create_link $src $dest
68
+  fi
69
+done
70
+
71
+find . -name setup.sh | while read setup; do sh -c "${setup}"; done

Loading…
Cancel
Save