summaryrefslogtreecommitdiff
path: root/.config/symlinks.sh
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-01-27 20:52:59 -0500
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-01-27 20:52:59 -0500
commit786fcda41a731654dd2de7496d5f28bc7bb19743 (patch)
treeab557aa22a6463fd15667ec738b12f7fd78d7aa1 /.config/symlinks.sh
parent614636d8e5a1f643d3c91d0d5e52482aef38bb5e (diff)
parent5f7de477be298f158369862c1a3cc80286fc7e32 (diff)
Merge remote-tracking branch 'origin/master' into build64-par
Conflicts: .kde/share/apps .kde/share/config .kde4
Diffstat (limited to '.config/symlinks.sh')
-rwxr-xr-x.config/symlinks.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/.config/symlinks.sh b/.config/symlinks.sh
new file mode 100755
index 0000000..a3db6ae
--- /dev/null
+++ b/.config/symlinks.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+sed -e '/^\s*$/d' -e '/#/d' symlinks | while read _path _link; do
+ path="$(sed -rn 's|[^/]+/|../|g;s|/[^/]+$|/|p' <<<"$_link")${_path}"
+ link="$HOME/$_link"
+ if [[ -L "$link" ]]; then
+ rm -f "$link"
+ fi
+ if [[ -e "$link" ]]; then
+ echo "ERROR: file exists: $link" >> /dev/stderr
+ else
+ mkdir -p "${link%/*}"
+ ln -s "$path" "$link"
+ fi
+done