]> git.sev.monster Git - dotfiles.git/blame - install.sh
actually do what was mentioned in previous commit
[dotfiles.git] / install.sh
CommitLineData
1b8a4102 1#!/bin/sh
03bc64c4 2
8720834f 3#NOTE: .zshenv XDG paths are hardcoded to allow non-zsh install
4
84251d17 5# test
8720834f 6if [ "$1" = "test" ]; then
d50f11d1 7 mkdir() { echo -- "$*"; }
7f359c8a 8 alias ln="echo ln"
9 alias rm="echo rm"
10 alias cap_mkdb="echo cap_mkdb"
11 alias unlink="echo unlink"
12fi
13
d50f11d1 14# create preferred folder structure
d877aef2 15cd ~
8720834f 16mkdir -p bin etc share share/fonts .urxvt/ext .icons .themes > /dev/null 2>&1
ff1a2414 17mkdir -pm 700 var/tmp var/tmp/vim > /dev/null 2>&1
1873e725 18cd -
19
d50f11d1 20# accomodate multiple userlands
cf9ecb6f 21fex='-perm -ugo=x'
74024535 22lnargs=-sfnv
23if [ -z "$OSTYPE" ]; then
ff1a2414 24 OSTYPE=`uname -s | tr '[:upper:]' '[:lower:]'`
74024535 25fi
d877aef2 26case "$OSTYPE" in
27 # TODO: make links safer for systems without -Fw
72c6733b 28 freebsd*) lnargs=-sFhvw;;
8720834f 29 netbsd|openbsd*) lnargs=-sfhv;;
74024535 30 # android busybox find doesn't have -executable
31 android) fex=-executable;;
cf9ecb6f 32esac
33
7f359c8a 34l() {
1390d028 35 # TODO: use install?
cf9ecb6f 36 [ -L "$1" -o \! -e "$1" ] && ln $lnargs "${2:-$x}" "$1"
7f359c8a 37}
38
84251d17 39# link files
d877aef2 40find "$PWD/base" -mindepth 1 -maxdepth 1 | while read -r x; do
7f359c8a 41 l "$HOME/`basename "$x"`"
42done
d877aef2 43find bin share -mindepth 1 -maxdepth 1 | while read -r x; do
a58ad2f0 44 l "$HOME/$x" "$PWD/$x"
1390d028 45done
d877aef2 46find "$PWD/xdg" -mindepth 1 -maxdepth 1 | while read -r x; do
8720834f 47 l "$HOME/etc/`basename "$x"`"
04ff96a4 48done
cf9ecb6f 49find "$PWD/urxvt-ext" -type f $fex -mindepth 1 -maxdepth 2 | while read -r x; do
7f359c8a 50 l "$HOME/.urxvt/ext/`basename $x`"
82151901 51done
7796231b 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"`"
8720834f 57done
8720834f 58find "$PWD/xorg/fonts" -type d -mindepth 1 -maxdepth 1 | while read -r x; do
59 l "$HOME/share/fonts/`basename "$x"`"
ff1a2414 60done
04ff96a4 61
cf9ecb6f 62cd ~
d877aef2 63if [ "$OSTYPE" = "freebsd" ]; then
84251d17 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.
cf9ecb6f 67 rm .login_conf.db
68 cap_mkdb .login_conf
69fi
ee4bf66d 70unlink .login_conf
d50f11d1 71# run .zprofile to set up tmp
72zsh .zprofile
03bc64c4 73cd -
This page took 0.049053 seconds and 4 git commands to generate.