aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsetup.py20
-rwxr-xr-xsetup.zsh17
2 files changed, 20 insertions, 17 deletions
diff --git a/setup.py b/setup.py
new file mode 100755
index 0000000..173a898
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,20 @@
+#!/usr/bin/env python3
+
+import os
+import sys
+from glob import glob
+
+os.chdir(os.path.dirname(__file__))
+exit = 0
+
+for f in glob('dot.*'):
+ dst = os.path.expanduser('~/' + f[3:])
+ src = os.path.join(os.getcwd(), f)
+ try:
+ os.symlink(src, dst)
+ except FileExistsError:
+ if not os.path.samefile(src, dst):
+ print(dst + " exists and does not link do " + dst)
+ exit = 1
+
+sys.exit(exit)
diff --git a/setup.zsh b/setup.zsh
deleted file mode 100755
index 233a942..0000000
--- a/setup.zsh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/usr/bin/env zsh
-
-[[ $PWD = ~/.dotfiles ]] || exit 1
-
-if [[ $(uname -s) = FreeBSD ]]; then
- if [[ -x /compat/linux/bin/ln ]]; then
- LN=/compat/linux/bin/ln
- else
- echo "On FreeBSD and no GNU ln found, exiting"
- exit 1
- fi
-fi
-LN=${LN:-ln}
-
-for i in dot.*; do
- ${LN} -Ts .dotfiles/${i} ~/${i#dot}
-done