]> git.sev.monster Git - dotfiles.git/blame - install.sh
actually do what was mentioned in previous commit
[dotfiles.git] / install.sh
CommitLineData
189288f7 1#!/bin/sh
d9362f34 2
7197cc5c 3#NOTE: .zshenv XDG paths are hardcoded to allow non-zsh install
4
1f8bf106 5# test
7197cc5c 6if [ "$1" = "test" ]; then
fef6b2b5 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"
12fi
13
fef6b2b5 14# create preferred folder structure
ba63cd01 15cd ~
7197cc5c 16mkdir -p bin etc share share/fonts .urxvt/ext .icons .themes > /dev/null 2>&1
f7960c69 17mkdir -pm 700 var/tmp var/tmp/vim > /dev/null 2>&1
5b39422d 18cd -
19
fef6b2b5 20# accomodate multiple userlands
138de127 21fex='-perm -ugo=x'
3daa445f 22lnargs=-sfnv
23if [ -z "$OSTYPE" ]; then
f7960c69 24 OSTYPE=`uname -s | tr '[:upper:]' '[:lower:]'`
3daa445f 25fi
ba63cd01 26case "$OSTYPE" in
27 # TODO: make links safer for systems without -Fw
08660cec 28 freebsd*) lnargs=-sFhvw;;
7197cc5c 29 netbsd|openbsd*) lnargs=-sfhv;;
3daa445f 30 # android busybox find doesn't have -executable
31 android) fex=-executable;;
138de127 32esac
33
9938f1e2 34l() {
f29cd560 35 # TODO: use install?
138de127 36 [ -L "$1" -o \! -e "$1" ] && ln $lnargs "${2:-$x}" "$1"
9938f1e2 37}
38
1f8bf106 39# link files
ba63cd01 40find "$PWD/base" -mindepth 1 -maxdepth 1 | while read -r x; do
9938f1e2 41 l "$HOME/`basename "$x"`"
42done
ba63cd01 43find bin share -mindepth 1 -maxdepth 1 | while read -r x; do
de6b1600 44 l "$HOME/$x" "$PWD/$x"
f29cd560 45done
ba63cd01 46find "$PWD/xdg" -mindepth 1 -maxdepth 1 | while read -r x; do
7197cc5c 47 l "$HOME/etc/`basename "$x"`"
7f0acd88 48done
138de127 49find "$PWD/urxvt-ext" -type f $fex -mindepth 1 -maxdepth 2 | while read -r x; do
9938f1e2 50 l "$HOME/.urxvt/ext/`basename $x`"
805ce2dc 51done
90595fd4 52find "$PWD/xorg/icons" -type d -mindepth 2 -maxdepth 2 | while read -r x; do
53 l "$HOME/.icons/`basename "$x"`"
54done
55find "$PWD/xorg/themes" -type d -mindepth 1 -maxdepth 1 | while read -r x; do
56 l "$HOME/.themes/`basename "$x"`"
7197cc5c 57done
7197cc5c 58find "$PWD/xorg/fonts" -type d -mindepth 1 -maxdepth 1 | while read -r x; do
59 l "$HOME/share/fonts/`basename "$x"`"
f7960c69 60done
7f0acd88 61
138de127 62cd ~
ba63cd01 63if [ "$OSTYPE" = "freebsd" ]; then
1f8bf106 64 # FreeBSD tries `_secure_path' on `.login_conf' before reading the
65 # database, so it needs to be compiled and unlinked for it to actually
66 # take effect.
138de127 67 rm .login_conf.db
68 cap_mkdb .login_conf
69fi
39bd5e00 70unlink .login_conf
fef6b2b5 71# run .zprofile to set up tmp
72zsh .zprofile
d9362f34 73cd -
This page took 0.052158 seconds and 4 git commands to generate.