dotfiles

$HOME is where the <3 is
git clone git://git.alexkarle.com/dotfiles.git
Log | Files | Refs | Submodules | README

commit 997fcff814b920b5c5fa2982a6265a96e1d6ed8d (patch)
parent 0fb5f2c36bad79a167a258b50af9f331a7af1436
Author: Alex Karle <alex@karle.co>
Date:   Sun,  8 Dec 2019 23:46:12 -0500

install: don't use custom dotfile manager

I found that I was setting up my dotfiles on quite a few new accounts
recently (mostly due to exploring different OSs). When I get a new
machine / account, I want to be able to install the basics (and a few
extras) without needing the dependency on my dotfile manager (or even
git or bash).

Diffstat:
MREADME.md | 3+++
Minstall.sh | 56++++++++++++++++++++++++++++++++++++++++----------------
2 files changed, 43 insertions(+), 16 deletions(-)

diff --git a/README.md b/README.md @@ -11,3 +11,6 @@ I'm a big believer in the "do it yourself" style of dotfiles. Fork if you'd like, but don't blindly copy! These configs work for me, but [definitely aren't for everyone](./vc/README.md). + +This all said, [install.sh](./install.sh) is how I set up a new machine / +user account. diff --git a/install.sh b/install.sh @@ -1,21 +1,45 @@ -#!/usr/bin/env bash -# simple install via dotfiler -# PREREQS: git +#!/bin/sh +# Minimal install (no prereqs, just the basics) +# Intended to be run on a new account, NOT for long term management +# However, should be safe to rerun to fix/tune-up an existing install -if ! [ -x "$(command -v git)" ]; then - echo "Error: git is not installed. Aborting..." >&2 - exit 1 -fi +DOTFILES="$( cd "$(dirname "$0")" ; pwd -P )" -mkdir -p $HOME/.config -mkdir -p $HOME/dev/proj +# ln with the right settings and a nicer message +try_ln() { + if [ -e "$2" ]; then + if [ -h "$2" ]; then + ln -sfT $1 $2 + echo "[Updated Link] $2" | sed "s#$HOME#~#" + else + echo "[Fail:Exists ] $2" | sed "s#$HOME#~#" + return + fi + else + # Use 'T' to prevent nesting if the dir already exists + ln -sT $1 $2 + echo "[New ] $2" | sed "s#$HOME#~#" + fi +} + +# Top level dirs +try_ln $DOTFILES/vim $HOME/.vim -echo "Installing dotfiler -> $HOME/dev/proj/dotfiler" -git clone https://github.com/akarle/dotfiler $HOME/dev/proj/dotfiler || exit 1 +# bin scripts +mkdir -p $HOME/bin +for f in $DOTFILES/bin/*; do + try_ln $f $HOME/bin/`basename $f` +done -echo "Using dotfiler to link bash (bare minimum)" -PATH=$HOME/dev/proj/dotfiler:$PATH -dotfiler.pl -d $HOME/dev/dotfiles -l bash tmux +# XDG_CONFIG_HOME dirs +mkdir -p $HOME/.config +for d in mutt offlineimap git nvim; do + try_ln $DOTFILES/$d $HOME/.config/$d +done -# dotfiler doesn't support .vim yet... -ln -s $HOME/dev/dotfiles/vim $HOME/.vim +# Traditional dotfiles +for d in bash tmux gdb X11; do + for f in $DOTFILES/$d/*; do + try_ln $f $HOME/.`basename $f` + done +done