]> git.sev.monster Git - dotfiles.git/blame - install.sh
fix some file redirects
[dotfiles.git] / install.sh
CommitLineData
1b8a4102 1#!/bin/sh
03bc64c4 2
84251d17 3# test
7f359c8a 4if [ 0 -eq 1 ]; then
5 alias mkdir="echo mkdir"
6 alias ln="echo ln"
7 alias rm="echo rm"
8 alias cap_mkdb="echo cap_mkdb"
9 alias unlink="echo unlink"
10fi
11
84251d17 12# accomodate linuxisms
cf9ecb6f 13fex='-perm -ugo=x'
e65c4132 14# TODO: should probably do this better
15case "`uname`" in
16 *BSD*) lnargs=-sFhvw
cf9ecb6f 17 d1='-depth 1'
18 bsd=yes;;
19 *) lnargs=-sfnv
20 d1='-mindepth 1 -maxdepth 1'
84251d17 21 # android busybox find doesn't have -execute
22 # and its sh doesn't set OSTYPE :DD
cf9ecb6f 23 if [ -z "$ANDROID_ROOT" ]; then
24 fex=-executable
25 fi;;
26esac
27
7f359c8a 28l() {
1390d028 29 # TODO: use install?
cf9ecb6f 30 [ -L "$1" -o \! -e "$1" ] && ln $lnargs "${2:-$x}" "$1"
7f359c8a 31}
32
84251d17 33
34# create preferred folder structure
35cd ~
36mkdir -p bin etc share var/run var/log urxvt/ext > /dev/null 2>&1
32bdde5f 37mkdir -m 700 var/tmp var/tmp/vim > /dev/null 2>&1
38[ -n "$bsd" ] && mkdir -m 700 tmp > /dev/null 2>&1
84251d17 39cd -
40
41# link files
cf9ecb6f 42find "$PWD/base" $d1 | while read -r x; do
7f359c8a 43 l "$HOME/`basename "$x"`"
44done
cf9ecb6f 45find bin share $d1 | while read -r x; do
a58ad2f0 46 l "$HOME/$x" "$PWD/$x"
1390d028 47done
cf9ecb6f 48find "$PWD/xdg" $d1 | while read -r x; do
49 l "${XDG_CONFIG_HOME:-$HOME/etc}/`basename "$x"`"
04ff96a4 50done
cf9ecb6f 51find "$PWD/urxvt-ext" -type f $fex -mindepth 1 -maxdepth 2 | while read -r x; do
7f359c8a 52 l "$HOME/.urxvt/ext/`basename $x`"
82151901 53done
04ff96a4 54
cf9ecb6f 55cd ~
56if [ -n "$bsd" ]; then
57 touch .hushlogin
58
84251d17 59 # FreeBSD tries `_secure_path' on `.login_conf' before reading the
60 # database, so it needs to be compiled and unlinked for it to actually
61 # take effect.
cf9ecb6f 62 rm .login_conf.db
63 cap_mkdb .login_conf
84251d17 64
65 # run .zprofile to set up tmp
66 /usr/local/bin/zsh .zprofile
cf9ecb6f 67fi
ee4bf66d 68unlink .login_conf
03bc64c4 69cd -
This page took 0.063557 seconds and 4 git commands to generate.