]> git.sev.monster Git - dotfiles.git/blame - install.sh
refactor submodules, add xorg, small fixes & changes
[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 ~
f7960c69 14mkdir -p bin etc share .urxvt/ext .icons .themes > /dev/null 2>&1
15mkdir -pm 700 var/tmp var/tmp/vim > /dev/null 2>&1
5b39422d 16cd -
17
fef6b2b5 18# accomodate multiple userlands
138de127 19fex='-perm -ugo=x'
3daa445f 20lnargs=-sfnv
21if [ -z "$OSTYPE" ]; then
f7960c69 22 OSTYPE=`uname -s | tr '[:upper:]' '[:lower:]'`
3daa445f 23fi
ba63cd01 24case "$OSTYPE" in
25 # TODO: make links safer for systems without -Fw
08660cec 26 freebsd*) lnargs=-sFhvw;;
27 netbsd*|openbsd*) lnargs=-sfhv;;
3daa445f 28 # android busybox find doesn't have -executable
29 android) fex=-executable;;
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
f7960c69 50find "$PWD/xorg" -type d -mindepth 3 -maxdepth 3 | while read -r x; do
51 l "$HOME/.icons/`basename $x`"
52done
53#TODO: theme
7f0acd88 54
138de127 55cd ~
ba63cd01 56if [ "$OSTYPE" = "freebsd" ]; then
1f8bf106 57 # FreeBSD tries `_secure_path' on `.login_conf' before reading the
58 # database, so it needs to be compiled and unlinked for it to actually
59 # take effect.
138de127 60 rm .login_conf.db
61 cap_mkdb .login_conf
62fi
39bd5e00 63unlink .login_conf
fef6b2b5 64# run .zprofile to set up tmp
65zsh .zprofile
d9362f34 66cd -
This page took 0.071387 seconds and 4 git commands to generate.