]> git.sev.monster Git - dotfiles.git/blame - install.sh
add tridactyl native updater, trim i3 config
[dotfiles.git] / install.sh
CommitLineData
189288f7 1#!/bin/sh
d9362f34 2
7197cc5c 3#NOTE: .zshenv XDG paths are hardcoded to allow non-zsh install
4
1f8bf106 5# test
f993e922 6devnull=/dev/null
7197cc5c 7if [ "$1" = "test" ]; then
f993e922 8 echo "Running test -- no changes will be applied"
9 devnull=/dev/stdout
10 _cd() {
11 cd $*;
12 echo " cd $*";
13 echo "\$PWD=$PWD";
14 }
15 alias cd="_cd"
16 alias mkdir="echo mkdir"
9938f1e2 17 alias ln="echo ln"
18 alias rm="echo rm"
f993e922 19 alias sh="echo sh"
9938f1e2 20fi
21
fef6b2b5 22# create preferred folder structure
ba63cd01 23cd ~
f993e922 24mkdir -p bin etc share share/fonts .urxvt/ext .icons .themes >$devnull 2>&1
25mkdir -pm 700 var/tmp var/tmp/vim >$devnull 2>&1
26cd - >$devnull
5b39422d 27
a568f7fa 28# ensure ostype
3daa445f 29if [ -z "$OSTYPE" ]; then
f7960c69 30 OSTYPE=`uname -s | tr '[:upper:]' '[:lower:]'`
3daa445f 31fi
a568f7fa 32
33# accomodate multiple userlands
34lnargs=-sfnv
ba63cd01 35case "$OSTYPE" in
f993e922 36 freebsd*) lnargs=-sFhv;;
7197cc5c 37 netbsd|openbsd*) lnargs=-sfhv;;
138de127 38esac
39
9938f1e2 40l() {
f29cd560 41 # TODO: use install?
f993e922 42 [ -L "$1" -o \! -e "$1" ] && ln $lnargs "${2:-$PWD/$x}" "$1" || \
43 echo "!!! File exists and is not a link: $1"
9938f1e2 44}
45
1f8bf106 46# link files
f993e922 47find base -mindepth 1 -maxdepth 1 | while read -r x; do
9938f1e2 48 l "$HOME/`basename "$x"`"
49done
ba63cd01 50find bin share -mindepth 1 -maxdepth 1 | while read -r x; do
f993e922 51 l "$HOME/$x"
f29cd560 52done
f993e922 53find xdg -mindepth 1 -maxdepth 1 | while read -r x; do
7197cc5c 54 l "$HOME/etc/`basename "$x"`"
7f0acd88 55done
f993e922 56find urxvt-ext -type f -perm -111 -mindepth 1 -maxdepth 2 | while read -r x; do
9938f1e2 57 l "$HOME/.urxvt/ext/`basename $x`"
805ce2dc 58done
f993e922 59find xorg/icons -type d -mindepth 1 -maxdepth 2 | while read -r x; do
a568f7fa 60 if [ -e "$x/index.theme" ]; then
61 l "$HOME/.icons/`basename "$x"`"
62 fi
90595fd4 63done
f993e922 64find xorg/themes -type d -mindepth 1 -maxdepth 1 | while read -r x; do
90595fd4 65 l "$HOME/.themes/`basename "$x"`"
7197cc5c 66done
f993e922 67find fonts -type d -mindepth 1 -maxdepth 1 | while read -r x; do
7197cc5c 68 l "$HOME/share/fonts/`basename "$x"`"
f7960c69 69done
f993e922 70#XXX: potential bug with newlines in profile name (if ff even takes it)
71#XXX: breaks on multiple profiles
72ffdir="`find "$HOME/.mozilla/firefox" -type d -mindepth 1 -maxdepth 1 | head -1 2>$devnull`"
73if [ -d "$ffdir" ]; then
74 find firefox -mindepth 1 -maxdepth 1 | while read -r x; do
75 l "$ffdir/`basename "$x"`"
76 done
77 cd "$ffdir"
78 echo "Updating user.js"
79 sh ./user-js-updater.sh
80 cd - >$devnull
81fi
7f0acd88 82
fef6b2b5 83# run .zprofile to set up tmp
a568f7fa 84zsh ~/.zprofile
This page took 0.077126 seconds and 4 git commands to generate.