]>
Commit | Line | Data |
---|---|---|
189288f7 | 1 | #!/bin/sh |
d9362f34 | 2 | |
7197cc5c | 3 | #NOTE: .zshenv XDG paths are hardcoded to allow non-zsh install |
4 | ||
1f8bf106 | 5 | # test |
7197cc5c | 6 | if [ "$1" = "test" ]; then |
a568f7fa | 7 | mkdir() { echo -- "$@"; } |
9938f1e2 | 8 | alias ln="echo ln" |
9 | alias rm="echo rm" | |
10 | alias cap_mkdb="echo cap_mkdb" | |
11 | alias unlink="echo unlink" | |
12 | fi | |
13 | ||
fef6b2b5 | 14 | # create preferred folder structure |
ba63cd01 | 15 | cd ~ |
7197cc5c | 16 | mkdir -p bin etc share share/fonts .urxvt/ext .icons .themes > /dev/null 2>&1 |
f7960c69 | 17 | mkdir -pm 700 var/tmp var/tmp/vim > /dev/null 2>&1 |
5b39422d | 18 | cd - |
19 | ||
a568f7fa | 20 | # ensure ostype |
3daa445f | 21 | if [ -z "$OSTYPE" ]; then |
f7960c69 | 22 | OSTYPE=`uname -s | tr '[:upper:]' '[:lower:]'` |
3daa445f | 23 | fi |
a568f7fa | 24 | |
25 | # accomodate multiple userlands | |
26 | lnargs=-sfnv | |
ba63cd01 | 27 | case "$OSTYPE" in |
28 | # TODO: make links safer for systems without -Fw | |
08660cec | 29 | freebsd*) lnargs=-sFhvw;; |
7197cc5c | 30 | netbsd|openbsd*) lnargs=-sfhv;; |
138de127 | 31 | esac |
32 | ||
9938f1e2 | 33 | l() { |
f29cd560 | 34 | # TODO: use install? |
138de127 | 35 | [ -L "$1" -o \! -e "$1" ] && ln $lnargs "${2:-$x}" "$1" |
9938f1e2 | 36 | } |
37 | ||
1f8bf106 | 38 | # link files |
ba63cd01 | 39 | find "$PWD/base" -mindepth 1 -maxdepth 1 | while read -r x; do |
9938f1e2 | 40 | l "$HOME/`basename "$x"`" |
41 | done | |
ba63cd01 | 42 | find bin share -mindepth 1 -maxdepth 1 | while read -r x; do |
de6b1600 | 43 | l "$HOME/$x" "$PWD/$x" |
f29cd560 | 44 | done |
ba63cd01 | 45 | find "$PWD/xdg" -mindepth 1 -maxdepth 1 | while read -r x; do |
7197cc5c | 46 | l "$HOME/etc/`basename "$x"`" |
7f0acd88 | 47 | done |
a568f7fa | 48 | find "$PWD/urxvt-ext" -type f -perm -111 -mindepth 1 -maxdepth 2 | while read -r x; do |
9938f1e2 | 49 | l "$HOME/.urxvt/ext/`basename $x`" |
805ce2dc | 50 | done |
a568f7fa | 51 | find "$PWD/xorg/icons" -type d -mindepth 1 -maxdepth 2 | while read -r x; do |
52 | if [ -e "$x/index.theme" ]; then | |
53 | l "$HOME/.icons/`basename "$x"`" | |
54 | fi | |
90595fd4 | 55 | done |
56 | find "$PWD/xorg/themes" -type d -mindepth 1 -maxdepth 1 | while read -r x; do | |
57 | l "$HOME/.themes/`basename "$x"`" | |
7197cc5c | 58 | done |
7197cc5c | 59 | find "$PWD/xorg/fonts" -type d -mindepth 1 -maxdepth 1 | while read -r x; do |
60 | l "$HOME/share/fonts/`basename "$x"`" | |
f7960c69 | 61 | done |
7f0acd88 | 62 | |
fef6b2b5 | 63 | # run .zprofile to set up tmp |
a568f7fa | 64 | zsh ~/.zprofile |