]>
Commit | Line | Data |
---|---|---|
1b8a4102 | 1 | #!/bin/sh |
03bc64c4 | 2 | |
7f359c8a | 3 | if [ 0 -eq 1 ]; then |
4 | alias mkdir="echo mkdir" | |
5 | alias ln="echo ln" | |
6 | alias rm="echo rm" | |
7 | alias cap_mkdb="echo cap_mkdb" | |
8 | alias unlink="echo unlink" | |
9 | fi | |
10 | ||
1873e725 | 11 | #fix permissions from git (TODO: should probably move this to git hook) |
12 | chmod go= base/.zshenv base/.Xresources | |
13 | ||
14 | #create preferred folder structure | |
15 | cd "$HOME" | |
16 | mkdir -p bin etc share .urxvt/ext > /dev/null 2>&1 | |
17 | mkdir -m 700 tmp tmp/vim > /dev/null 2>&1 | |
18 | cd - | |
19 | ||
cf9ecb6f | 20 | #accomodate linuxisms |
21 | fex='-perm -ugo=x' | |
e65c4132 | 22 | # TODO: should probably do this better |
23 | case "`uname`" in | |
24 | *BSD*) lnargs=-sFhvw | |
cf9ecb6f | 25 | d1='-depth 1' |
26 | bsd=yes;; | |
27 | *) lnargs=-sfnv | |
28 | d1='-mindepth 1 -maxdepth 1' | |
29 | #android busybox find doesn't have -execute | |
30 | #and its sh doesn't set OSTYPE :DD | |
31 | if [ -z "$ANDROID_ROOT" ]; then | |
32 | fex=-executable | |
33 | fi;; | |
34 | esac | |
35 | ||
7f359c8a | 36 | l() { |
1390d028 | 37 | # TODO: use install? |
cf9ecb6f | 38 | [ -L "$1" -o \! -e "$1" ] && ln $lnargs "${2:-$x}" "$1" |
7f359c8a | 39 | } |
40 | ||
cf9ecb6f | 41 | find "$PWD/base" $d1 | while read -r x; do |
7f359c8a | 42 | l "$HOME/`basename "$x"`" |
43 | done | |
cf9ecb6f | 44 | find bin share $d1 | while read -r x; do |
a58ad2f0 | 45 | l "$HOME/$x" "$PWD/$x" |
1390d028 | 46 | done |
cf9ecb6f | 47 | find "$PWD/xdg" $d1 | while read -r x; do |
48 | l "${XDG_CONFIG_HOME:-$HOME/etc}/`basename "$x"`" | |
04ff96a4 | 49 | done |
cf9ecb6f | 50 | find "$PWD/urxvt-ext" -type f $fex -mindepth 1 -maxdepth 2 | while read -r x; do |
7f359c8a | 51 | l "$HOME/.urxvt/ext/`basename $x`" |
82151901 | 52 | done |
04ff96a4 | 53 | |
cf9ecb6f | 54 | cd ~ |
55 | if [ -n "$bsd" ]; then | |
56 | touch .hushlogin | |
57 | ||
58 | #FreeBSD tries `_secure_path' on `.login_conf' before reading the database, | |
59 | #so it needs to be compiled and unlinked for it to actually take effect. | |
60 | rm .login_conf.db | |
61 | cap_mkdb .login_conf | |
62 | fi | |
ee4bf66d | 63 | unlink .login_conf |
03bc64c4 | 64 | cd - |