]>
Commit | Line | Data |
---|---|---|
1b8a4102 | 1 | #!/bin/sh |
03bc64c4 | 2 | |
7f359c8a | 3 | if [ 0 -eq 1 ]; then |
d877aef2 | 4 | mkdir() { echo "$*"; } |
7f359c8a | 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 | #create preferred folder structure |
d877aef2 | 12 | cd ~ |
1873e725 | 13 | mkdir -p bin etc share .urxvt/ext > /dev/null 2>&1 |
14 | mkdir -m 700 tmp tmp/vim > /dev/null 2>&1 | |
15 | cd - | |
16 | ||
cf9ecb6f | 17 | #accomodate linuxisms |
18 | fex='-perm -ugo=x' | |
d877aef2 | 19 | case "$OSTYPE" in |
20 | # TODO: make links safer for systems without -Fw | |
21 | freebsd) lnargs=-sFhvw;; | |
22 | netbsd|openbsd) lnargs=-sfhv;; | |
23 | *) lnargs=-sfnv | |
24 | #android busybox find doesn't have -executable | |
25 | #and its sh doesn't set OSTYPE :DD | |
26 | if [ -z "$ANDROID_ROOT" ]; then | |
27 | fex=-executable | |
28 | fi;; | |
cf9ecb6f | 29 | esac |
30 | ||
7f359c8a | 31 | l() { |
1390d028 | 32 | # TODO: use install? |
cf9ecb6f | 33 | [ -L "$1" -o \! -e "$1" ] && ln $lnargs "${2:-$x}" "$1" |
7f359c8a | 34 | } |
35 | ||
d877aef2 | 36 | find "$PWD/base" -mindepth 1 -maxdepth 1 | while read -r x; do |
7f359c8a | 37 | l "$HOME/`basename "$x"`" |
38 | done | |
d877aef2 | 39 | find bin share -mindepth 1 -maxdepth 1 | while read -r x; do |
a58ad2f0 | 40 | l "$HOME/$x" "$PWD/$x" |
1390d028 | 41 | done |
d877aef2 | 42 | find "$PWD/xdg" -mindepth 1 -maxdepth 1 | while read -r x; do |
cf9ecb6f | 43 | l "${XDG_CONFIG_HOME:-$HOME/etc}/`basename "$x"`" |
04ff96a4 | 44 | done |
cf9ecb6f | 45 | find "$PWD/urxvt-ext" -type f $fex -mindepth 1 -maxdepth 2 | while read -r x; do |
7f359c8a | 46 | l "$HOME/.urxvt/ext/`basename $x`" |
82151901 | 47 | done |
04ff96a4 | 48 | |
cf9ecb6f | 49 | cd ~ |
d877aef2 | 50 | if [ "$OSTYPE" = "freebsd" ]; then |
cf9ecb6f | 51 | touch .hushlogin |
52 | ||
53 | #FreeBSD tries `_secure_path' on `.login_conf' before reading the database, | |
54 | #so it needs to be compiled and unlinked for it to actually take effect. | |
55 | rm .login_conf.db | |
56 | cap_mkdb .login_conf | |
57 | fi | |
ee4bf66d | 58 | unlink .login_conf |
03bc64c4 | 59 | cd - |