]> git.sev.monster Git - dotfiles.git/blame - install.sh
partially revert zsh refactor, fix zsh conf bugs
[dotfiles.git] / install.sh
CommitLineData
1b8a4102 1#!/bin/sh
03bc64c4 2
8720834f 3#NOTE: .zshenv XDG paths are hardcoded to allow non-zsh install
4
84251d17 5# test
fef7b7c4 6devnull=/dev/null
8720834f 7if [ "$1" = "test" ]; then
fef7b7c4 8 echo "Running test -- no changes will be applied"
9 devnull=/dev/stdout
10 _cd() {
11 cd $*;
12 echo " cd $*";
13 echo "\$PWD=$PWD";
14 }
15 alias cd="_cd"
16 alias mkdir="echo mkdir"
7f359c8a 17 alias ln="echo ln"
18 alias rm="echo rm"
fef7b7c4 19 alias sh="echo sh"
7f359c8a 20fi
21
d50f11d1 22# create preferred folder structure
d877aef2 23cd ~
d569f3f7 24mkdir -p bin etc share share/fonts .urxvt/ext .icons .themes .gnupg .ssh >$devnull 2>&1
fef7b7c4 25mkdir -pm 700 var/tmp var/tmp/vim >$devnull 2>&1
26cd - >$devnull
1873e725 27
dcac60d9 28# ensure ostype
74024535 29if [ -z "$OSTYPE" ]; then
ff1a2414 30 OSTYPE=`uname -s | tr '[:upper:]' '[:lower:]'`
74024535 31fi
dcac60d9 32
33# accomodate multiple userlands
34lnargs=-sfnv
d877aef2 35case "$OSTYPE" in
fef7b7c4 36 freebsd*) lnargs=-sFhv;;
8720834f 37 netbsd|openbsd*) lnargs=-sfhv;;
cf9ecb6f 38esac
39
7f359c8a 40l() {
1390d028 41 # TODO: use install?
fef7b7c4 42 [ -L "$1" -o \! -e "$1" ] && ln $lnargs "${2:-$PWD/$x}" "$1" || \
43 echo "!!! File exists and is not a link: $1"
7f359c8a 44}
45
84251d17 46# link files
fef7b7c4 47find base -mindepth 1 -maxdepth 1 | while read -r x; do
7f359c8a 48 l "$HOME/`basename "$x"`"
49done
d877aef2 50find bin share -mindepth 1 -maxdepth 1 | while read -r x; do
fef7b7c4 51 l "$HOME/$x"
1390d028 52done
372276b7 53find fonts -mindepth 1 -maxdepth 1 -type d | while read -r x; do
54 l "$HOME/share/fonts/`basename "$x"`"
55done
fef7b7c4 56find xdg -mindepth 1 -maxdepth 1 | while read -r x; do
8720834f 57 l "$HOME/etc/`basename "$x"`"
04ff96a4 58done
c72b1cbd 59find urxvt-ext -mindepth 1 -maxdepth 2 -type f -perm -111 | while read -r x; do
7f359c8a 60 l "$HOME/.urxvt/ext/`basename $x`"
82151901 61done
c72b1cbd 62find xorg/icons -mindepth 1 -maxdepth 2 -type d | while read -r x; do
dcac60d9 63 if [ -e "$x/index.theme" ]; then
152474f6 64 d="$HOME/.icons/`basename "$x"`"
65 l $d
66 which gtk-update-icon-cache >/dev/null 2>&1 && gtk-update-icon-cache -qtf $d
67 unset d
dcac60d9 68 fi
7796231b 69done
c72b1cbd 70find xorg/themes -mindepth 1 -maxdepth 1 -type d | while read -r x; do
7796231b 71 l "$HOME/.themes/`basename "$x"`"
8720834f 72done
372276b7 73find gpg -mindepth 1 -maxdepth 1 \! -name '*.gpg' | while read -r x; do
74 l "$HOME/.gnupg/`basename "$x"`"
ff1a2414 75done
b4a8a4f9 76if which gpg >/dev/null 2>&1; then
372276b7 77 find gpg -mindepth 1 -maxdepth 1 -name '*.gpg' | while read -r x; do
78 gpg --import "$x"
79 done
80fi
d569f3f7 81find ssh -mindepth 1 -maxdepth 1 | while read -r x; do
82 l "$HOME/.ssh/`basename "$x"`"
83done
This page took 0.047485 seconds and 4 git commands to generate.