]>
Commit | Line | Data |
---|---|---|
189288f7 | 1 | #!/bin/sh |
d9362f34 | 2 | |
9938f1e2 | 3 | if [ 0 -eq 1 ]; then |
ba63cd01 | 4 | mkdir() { echo "$*"; } |
9938f1e2 | 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 | #create preferred folder structure |
ba63cd01 | 12 | cd ~ |
5b39422d | 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 | ||
138de127 | 17 | #accomodate linuxisms |
18 | fex='-perm -ugo=x' | |
ba63cd01 | 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;; | |
138de127 | 29 | esac |
30 | ||
9938f1e2 | 31 | l() { |
f29cd560 | 32 | # TODO: use install? |
138de127 | 33 | [ -L "$1" -o \! -e "$1" ] && ln $lnargs "${2:-$x}" "$1" |
9938f1e2 | 34 | } |
35 | ||
ba63cd01 | 36 | find "$PWD/base" -mindepth 1 -maxdepth 1 | while read -r x; do |
9938f1e2 | 37 | l "$HOME/`basename "$x"`" |
38 | done | |
ba63cd01 | 39 | find bin share -mindepth 1 -maxdepth 1 | while read -r x; do |
de6b1600 | 40 | l "$HOME/$x" "$PWD/$x" |
f29cd560 | 41 | done |
ba63cd01 | 42 | find "$PWD/xdg" -mindepth 1 -maxdepth 1 | while read -r x; do |
138de127 | 43 | l "${XDG_CONFIG_HOME:-$HOME/etc}/`basename "$x"`" |
7f0acd88 | 44 | done |
138de127 | 45 | find "$PWD/urxvt-ext" -type f $fex -mindepth 1 -maxdepth 2 | while read -r x; do |
9938f1e2 | 46 | l "$HOME/.urxvt/ext/`basename $x`" |
805ce2dc | 47 | done |
7f0acd88 | 48 | |
138de127 | 49 | cd ~ |
ba63cd01 | 50 | if [ "$OSTYPE" = "freebsd" ]; then |
138de127 | 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 | |
39bd5e00 | 58 | unlink .login_conf |
d9362f34 | 59 | cd - |