]>
Commit | Line | Data |
---|---|---|
189288f7 | 1 | #!/bin/sh |
d9362f34 | 2 | |
9938f1e2 | 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 | ||
5b39422d | 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 | ||
138de127 | 20 | #accomodate linuxisms |
21 | fex='-perm -ugo=x' | |
22 | case "$OSTYPE" in | |
23 | *bsd*) lnargs=-sFhvw | |
24 | d1='-depth 1' | |
25 | bsd=yes;; | |
26 | *) lnargs=-sfnv | |
27 | d1='-mindepth 1 -maxdepth 1' | |
28 | #android busybox find doesn't have -execute | |
29 | #and its sh doesn't set OSTYPE :DD | |
30 | if [ -z "$ANDROID_ROOT" ]; then | |
31 | fex=-executable | |
32 | fi;; | |
33 | esac | |
34 | ||
9938f1e2 | 35 | l() { |
f29cd560 | 36 | # TODO: use install? |
138de127 | 37 | [ -L "$1" -o \! -e "$1" ] && ln $lnargs "${2:-$x}" "$1" |
9938f1e2 | 38 | } |
39 | ||
138de127 | 40 | find "$PWD/base" $d1 | while read -r x; do |
9938f1e2 | 41 | l "$HOME/`basename "$x"`" |
42 | done | |
138de127 | 43 | find bin share $d1 | while read -r x; do |
de6b1600 | 44 | l "$HOME/$x" "$PWD/$x" |
f29cd560 | 45 | done |
138de127 | 46 | find "$PWD/xdg" $d1 | while read -r x; do |
47 | l "${XDG_CONFIG_HOME:-$HOME/etc}/`basename "$x"`" | |
7f0acd88 | 48 | done |
138de127 | 49 | find "$PWD/urxvt-ext" -type f $fex -mindepth 1 -maxdepth 2 | while read -r x; do |
9938f1e2 | 50 | l "$HOME/.urxvt/ext/`basename $x`" |
805ce2dc | 51 | done |
7f0acd88 | 52 | |
138de127 | 53 | cd ~ |
54 | if [ -n "$bsd" ]; then | |
55 | touch .hushlogin | |
56 | ||
57 | #FreeBSD tries `_secure_path' on `.login_conf' before reading the database, | |
58 | #so it needs to be compiled and unlinked for it to actually take effect. | |
59 | rm .login_conf.db | |
60 | cap_mkdb .login_conf | |
61 | fi | |
39bd5e00 | 62 | unlink .login_conf |
d9362f34 | 63 | cd - |