Skip to content

Commit

Permalink
test out bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
neeasade authored and neeasade committed Sep 4, 2019
1 parent 388c0e7 commit f3e314a
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 14 deletions.
39 changes: 39 additions & 0 deletions bin/bin/stoww
@@ -0,0 +1,39 @@
#!/bin/sh
# narrow symlinker

while [ ! -z "$1" ]; do
echo "$1"
cd "$HOME/.dotfiles/$1"
find . -type f | while read -r path; do
target="${HOME}/${path}"
target=$(echo "$target" | sed 's#/\./#/#')

path="$(pwd)/${path}"
path=$(echo "$path" | sed 's#/\./#/#')

mkdir -p "$(dirname "$target")"

if readlink "$target" >/dev/null; then
if [ "$(readlink "$target")" = "$path" ]; then
continue
fi

rm "$target"
fi

if [ -f "$target" ]; then
if [ -z "$BS" ]; then
echo "skipping conflict: $target (set BS=t to override)" 1>&2
continue
fi

rm "$target"
fi

echo ln -s "$path" "$target"
ln -s "$path" "$target"
done

shift
echo
done
30 changes: 16 additions & 14 deletions bootstrap 100644 → 100755
Expand Up @@ -2,26 +2,23 @@
# depends on git, sh. # depends on git, sh.


for dir in bin git notes .config; do for dir in bin git notes .config; do
mkdir -p "~/$dir" mkdir -p "$HOME/$dir"
done done


[ ! -d "~/.dotfiles" ] && git clone "https://github.com/neeasade/dotfiles" "~/.dotfiles" [ ! -d "$HOME/.dotfiles" ] && git clone "https://github.com/neeasade/dotfiles" "$HOME/.dotfiles"
cd "~/.dotfiles" cd "$HOME/.dotfiles"


echo >/tmp/stow_conflicts
stoww() { stoww() {
if [ ! -d "~/git/stowsh" ]; then "${HOME}/.dotfiles/bin/bin/stoww" "$@" 2>/tmp/stow_conflicts
git clone "https://github.com/neeasade/stowsh" "~/git/stowsh"
fi

"~/git/stowsh/stowsh" -t .. "$@"
} }


core() { core() {
stoww bin shell vim tools stoww bin shell vim tools
} }


emacs() { emacs() {
git clone "https://github.com/neeasade/emacs.d" "~/.emacs.d" git clone "https://github.com/neeasade/emacs.d" "$HOME/.emacs.d"


# initial launch/install packages # initial launch/install packages
type emacs >/dev/null 2>&1 && emacs type emacs >/dev/null 2>&1 && emacs
Expand All @@ -36,7 +33,7 @@ windows() {
# prereq: windows/bootstrap.cmd # prereq: windows/bootstrap.cmd
core core


for item in "$(cat ~/.dotfiles/windows/scoop.txt)"; do for item in "$(cat $HOME/.dotfiles/windows/scoop.txt)"; do
scoop install $item scoop install $item
done done


Expand All @@ -53,8 +50,13 @@ docker() {


[ "$USER" = "emacser" ] && docker [ "$USER" = "emacser" ] && docker


if [ -z "$*" ]; then
echo "options: core, rice, emacs"
exit 1
fi

# core, emacs, rice, windows # core, emacs, rice, windows
op=${1:-core} echo bootstrapping ${1}...
echo bootstrapping $op... $1
$op cat /tmp/stow_conflicts | grep conflict
echo done. echo bootstrapped ${1}...

0 comments on commit f3e314a

Please sign in to comment.