diff options
Diffstat (limited to 'bash')
-rw-r--r-- | bash/init.sh | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/bash/init.sh b/bash/init.sh index a3e3075..69dcb2b 100644 --- a/bash/init.sh +++ b/bash/init.sh @@ -1,11 +1,38 @@ #!/usr/bin/env bash -pushd ~/ > /dev/null - -mr checkout > /dev/null - -popd > /dev/null - +locked_init() { + pushd ~/ > /dev/null + + mkdir -p ~/.emacs.d/.cache/ + mkdir -p ~/.local/share/autojump/ + touch ~/.local/share/autojump/autojump.txt + + # clone all missing repos + mr checkout > /dev/null + + printf "" > /tmp/mr-repos + mr inject > /dev/null + + printf "(\n" > /tmp/mr-projectile + sed -E 's/\/home\/andreh/~/' /tmp/mr-repos | awk '{print "\""$1"\""}' >> /tmp/mr-projectile + printf ")" >> /tmp/mr-projectile + cp /tmp/mr-projectile ~/.emacs.d/.cache/projectile-bookmarks.eld + + popd > /dev/null +} + +touch /tmp/mr-lock +exec 221>/tmp/mr-lock +echo before +flock -n -e 221 && { + echo doing + locked_init +} || { + printf "" # noop: couldn't acquire lock + echo "cant acquire lock" +} +echo after +export -f locked_init # Tests |