Skip to content
Permalink
Browse files

test out bootstrap

  • Loading branch information...
neeasade authored and neeasade committed Sep 4, 2019
1 parent 388c0e7 commit f3e314ae6ddc724999e3ec5330cd81ba03fd08a2
Showing with 55 additions and 14 deletions.
  1. +39 −0 bin/bin/stoww
  2. +16 −14 bootstrap
@@ -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 bootstrap 100644 → 100755
@@ -2,26 +2,23 @@
# depends on git, sh.

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

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

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

"~/git/stowsh/stowsh" -t .. "$@"
"${HOME}/.dotfiles/bin/bin/stoww" "$@" 2>/tmp/stow_conflicts
}

core() {
stoww bin shell vim tools
}

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
type emacs >/dev/null 2>&1 && emacs
@@ -36,7 +33,7 @@ windows() {
# prereq: windows/bootstrap.cmd
core

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

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

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

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

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

0 comments on commit f3e314a

Please sign in to comment.
You can’t perform that action at this time.