]>
Commit | Line | Data |
---|---|---|
1b8a4102 | 1 | #!/bin/sh |
03bc64c4 | 2 | |
84251d17 | 3 | # test |
7f359c8a | 4 | if [ 0 -eq 1 ]; then |
d50f11d1 | 5 | mkdir() { echo -- "$*"; } |
7f359c8a | 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 | ||
d50f11d1 | 12 | # create preferred folder structure |
d877aef2 | 13 | cd ~ |
1873e725 | 14 | mkdir -p bin etc share .urxvt/ext > /dev/null 2>&1 |
d50f11d1 | 15 | mkdir -m 700 var/tmp var/tmp/vim > /dev/null 2>&1 |
1873e725 | 16 | cd - |
17 | ||
d50f11d1 | 18 | # accomodate multiple userlands |
cf9ecb6f | 19 | fex='-perm -ugo=x' |
74024535 | 20 | lnargs=-sfnv |
21 | if [ -z "$OSTYPE" ]; then | |
22 | OSTYPE=`uname -o | tr '[:upper:]' '[:lower:]'` | |
23 | fi | |
d877aef2 | 24 | case "$OSTYPE" in |
25 | # TODO: make links safer for systems without -Fw | |
72c6733b | 26 | freebsd*) lnargs=-sFhvw;; |
27 | netbsd*|openbsd*) lnargs=-sfhv;; | |
74024535 | 28 | # android busybox find doesn't have -executable |
29 | android) fex=-executable;; | |
cf9ecb6f | 30 | esac |
31 | ||
7f359c8a | 32 | l() { |
1390d028 | 33 | # TODO: use install? |
cf9ecb6f | 34 | [ -L "$1" -o \! -e "$1" ] && ln $lnargs "${2:-$x}" "$1" |
7f359c8a | 35 | } |
36 | ||
84251d17 | 37 | # link files |
d877aef2 | 38 | find "$PWD/base" -mindepth 1 -maxdepth 1 | while read -r x; do |
7f359c8a | 39 | l "$HOME/`basename "$x"`" |
40 | done | |
d877aef2 | 41 | find bin share -mindepth 1 -maxdepth 1 | while read -r x; do |
a58ad2f0 | 42 | l "$HOME/$x" "$PWD/$x" |
1390d028 | 43 | done |
d877aef2 | 44 | find "$PWD/xdg" -mindepth 1 -maxdepth 1 | while read -r x; do |
cf9ecb6f | 45 | l "${XDG_CONFIG_HOME:-$HOME/etc}/`basename "$x"`" |
04ff96a4 | 46 | done |
cf9ecb6f | 47 | find "$PWD/urxvt-ext" -type f $fex -mindepth 1 -maxdepth 2 | while read -r x; do |
7f359c8a | 48 | l "$HOME/.urxvt/ext/`basename $x`" |
82151901 | 49 | done |
04ff96a4 | 50 | |
cf9ecb6f | 51 | cd ~ |
d877aef2 | 52 | if [ "$OSTYPE" = "freebsd" ]; then |
cf9ecb6f | 53 | touch .hushlogin |
54 | ||
84251d17 | 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. | |
cf9ecb6f | 58 | rm .login_conf.db |
59 | cap_mkdb .login_conf | |
84251d17 | 60 | |
cf9ecb6f | 61 | fi |
ee4bf66d | 62 | unlink .login_conf |
d50f11d1 | 63 | # run .zprofile to set up tmp |
64 | zsh .zprofile | |
03bc64c4 | 65 | cd - |