]> git.sev.monster Git - dotfiles.git/blame_incremental - install.sh
actually do what was mentioned in previous commit
[dotfiles.git] / install.sh
... / ...
CommitLineData
1#!/bin/sh
2
3#NOTE: .zshenv XDG paths are hardcoded to allow non-zsh install
4
5# test
6if [ "$1" = "test" ]; then
7 mkdir() { echo -- "$*"; }
8 alias ln="echo ln"
9 alias rm="echo rm"
10 alias cap_mkdb="echo cap_mkdb"
11 alias unlink="echo unlink"
12fi
13
14# create preferred folder structure
15cd ~
16mkdir -p bin etc share share/fonts .urxvt/ext .icons .themes > /dev/null 2>&1
17mkdir -pm 700 var/tmp var/tmp/vim > /dev/null 2>&1
18cd -
19
20# accomodate multiple userlands
21fex='-perm -ugo=x'
22lnargs=-sfnv
23if [ -z "$OSTYPE" ]; then
24 OSTYPE=`uname -s | tr '[:upper:]' '[:lower:]'`
25fi
26case "$OSTYPE" in
27 # TODO: make links safer for systems without -Fw
28 freebsd*) lnargs=-sFhvw;;
29 netbsd|openbsd*) lnargs=-sfhv;;
30 # android busybox find doesn't have -executable
31 android) fex=-executable;;
32esac
33
34l() {
35 # TODO: use install?
36 [ -L "$1" -o \! -e "$1" ] && ln $lnargs "${2:-$x}" "$1"
37}
38
39# link files
40find "$PWD/base" -mindepth 1 -maxdepth 1 | while read -r x; do
41 l "$HOME/`basename "$x"`"
42done
43find bin share -mindepth 1 -maxdepth 1 | while read -r x; do
44 l "$HOME/$x" "$PWD/$x"
45done
46find "$PWD/xdg" -mindepth 1 -maxdepth 1 | while read -r x; do
47 l "$HOME/etc/`basename "$x"`"
48done
49find "$PWD/urxvt-ext" -type f $fex -mindepth 1 -maxdepth 2 | while read -r x; do
50 l "$HOME/.urxvt/ext/`basename $x`"
51done
52find "$PWD/xorg/icons" -type d -mindepth 2 -maxdepth 2 | while read -r x; do
53 l "$HOME/.icons/`basename "$x"`"
54done
55find "$PWD/xorg/themes" -type d -mindepth 1 -maxdepth 1 | while read -r x; do
56 l "$HOME/.themes/`basename "$x"`"
57done
58find "$PWD/xorg/fonts" -type d -mindepth 1 -maxdepth 1 | while read -r x; do
59 l "$HOME/share/fonts/`basename "$x"`"
60done
61
62cd ~
63if [ "$OSTYPE" = "freebsd" ]; then
64 # FreeBSD tries `_secure_path' on `.login_conf' before reading the
65 # database, so it needs to be compiled and unlinked for it to actually
66 # take effect.
67 rm .login_conf.db
68 cap_mkdb .login_conf
69fi
70unlink .login_conf
71# run .zprofile to set up tmp
72zsh .zprofile
73cd -
This page took 0.04149 seconds and 4 git commands to generate.