]> git.sev.monster Git - dotfiles.git/blame - install.sh
add termux, organize .Xresources, export FPATH
[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
fef7b7c4 6devnull=/dev/null
8720834f 7if [ "$1" = "test" ]; then
fef7b7c4 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"
7f359c8a 17 alias ln="echo ln"
18 alias rm="echo rm"
fef7b7c4 19 alias sh="echo sh"
7f359c8a 20fi
21
d50f11d1 22# create preferred folder structure
d877aef2 23cd ~
1118e1ee 24mkdir -p bin etc share share/fonts .urxvt/ext \
25 .icons .themes .gnupg .ssh .termux >$devnull 2>&1
fef7b7c4 26mkdir -pm 700 var/tmp var/tmp/vim >$devnull 2>&1
27cd - >$devnull
1873e725 28
dcac60d9 29# ensure ostype
74024535 30if [ -z "$OSTYPE" ]; then
ff1a2414 31 OSTYPE=`uname -s | tr '[:upper:]' '[:lower:]'`
74024535 32fi
dcac60d9 33
34# accomodate multiple userlands
35lnargs=-sfnv
d877aef2 36case "$OSTYPE" in
fef7b7c4 37 freebsd*) lnargs=-sFhv;;
8720834f 38 netbsd|openbsd*) lnargs=-sfhv;;
cf9ecb6f 39esac
40
7f359c8a 41l() {
1390d028 42 # TODO: use install?
fef7b7c4 43 [ -L "$1" -o \! -e "$1" ] && ln $lnargs "${2:-$PWD/$x}" "$1" || \
44 echo "!!! File exists and is not a link: $1"
7f359c8a 45}
46
84251d17 47# link files
fef7b7c4 48find base -mindepth 1 -maxdepth 1 | while read -r x; do
7f359c8a 49 l "$HOME/`basename "$x"`"
50done
d877aef2 51find bin share -mindepth 1 -maxdepth 1 | while read -r x; do
fef7b7c4 52 l "$HOME/$x"
1390d028 53done
372276b7 54find fonts -mindepth 1 -maxdepth 1 -type d | while read -r x; do
55 l "$HOME/share/fonts/`basename "$x"`"
56done
fef7b7c4 57find xdg -mindepth 1 -maxdepth 1 | while read -r x; do
8720834f 58 l "$HOME/etc/`basename "$x"`"
04ff96a4 59done
c72b1cbd 60find urxvt-ext -mindepth 1 -maxdepth 2 -type f -perm -111 | while read -r x; do
7f359c8a 61 l "$HOME/.urxvt/ext/`basename $x`"
82151901 62done
c72b1cbd 63find xorg/icons -mindepth 1 -maxdepth 2 -type d | while read -r x; do
dcac60d9 64 if [ -e "$x/index.theme" ]; then
152474f6 65 d="$HOME/.icons/`basename "$x"`"
66 l $d
67 which gtk-update-icon-cache >/dev/null 2>&1 && gtk-update-icon-cache -qtf $d
68 unset d
dcac60d9 69 fi
7796231b 70done
c72b1cbd 71find xorg/themes -mindepth 1 -maxdepth 1 -type d | while read -r x; do
7796231b 72 l "$HOME/.themes/`basename "$x"`"
8720834f 73done
372276b7 74find gpg -mindepth 1 -maxdepth 1 \! -name '*.gpg' | while read -r x; do
75 l "$HOME/.gnupg/`basename "$x"`"
ff1a2414 76done
b4a8a4f9 77if which gpg >/dev/null 2>&1; then
372276b7 78 find gpg -mindepth 1 -maxdepth 1 -name '*.gpg' | while read -r x; do
79 gpg --import "$x"
80 done
81fi
1118e1ee 82for y in ssh termux; do
83 find $y -mindepth 1 -maxdepth 1 | while read -r x; do
84 l "$HOME/.$y/`basename "$x"`"
85 done
d569f3f7 86done
This page took 0.068048 seconds and 4 git commands to generate.