summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--bashrc/main.sh14
-rwxr-xr-xgodot.sh33
-rw-r--r--symlink-mapping8
3 files changed, 54 insertions, 1 deletions
diff --git a/bashrc/main.sh b/bashrc/main.sh
index eb17f58..457fb6a 100644
--- a/bashrc/main.sh
+++ b/bashrc/main.sh
@@ -11,10 +11,22 @@ _self_update() {
pushd ${_DOTFILES_DIR} &>/dev/null
if [[ -n "$(git fetch 2>&1)" && $? -eq 0 ]]; then
- echo -ne "\033[31m*\033[0m dotfile updates found, merge now? "
+q echo -ne "\033[31m*\033[0m dotfile updates found, merge now? "
if read; then
git merge origin/master
+
+ if [{ -e management/symlinks.md5 ]]; then
+ md5sum -c management/symlinks.md5 2>/dev/null
+
+ if [[ $? -ne 0 ]]; then
+ echo -e "\033[33m*\033[0m symlink mapping changed! Maybe you should execute godot.sh again..."
+ fi
+ else
+ echo -e "\033[33m*\033[0m symlink mapping checksum not found"
+ fi
+ md5sum symlink-mapping > management/symlinks.md5
+
popd &>/dev/null
exec $SHELL
fi
diff --git a/godot.sh b/godot.sh
new file mode 100755
index 0000000..629a1cd
--- /dev/null
+++ b/godot.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+# target dir of dotfiles (relative to $HOME)
+TARGET=".dotfiles"
+
+if [[ ! -e "${HOME}/${TARGET}" ]]; then
+ git clone git://git.animux.de/dotfiles.git "${HOME}/${TARGET}"
+fi
+
+pushd $HOME >/dev/null
+
+# create new symlinks as specified in dotfiles mapping file:
+grep -v "^#\|^$" "${TARGET}/symlink-mapping" | \
+ grep "[^ \t]\+ -> [^ \t]\+" | \
+ awk -F " -> " '{ print $1 ; print "'$TARGET'/"$2; }' | \
+ while read target ; read source ; do
+ if [[ -e "${target}" && ! -f "${target}" && ! -L "${target}" ]]; then
+ echo "!!! ~/${target}/ exists and is not a symlink."
+ else
+ # remove folder (only if they are symlinks) and regular files
+ # (all other actions could be dangerouse: e.g. lost private keys)
+ [[ -L "${target}" || -f "${target}" ]] && rm -f "${target}"
+
+ # create ne symlink
+ ln -s "${source}" "${target}"
+ fi
+ done
+
+popd >/dev/null
+
+echo
+echo "All done. Happy hacking ;)"
+echo
diff --git a/symlink-mapping b/symlink-mapping
new file mode 100644
index 0000000..07cd8d3
--- /dev/null
+++ b/symlink-mapping
@@ -0,0 +1,8 @@
+# this file only contains the mappings:
+# $HOME -> .dotfiles
+.gitconfig -> gitconfig
+.screenrc -> screenrc
+.Xdefaults -> Xdefaults
+.bashrc -> bashrc/main.sh
+.bash -> bashrc
+.mplayer -> mplayer