]> git.sev.monster Git - dotfiles.git/blame_incremental - install.sh
git alias compatibility with busybox xargs
[dotfiles.git] / install.sh
... / ...
CommitLineData
1#!/bin/sh
2
3#NOTE: .zshenv XDG paths are hardcoded to allow non-zsh install
4
5# test
6devnull=/dev/null
7if [ "$1" = "test" ]; then
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"
17 alias ln="echo ln"
18 alias rm="echo rm"
19 alias sh="echo sh"
20fi
21
22# create preferred folder structure
23cd ~
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
27
28# ensure ostype
29if [ -z "$OSTYPE" ]; then
30 OSTYPE=`uname -s | tr '[:upper:]' '[:lower:]'`
31fi
32
33# accomodate multiple userlands
34lnargs=-sfnv
35case "$OSTYPE" in
36 freebsd*) lnargs=-sFhv;;
37 netbsd|openbsd*) lnargs=-sfhv;;
38esac
39
40l() {
41 # TODO: use install?
42 [ -L "$1" -o \! -e "$1" ] && ln $lnargs "${2:-$PWD/$x}" "$1" || \
43 echo "!!! File exists and is not a link: $1"
44}
45
46# link files
47find base -mindepth 1 -maxdepth 1 | while read -r x; do
48 l "$HOME/`basename "$x"`"
49done
50find bin share -mindepth 1 -maxdepth 1 | while read -r x; do
51 l "$HOME/$x"
52done
53find xdg -mindepth 1 -maxdepth 1 | while read -r x; do
54 l "$HOME/etc/`basename "$x"`"
55done
56find urxvt-ext -type f -perm -111 -mindepth 1 -maxdepth 2 | while read -r x; do
57 l "$HOME/.urxvt/ext/`basename $x`"
58done
59find xorg/icons -type d -mindepth 1 -maxdepth 2 | while read -r x; do
60 if [ -e "$x/index.theme" ]; then
61 l "$HOME/.icons/`basename "$x"`"
62 fi
63done
64find xorg/themes -type d -mindepth 1 -maxdepth 1 | while read -r x; do
65 l "$HOME/.themes/`basename "$x"`"
66done
67find fonts -type d -mindepth 1 -maxdepth 1 | while read -r x; do
68 l "$HOME/share/fonts/`basename "$x"`"
69done
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
82
83# run .zprofile to set up tmp
84zsh ~/.zprofile
This page took 0.03191 seconds and 4 git commands to generate.