]>
Commit | Line | Data |
---|---|---|
189288f7 | 1 | #!/bin/sh |
d9362f34 | 2 | |
1f8bf106 | 3 | # test |
9938f1e2 | 4 | if [ 0 -eq 1 ]; then |
fef6b2b5 | 5 | mkdir() { echo -- "$*"; } |
9938f1e2 | 6 | alias ln="echo ln" |
7 | alias rm="echo rm" | |
8 | alias cap_mkdb="echo cap_mkdb" | |
9 | alias unlink="echo unlink" | |
10 | fi | |
11 | ||
fef6b2b5 | 12 | # create preferred folder structure |
ba63cd01 | 13 | cd ~ |
5b39422d | 14 | mkdir -p bin etc share .urxvt/ext > /dev/null 2>&1 |
fef6b2b5 | 15 | mkdir -m 700 var/tmp var/tmp/vim > /dev/null 2>&1 |
5b39422d | 16 | cd - |
17 | ||
fef6b2b5 | 18 | # accomodate multiple userlands |
138de127 | 19 | fex='-perm -ugo=x' |
ba63cd01 | 20 | case "$OSTYPE" in |
21 | # TODO: make links safer for systems without -Fw | |
22 | freebsd) lnargs=-sFhvw;; | |
23 | netbsd|openbsd) lnargs=-sfhv;; | |
24 | *) lnargs=-sfnv | |
fef6b2b5 | 25 | # android busybox find doesn't have -executable |
26 | # and its sh doesn't set OSTYPE :DD | |
ba63cd01 | 27 | if [ -z "$ANDROID_ROOT" ]; then |
28 | fex=-executable | |
29 | fi;; | |
138de127 | 30 | esac |
31 | ||
9938f1e2 | 32 | l() { |
f29cd560 | 33 | # TODO: use install? |
138de127 | 34 | [ -L "$1" -o \! -e "$1" ] && ln $lnargs "${2:-$x}" "$1" |
9938f1e2 | 35 | } |
36 | ||
1f8bf106 | 37 | # link files |
ba63cd01 | 38 | find "$PWD/base" -mindepth 1 -maxdepth 1 | while read -r x; do |
9938f1e2 | 39 | l "$HOME/`basename "$x"`" |
40 | done | |
ba63cd01 | 41 | find bin share -mindepth 1 -maxdepth 1 | while read -r x; do |
de6b1600 | 42 | l "$HOME/$x" "$PWD/$x" |
f29cd560 | 43 | done |
ba63cd01 | 44 | find "$PWD/xdg" -mindepth 1 -maxdepth 1 | while read -r x; do |
138de127 | 45 | l "${XDG_CONFIG_HOME:-$HOME/etc}/`basename "$x"`" |
7f0acd88 | 46 | done |
138de127 | 47 | find "$PWD/urxvt-ext" -type f $fex -mindepth 1 -maxdepth 2 | while read -r x; do |
9938f1e2 | 48 | l "$HOME/.urxvt/ext/`basename $x`" |
805ce2dc | 49 | done |
7f0acd88 | 50 | |
138de127 | 51 | cd ~ |
ba63cd01 | 52 | if [ "$OSTYPE" = "freebsd" ]; then |
138de127 | 53 | touch .hushlogin |
54 | ||
1f8bf106 | 55 | # FreeBSD tries `_secure_path' on `.login_conf' before reading the |
56 | # database, so it needs to be compiled and unlinked for it to actually | |
57 | # take effect. | |
138de127 | 58 | rm .login_conf.db |
59 | cap_mkdb .login_conf | |
1f8bf106 | 60 | |
138de127 | 61 | fi |
39bd5e00 | 62 | unlink .login_conf |
fef6b2b5 | 63 | # run .zprofile to set up tmp |
64 | zsh .zprofile | |
d9362f34 | 65 | cd - |