]> git.sev.monster Git - dotfiles.git/blame - install.sh
Merge branch 'master' of home:git/dotfiles
[dotfiles.git] / install.sh
CommitLineData
189288f7 1#!/bin/sh
d9362f34 2
1f8bf106 3# test
9938f1e2 4if [ 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"
10fi
11
fef6b2b5 12# create preferred folder structure
ba63cd01 13cd ~
5b39422d 14mkdir -p bin etc share .urxvt/ext > /dev/null 2>&1
fef6b2b5 15mkdir -m 700 var/tmp var/tmp/vim > /dev/null 2>&1
5b39422d 16cd -
17
fef6b2b5 18# accomodate multiple userlands
138de127 19fex='-perm -ugo=x'
ba63cd01 20case "$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 30esac
31
9938f1e2 32l() {
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 38find "$PWD/base" -mindepth 1 -maxdepth 1 | while read -r x; do
9938f1e2 39 l "$HOME/`basename "$x"`"
40done
ba63cd01 41find bin share -mindepth 1 -maxdepth 1 | while read -r x; do
de6b1600 42 l "$HOME/$x" "$PWD/$x"
f29cd560 43done
ba63cd01 44find "$PWD/xdg" -mindepth 1 -maxdepth 1 | while read -r x; do
138de127 45 l "${XDG_CONFIG_HOME:-$HOME/etc}/`basename "$x"`"
7f0acd88 46done
138de127 47find "$PWD/urxvt-ext" -type f $fex -mindepth 1 -maxdepth 2 | while read -r x; do
9938f1e2 48 l "$HOME/.urxvt/ext/`basename $x`"
805ce2dc 49done
7f0acd88 50
138de127 51cd ~
ba63cd01 52if [ "$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 61fi
39bd5e00 62unlink .login_conf
fef6b2b5 63# run .zprofile to set up tmp
64zsh .zprofile
d9362f34 65cd -
This page took 0.050926 seconds and 4 git commands to generate.